/* ==========================================================================
   2026 Tech Startup Design System
   ========================================================================== */

@layer reset, theme, base, layout, components, animations;

/* --- RESET LAYER --- */
@layer reset {
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    html, body {
        height: 100%;
        scroll-behavior: smooth;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    input, button, textarea, select {
        font: inherit;
        background: transparent;
        border: none;
        color: inherit;
    }

    button {
        cursor: pointer;
    }

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

/* --- THEME LAYER --- */
@layer theme {
    :root {
        /* Colors */
        --bg-color: #050409;
        --bg-glow: radial-gradient(circle at 50% -20%, #1c1535 0%, #050409 70%);
        --surface-color: rgba(255, 255, 255, 0.02);
        --surface-border: rgba(255, 255, 255, 0.06);
        --surface-border-hover: rgba(255, 255, 255, 0.15);
        
        --text-primary: #ffffff;
        --text-secondary: #a3a1b4;
        --text-muted: #646275;
        
        --accent-primary: #8b5cf6;
        --accent-secondary: #ec4899;
        --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
        --accent-gradient-hover: linear-gradient(135deg, #c084fc 0%, #f472b6 100%);
        --accent-glow: 0 0 30px rgba(139, 92, 246, 0.25);
        
        /* Fonts */
        --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        
        /* Transitions */
        --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        --transition-fast: 0.15s ease;
    }
}

/* --- BASE LAYER --- */
@layer base {
    body {
        font-family: var(--font-sans);
        background-color: var(--bg-color);
        background-image: var(--bg-glow);
        background-repeat: no-repeat;
        background-size: cover;
        background-attachment: fixed;
        color: var(--text-secondary);
        overflow-x: hidden;
        line-height: 1.6;
    }

    h1, h2, h3, h4 {
        color: var(--text-primary);
        font-weight: 600;
        letter-spacing: -0.02em;
        text-wrap: balance;
    }

    /* Selection */
    ::selection {
        background-color: rgba(139, 92, 246, 0.3);
        color: var(--text-primary);
    }

    /* Scrollbar */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 4px;
        border: 2px solid var(--bg-color);
    }
    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    /* Global Focus Outline */
    *:focus-visible {
        outline: 2px solid rgba(139, 92, 246, 0.6);
        outline-offset: 4px;
    }
}

/* --- LAYOUT LAYER --- */
@layer layout {
    /* Centered Landing Layout */
    .landing-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 48px;
        padding: 40px 24px;
        width: 100%;
        max-width: 680px;
        margin: auto;
        min-height: 100vh;
        animation: fade-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Header Nav */
    body > header, .nav-bar {
        width: 100%;
        height: 72px;
        padding: 0 24px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--surface-border);
        background: rgba(5, 4, 9, 0.6);
        backdrop-filter: blur(12px);
        position: sticky;
        top: 0;
        z-index: 100;
        flex-shrink: 0;
    }

    .main-container {
        width: 100%;
        max-width: 960px;
        margin: 0 auto;
        padding: 48px 24px 96px;
        display: flex;
        flex-direction: column;
        gap: 48px;
        animation: fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Page Titles */
    .page-header {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 2.25rem;
        background: var(--accent-gradient);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 700;
    }

    .page-header p {
        font-size: 1.1rem;
        color: var(--text-secondary);
        max-width: 600px;
    }
}

/* --- COMPONENTS LAYER --- */
@layer components {
    /* Logo adjustments */
    .logo, .nav-logo {
        display: inline-flex;
        align-items: center;
        height: 100%;
    }

    .logo img, .nav-logo img {
        height: 32px;
        width: auto;
        object-fit: contain;
        transition: opacity var(--transition-fast);
        filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.15));
    }

    .logo img:hover, .nav-logo img:hover {
        opacity: 0.85;
    }

    .logo-container {
        width: 100%;
        max-width: 320px;
        display: flex;
        justify-content: center;
    }

    .logo-container img {
        width: 100%;
        height: auto;
        object-fit: contain;
        transition: opacity var(--transition-fast);
        filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.2));
    }

    .logo-container img:hover {
        opacity: 0.85;
    }

    .tagline {
        font-size: 1.15rem;
        color: var(--text-secondary);
        text-align: center;
        line-height: 1.7;
        max-width: 480px;
        font-weight: 400;
    }

    /* Buttons */
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: 100%;
        max-width: 380px;
    }

    .btn-primary {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px 28px;
        border-radius: 30px;
        font-size: 0.95rem;
        font-weight: 500;
        letter-spacing: 0.01em;
        background: var(--accent-gradient);
        color: var(--text-primary);
        transition: transform var(--transition-fast), box-shadow var(--transition-fast);
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
    }

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 24px rgba(139, 92, 246, 0.35), var(--accent-glow);
    }

    .btn-primary:active {
        transform: translateY(0);
    }

    .btn-secondary {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px 28px;
        border-radius: 30px;
        font-size: 0.95rem;
        font-weight: 500;
        letter-spacing: 0.01em;
        background: var(--surface-color);
        color: var(--text-primary);
        border: 1px solid var(--surface-border);
        backdrop-filter: blur(8px);
        transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
    }

    .btn-secondary:hover {
        border-color: var(--surface-border-hover);
        background-color: rgba(255, 255, 255, 0.05);
        transform: translateY(-2px);
    }

    .btn-secondary:active {
        transform: translateY(0);
    }

    /* Header Navigation Back-Link */
    .header-back, .nav-back {
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.08em;
        transition: color var(--transition-fast), transform var(--transition-fast);
        position: relative;
    }

    .header-back:hover, .nav-back:hover {
        color: var(--text-primary);
        transform: translateX(-2px);
    }

    /* Grid Sections */
    .section-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .section-title {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        color: var(--text-muted);
        border-bottom: 1px solid var(--surface-border);
        padding-bottom: 8px;
    }

    /* Grid layout */
    .links-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }

    .grid-wide {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    /* Link cards */
    .link-card {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 18px 20px;
        border-radius: 16px;
        background: var(--surface-color);
        border: 1px solid var(--surface-border);
        transition: border-color var(--transition-smooth), background-color var(--transition-smooth), transform var(--transition-smooth), box-shadow var(--transition-smooth);
        backdrop-filter: blur(12px);
        position: relative;
        overflow: hidden;
    }

    .link-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0), rgba(255, 255, 255, 0.04), transparent 40%);
        z-index: 1;
        pointer-events: none;
        opacity: 0;
        transition: opacity var(--transition-smooth);
    }

    .link-card:hover::before {
        opacity: 1;
    }

    .link-card:hover {
        border-color: var(--surface-border-hover);
        background-color: rgba(255, 255, 255, 0.04);
        transform: translateY(-3px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    }

    .link-card:active {
        transform: translateY(-1px);
    }

    /* Dot styling */
    .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
        transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    }

    .link-card:hover .dot {
        transform: scale(1.3);
        box-shadow: 0 0 10px currentColor;
    }

    .dot-blue { background-color: #3b82f6; color: #3b82f6; }
    .dot-green { background-color: #10b981; color: #10b981; }
    .dot-amber { background-color: #f59e0b; color: #f59e0b; }
    .dot-slate { background-color: #94a3b8; color: #94a3b8; }
    .dot-violet { background-color: #8b5cf6; color: #8b5cf6; }
    .dot-rose { background-color: #f43f5e; color: #f43f5e; }
    .dot-teal { background-color: #14b8a6; color: #14b8a6; }
    .dot-orange { background-color: #f97316; color: #f97316; }

    /* --- Chat Solver Layout --- */
    .chat-viewport {
        flex: 1;
        overflow-y: auto;
        padding: 32px 24px;
        scroll-behavior: smooth;
    }

    .chat-wrapper {
        max-width: 720px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: 24px;
        min-height: 100%;
    }

    /* Hero inside chat */
    .welcome-hero {
        text-align: center;
        padding: 80px 24px 40px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        margin-top: 4vh;
        animation: fade-in var(--transition-smooth) forwards;
    }

    .welcome-hero h1 {
        font-size: 2.75rem;
        font-weight: 700;
        background: var(--accent-gradient);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .welcome-hero p {
        font-size: 1.1rem;
        color: var(--text-secondary);
        max-width: 480px;
    }

    /* Disclaimer Card */
    .disclaimer-card {
        margin-top: 12px;
        padding: 10px 20px;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.01);
        border: 1px solid var(--surface-border);
        color: var(--text-muted);
        font-size: 0.8rem;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        font-weight: 500;
    }

    /* Message Rows */
    .message-row {
        width: 100%;
        display: flex;
        animation: fade-in-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .user-row {
        justify-content: flex-end;
    }

    .bot-row {
        justify-content: flex-start;
    }

    .user-row .message-card {
        max-width: 75%;
        padding: 16px 24px;
        border-radius: 24px 24px 4px 24px;
        background: var(--accent-gradient);
        color: var(--text-primary);
        font-size: 0.95rem;
        line-height: 1.6;
        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15);
    }

    .bot-container {
        display: flex;
        max-width: 85%;
        gap: 16px;
        align-items: flex-start;
    }

    .bot-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid var(--surface-border);
        background: var(--surface-color);
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    .bot-avatar::after {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 2px;
        background: var(--accent-gradient);
        transform: rotate(45deg);
    }

    .bot-card {
        background: var(--surface-color);
        color: var(--text-primary);
        padding: 18px 24px;
        border-radius: 24px 24px 24px 4px;
        border: 1px solid var(--surface-border);
        font-size: 0.95rem;
        line-height: 1.6;
        backdrop-filter: blur(12px);
    }

    /* Input Area */
    .input-bar-container {
        padding: 16px 24px 32px 24px;
        background: linear-gradient(to top, var(--bg-color) 70%, transparent);
        flex-shrink: 0;
        width: 100%;
        z-index: 10;
    }

    .input-bar-wrapper {
        max-width: 720px;
        margin: 0 auto;
        display: flex;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--surface-border);
        border-radius: 30px;
        height: 56px;
        align-items: center;
        padding: 0 6px 0 24px;
        transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
        backdrop-filter: blur(16px);
    }

    .input-bar-wrapper:focus-within {
        border-color: var(--accent-primary);
        background-color: rgba(255, 255, 255, 0.04);
        box-shadow: 0 0 0 1px var(--accent-primary), 0 0 20px rgba(139, 92, 246, 0.15);
    }

    .input-bar-wrapper input {
        flex: 1;
        outline: none;
        font-size: 0.95rem;
        height: 100%;
        color: var(--text-primary);
    }

    .input-bar-wrapper input::placeholder {
        color: var(--text-muted);
    }

    .input-bar-wrapper button {
        height: 44px;
        padding: 0 26px;
        background: var(--accent-gradient);
        color: var(--text-primary);
        border-radius: 22px;
        font-weight: 500;
        font-size: 0.9rem;
        transition: transform var(--transition-fast), box-shadow var(--transition-fast);
        box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
    }

    .input-bar-wrapper button:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
    }

    .input-bar-wrapper button:disabled {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-muted);
        cursor: not-allowed;
        box-shadow: none;
        transform: none;
    }

    /* Typing Dots */
    .typing-indicator {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 20px;
        padding: 0 4px;
    }

    .typing-indicator span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        opacity: 0.4;
        animation: pulse 1.4s infinite ease-in-out;
    }

    .typing-indicator span:nth-child(1) {
        background: #a78bfa;
    }

    .typing-indicator span:nth-child(2) {
        background: #c084fc;
        animation-delay: 0.2s;
    }

    .typing-indicator span:nth-child(3) {
        background: #f472b6;
        animation-delay: 0.4s;
    }
}

/* --- ANIMATIONS LAYER --- */
@layer animations {
    @keyframes fade-in {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    @keyframes fade-in-up {
        from {
            opacity: 0;
            transform: translateY(12px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes pulse {
        0%, 100% {
            transform: scale(1);
            opacity: 0.4;
        }
        50% {
            transform: scale(1.3);
            opacity: 1;
        }
    }
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (min-width: 600px) {
    .button-group {
        flex-direction: row;
        max-width: 520px;
    }

    .btn-primary, .btn-secondary {
        flex: 1;
    }
}
