/* =========================================
   1. Root Variables (Dark Mode Theme)
   ========================================= */
:root {
    --bg-dark: #0F172A;
    /* Deep Slate 900 */
    --bg-card: #1E293B;
    /* Slate 800 */
    --bg-input: #020617;
    /* Slate 950 */
    /* Slightly lighter for input area */

    --text-white: #F8FAFC;
    --text-gray: #94A3B8;
    /* Slate 400 */
    --text-muted: #64748B;
    /* Slate 500 */

    --accent-red: #0EA5E9;
    /* Sky 500 (Primary) */
    /* Renaming concept: usage remains --accent-red for now to minimize refactor risk */
    --accent-red-hover: #0284C7;
    /* Sky 600 */
    --accent-green: #10B981;
    --accent-orange: #F59E0B;

    --font-heading: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --border-color: #334155;
    /* Slate 700 */
    --radius-lg: 12px;
    --radius-md: 8px;

    --grid-color: rgba(56, 189, 248, 0.05);
    /* Sky Blue grid */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-heading);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    /* Grid Background Pattern */
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   2. Navbar
   ========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #333;
}

.logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-name {
    font-family: 'Cascadia Code', 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 2.2rem;
    letter-spacing: -0.02em;
}

.beta-badge {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(14, 165, 233, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 2px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    align-self: center;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn:hover {
    color: var(--text-white);
}

.btn-pro {
    background: var(--accent-red);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.2s;
}

.btn-pro:hover {
    background: var(--accent-red-hover);
}

/* =========================================
   2a. User Menu (Profile Dropdown)
   ========================================= */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #333;
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar:hover {
    border-color: var(--accent-red);
    transform: scale(1.05);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initial {
    color: var(--text-white);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

/* Dropdown */
.profile-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
    transform-origin: top right;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.user-email {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-gray);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    /* marker */
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-white);
}

.dropdown-item.text-red:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.05);
    border-left-color: #EF4444;
}

/* =========================================
   3. Hero Typography
   ========================================= */
.main-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    font-weight: 800;
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: -0.04em;
}

.text-gradient {
    background: linear-gradient(90deg, #FF6B6B, #DC443B);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-subtext {
    font-size: 1.2rem;
    color: var(--text-gray);
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
}

.highlight {
    color: var(--text-white);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}

.partners {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 60px;
    color: var(--text-gray);
    font-weight: 600;
    font-size: 1rem;
}

.partner-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   4. The "Editor" Window
   ========================================= */
.editor-container {
    width: 100%;
    margin-bottom: 60px;
}

.editor-window {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.window-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background: #EF4444;
}

.dot-yellow {
    background: #F59E0B;
}

.dot-green {
    background: #10B981;
}

.window-title {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-gray);
    font-weight: 500;
}

.badge-pill {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Editor Body */
.editor-body {
    padding: 24px;
    background: var(--bg-input);
    min-height: 250px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.helper-link-container {
    margin-top: 8px;
    padding-left: 2px;
}

.helper-link {
    font-family: var(--font-heading);
    /* Ensure it matches UI font */
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.helper-link:hover {
    color: var(--accent-red);
    text-decoration: underline;
    text-decoration-color: rgba(14, 165, 233, 0.3);
    /* match accent-red/sky-500 low opacity */
}

.input-prefix {
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.code-input {
    width: 100%;
    min-height: 200px;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.code-input::placeholder {
    color: #3F3F46;
}

/* Editor Footer */
.editor-footer {
    padding: 16px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.model-select {
    background: none;
    border: none;
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.model-select option {
    background: var(--bg-card);
}

.tag-free {
    background: #14532D;
    color: #4ADE80;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.checkbox-group {
    display: flex;
    gap: 16px;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.checkbox-group input {
    accent-color: var(--accent-red);
}

.analyze-btn {
    background: var(--accent-red);
    background: linear-gradient(180deg, #0EA5E9 0%, #0284C7 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    font-family: var(--font-mono);
    cursor: pointer;
    box-shadow: 0 4px 0 #0369A1;
    /* Sky 700 */
    /* 3D button effect */
    transition: transform 0.1s, box-shadow 0.1s;
}

.analyze-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #7F1D1D;
}

.analyze-btn:hover {
    filter: brightness(1.1);
}

.loading-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

/* =========================================
   5. Results & Examples
   ========================================= */
.section-label {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 30px;
    letter-spacing: -0.02em;
}

.examples-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
}

/* Example Card Styles */
.example-card {
    background: linear-gradient(145deg, rgba(20, 20, 22, 0.4) 0%, rgba(10, 10, 12, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.example-card::after {
    content: 'Click to Try';
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-red);
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.example-card:hover {
    border-color: var(--accent-red);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: linear-gradient(145deg, rgba(20, 20, 22, 0.7) 0%, rgba(10, 10, 12, 0.9) 100%);
}

.example-card:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.score-badge {
    padding: 2px 6px;
    border-radius: 4px;
    color: #111;
}

.score-badge.orange {
    background: var(--accent-orange);
}

.score-badge.green {
    background: var(--accent-green);
}

.card-prompt {
    font-family: var(--font-mono);
    color: var(--text-gray);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Results Area (Hidden) */
/* Reusing style for result steps to look like dark cards */
/* Result Steps Styles */
.step-card {
    background: linear-gradient(145deg, rgba(20, 20, 22, 0.6) 0%, rgba(10, 10, 12, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.7;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.step-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.step-card::before {
    /* Subtle glow effect */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-red);
    opacity: 0.7;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.step-header span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.01em;
}

.step-content {
    color: #D4D4D8;
    white-space: pre-wrap;
    /* Preserve newlines */
}

/* Copy Button Styling */
.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-gray);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
    box-shadow: 0 0 10px rgba(220, 68, 59, 0.4);
}

.copy-btn svg {
    opacity: 0.8;
}

.copy-btn:hover svg {
    opacity: 1;
}

.score-card {
    text-align: center;
    margin-bottom: 30px;
}

#score-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-green);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .brand-name {
        font-size: 1.5rem;
    }

    .examples-grid {
        grid-template-columns: 1fr;
    }

    .footer-left {
        display: none;
    }

    /* Hide complicated controls on mobile */
    .editor-footer {
        justify-content: center;
    }
}

/* =========================================
   6. AI Thinking Loader
   ========================================= */
.thinking-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}

.loader-content {
    z-index: 2010;
    text-align: center;
}

.thinking-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-white);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.thinking-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.loader-fragments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2005;
}

.loader-fragment {
    position: absolute;
    background: radial-gradient(circle, rgba(220, 68, 59, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.6;
}

/* Button Disabled State */
.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
    transform: none !important;
    box-shadow: none !important;
}

/* Animations */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 68, 59, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 68, 59, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 68, 59, 0);
    }
}

/* Locked State for Analyze Button - Premium Upgrade Style */
.analyze-btn.btn-locked {
    background: linear-gradient(135deg, #0EA5E9 0%, #2563EB 100%) !important;
    /* Vivid Blue Gradient */
    cursor: pointer !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 1 !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.analyze-btn.btn-locked::after {
    /* Shimmer effect */
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.analyze-btn.btn-locked:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-1px) !important;
    filter: brightness(1.1);
}

/* Premium Lock Container - Replaces the old message box */
.premium-lock-container {
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

.lock-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.lock-icon-small {
    color: #FBBF24;
    /* Amber 400 */
    display: flex;
    align-items: center;
}

.lock-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #FBBF24;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.premium-cta-group {
    display: flex;
    align-items: center;
}

.cta-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

@media (max-width: 768px) {
    .premium-lock-container {
        margin-left: 0;
        margin-top: 12px;
        align-items: center;
        text-align: center;
    }
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   7. Social Media Icons & Footer
   ========================================= */
.header-socials {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: 24px;
    padding-left: 24px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    height: 24px;
}

.social-link {
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-link:hover {
    color: var(--text-white);
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

.social-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.site-footer {
    width: 100%;
    margin-top: 80px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin-bottom: 24px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-brand {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: -0.01em;
}

.footer-socials {
    display: flex;
    gap: 20px;
}


.footer-bottom-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    text-align: center;
}

.built-with {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.footer-tagline {
    font-size: 0.8rem;
    color: var(--text-gray);
    opacity: 0.7;
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

.footer-feedback {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: default;
}

.footer-feedback:hover {
    opacity: 1;
    color: var(--accent-red);
}

@media (max-width: 600px) {
    .header-socials {
        margin-left: 12px;
        padding-left: 12px;
        gap: 10px;
        border-left: none;
    }
}