/* 
    Fake Tweet Generator - Premium Design System (The "Wow" Factor)
    Theme: Deep Slate & Vibrant Rose-Blue
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700;800&family=Inter:wght@400;600&display=swap');

:root {
    /* Colors - Classic X Palette */
    --primary: #1D9BF0; /* X Blue */
    --primary-alt: #4ab3f2;
    --accent: #1D9BF0;
    --accent-alt: #4ab3f2;
    --dark: #000000;
    --slate: #71767B;
    --light: #FFFFFF;
    --white: #FFFFFF;
    
    /* Semantic Gradients - Modernized */
    --grad-primary: linear-gradient(180deg, #1D9BF0 0%, #1A8CD8 100%);
    --grad-premium: linear-gradient(135deg, #1D9BF0 0%, #8ecdf8 100%);
    --grad-surface: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0.5));
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(239, 243, 244, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    
    /* Layout */
    --container-width: 1200px;
    --radius-lg: 16px;
    --radius-xl: 9999px; /* Capsule buttons */
    --gap-section: 80px;

    /* Tweet Parity Settings */
    --tweet-bg: #ffffff;
    --tweet-text: #0f1419;
    --tweet-subtext: #536471;
    --tweet-border: #eff3f4;
    --tweet-link: #1d9bf0;
}

[data-theme="dim"] {
    --tweet-bg: #15202b;
    --tweet-text: #f7f9f9;
    --tweet-subtext: #8b98a5;
    --tweet-border: #38444d;
    --light: #15202b;
    --dark: #ffffff;
}

[data-theme="dark"] {
    --tweet-bg: #000000;
    --tweet-text: #ffffff;
    --tweet-subtext: #71767b;
    --tweet-border: #2f3336;
    --light: #000000;
    --dark: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light);
    background-image: 
        radial-gradient(at 0% 0%, rgba(225, 29, 72, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .logo {
    font-family: 'DM Sans', sans-serif;
    font-weight: 800;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* --- UTILITIES --- */

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.03);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.text-gradient {
    background: var(--grad-premium);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-premium {
    background: var(--grad-premium);
    color: white;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- BUTTONS --- */

.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 32px;
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--dark);
    color: var(--light);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: transparent;
    color: var(--dark);
    border: 1px solid rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background: rgba(0,0,0,0.03);
}

/* --- GENERATOR LAYOUT --- */
.tool-stage {
    padding: 32px;
}
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    position: relative;
}

/* --- LOCKED OVERLAY --- */
.locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: flex; /* controlled by JS */
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    transition: all 0.4s ease;
}

.locked-content {
    text-align: center;
    padding: 60px;
    max-width: 450px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.theme-btn {
    padding: 12px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.theme-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.premium-locked i.fa-crown {
    font-size: 0.7rem;
    color: #ffd700;
}

/* --- FORMS & INPUTS --- */
.tweet-generator {
    padding: 24px;
}
.form-group {
    margin-bottom: 24px;
    position: relative;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--slate);
    font-size: 0.95rem;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.8);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}
.char-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 0.75rem;
    color: var(--slate);
    opacity: 0.6;
}

/* --- PROFILE SECTION --- */
.profile-section {
    padding: 20px;
    margin-bottom: 24px;
}
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.profile-actions {
    display: flex;
    gap: 8px;
}
.profile-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
    background: var(--light);
}
.profile-btn:hover {
    background: #e2e8f0;
}
.profile-content {
    display: flex;
    gap: 16px;
    align-items: center;
}
.profile-pic-container {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

/* --- IMAGE UPLOAD SECTION --- */
.image-upload-section {
    margin-bottom: 24px;
}
.upload-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.upload-option {
    border: 1px dashed rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    background: rgba(255,255,255,0.5);
}
.upload-option:hover {
    background: rgba(255,255,255,0.9);
    border-color: var(--accent);
}
.upload-option i {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 8px;
}
.upload-option h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.upload-option p {
    font-size: 0.75rem;
    color: var(--slate);
    opacity: 0.7;
}
.image-preview-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    display: none;
}
.image-preview-container.has-image {
    display: block;
}
.remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}
.action-buttons .btn {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }

/* --- BENTO GRID --- */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    margin: 40px 0;
}

.bento-item {
    border-radius: var(--radius-lg);
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.bento-item:hover {
    transform: scale(1.02);
}

/* --- TWEET CARD (The Star) --- */

.tweet-card-wrapper {
    perspective: 1000px;
}

.tweet-card {
    background: var(--tweet-bg);
    border-radius: 0;
    padding: 12px 16px;
    box-shadow: none;
    border: 1px solid var(--tweet-border);
    position: relative;
    max-width: 600px;
    width: 100%;
    color: var(--tweet-text);
    transition: background 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tweet-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.tweet-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.tweet-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tweet-user-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--tweet-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.tweet-verified {
    font-size: 0.95rem;
}

.tweet-verified.blue { color: #1d9bf0; }
.tweet-verified.gold { color: #eebb05; }
.tweet-verified.grey { color: #829aab; }

.tweet-user-handle {
    color: var(--tweet-subtext);
    font-size: 0.95rem;
}

.tweet-more {
    color: var(--tweet-subtext);
    font-size: 1rem;
}

.tweet-content {
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    color: var(--tweet-text);
    margin: 12px 0;
    line-height: 1.3;
    white-space: pre-wrap;
    word-break: break-word;
}

.tweet-content .mention, .tweet-content .hashtag {
    color: var(--tweet-link);
    text-decoration: none;
}

.tweet-image-container {
    margin: 16px 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #EFF3F4;
    position: relative;
}

.tweet-image-container img {
    width: 100%;
    display: block;
}

.tweet-stats-v2, .tweet-metrics-bar, .tweet-engagement-stats {
    border-color: var(--tweet-border) !important;
}

.metric-item span, .engagement-item span {
    color: var(--tweet-text);
}

.engagement-item {
    color: var(--tweet-subtext);
}

.tweet-actions {
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    color: var(--tweet-subtext);
    font-size: 1.1rem;
    border-top: 1px solid var(--tweet-border);
}

.tweet-action:hover {
    color: var(--tweet-link);
}

.watermark {
    position: absolute;
    bottom: 12px;
    right: 20px;
    font-size: 0.75rem;
    color: var(--tweet-subtext);
    opacity: 0.15;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- HEADER / NAV --- */

header.main-header {
    height: 80px;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

/* --- MODALS --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none; /* Normally hidden */
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--light);
    width: 100%;
    max-width: 600px;
    padding: 32px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.close-modal {
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--slate);
    cursor: pointer;
    transition: 0.2s;
}
.close-modal:hover {
    color: var(--primary);
}
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.template-card {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}
.template-card:hover {
    background: white;
    border-color: var(--accent);
}
.template-card.selected {
    background: white;
    border: 2px solid var(--primary);
    box-shadow: 0 0 10px rgba(225, 29, 72, 0.2);
}
.template-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 8px;
    object-fit: cover;
}
.template-name {
    font-weight: 700;
    font-size: 0.9rem;
    display: block;
    color: var(--dark);
}
.template-handle {
    font-size: 0.8rem;
    color: var(--slate);
}
.template-verified {
    font-size: 0.8rem;
    color: #1D9BF0;
    margin-top: 4px;
}
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- TOAST --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --- ANIMATIONS --- */

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.float-animation {
    animation: float 4s ease-in-out infinite;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .tweet-card {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }
    .hero-section {
        padding: 100px 0 60px !important;
    }
    .bento-grid {
        grid-template-columns: 1fr;
    }
    .btn-premium {
        width: 100%;
    }
    .action-buttons {
        flex-direction: column;
    }
    .action-buttons .btn {
        width: 100%;
    }
    .paywall-options {
        grid-template-columns: 1fr !important;
    }
    .upload-options {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .profile-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .tweet-preview {
        padding: 0 10px;
    }
}
