/* ==========================================================================
   VARIABLES.CSS - Design Tokens
   ========================================================================== */
:root {
    /* Retro Schematic Palette */
    --bg-paper: #f4ecd8;
    --olive-dark: #3b422a;
    --olive-light: #6b7a4f;
    --grid-line: rgba(59, 66, 42, 0.15);
    
    /* Borders & Outlines */
    --border-thick: 3px solid var(--olive-dark);
    --border-thin: 1px solid var(--olive-dark);
    --shadow-solid: 6px 6px 0px var(--olive-dark);
    --shadow-solid-sm: 3px 3px 0px var(--olive-dark);
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --notebook-margin: 80px;
}

/* ==========================================================================
   BASE.CSS - Resets & Global Styles
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-paper);
    color: var(--olive-dark);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    /* Graph Paper Effect */
    background-size: 20px 20px;
    background-image: 
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px), 
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: var(--notebook-margin);
    width: 2px;
    height: 100%;
    background: rgba(183, 28, 28, 0.2); /* Red notebook margin line */
    z-index: -1;
}

h1, h2, h3, .ui-label {
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.mono, code, input, .stat-value, .stat-row .value {
    font-family: var(--font-mono);
    font-weight: 500;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Notebook Spine Decoration */
.notebook-spine {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100%;
    background: var(--olive-dark);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 20px 0;
}

.spine-hole {
    width: 20px;
    height: 20px;
    background: var(--bg-paper);
    border-radius: 50%;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.2);
}

/* ==========================================================================
   LAYOUT.CSS - Navigation & Sections
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    height: 80px;
    background: var(--bg-paper);
    border-bottom: var(--border-thick);
    z-index: 1000;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.auth-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    text-transform: uppercase;
    border: var(--border-thin);
    padding: 4px 12px;
    background: var(--olive-dark);
    color: var(--bg-paper);
    display: inline-block;
}

.logo .highlight { color: #c0ca33; }

.nav-links { 
    display: flex; 
    gap: 16px; 
    list-style: none; 
    margin: 0; 
    padding: 0; 
}
.nav-item {
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 8px 14px;
    border: var(--border-thin);
    text-decoration: none;
    color: var(--olive-dark);
    background: var(--bg-paper);
    box-shadow: 3px 3px 0px var(--olive-dark);
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
    display: block;
}
.nav-links a:hover { 
    transform: translate(2px, 2px); 
    box-shadow: 1px 1px 0px var(--olive-dark);
    background: var(--olive-light);
    color: var(--bg-paper);
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Dropdown & User Menu Spacing Fix */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: var(--bg-paper);
    border: var(--border-thick);
    padding: 8px 16px;
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--olive-dark);
    max-width: 350px; /* Increased limit */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropbtn svg {
    flex-shrink: 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-paper);
    min-width: 160px;
    box-shadow: var(--shadow-solid);
    border: var(--border-thick);
    z-index: 1000;
    margin-top: 10px;
    top: 100%;
}

/* Invisible bridge */
.dropdown-content::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}

.dropdown-content a {
    color: var(--olive-dark);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: var(--border-thin);
}

.dropdown-content a:last-child { border-bottom: none; }
.dropdown-content a:hover { background-color: var(--olive-dark); color: var(--bg-paper); }
.dropdown:hover .dropdown-content { display: block; }

/* Sections */
.hero { padding: 100px 0; border-bottom: var(--border-thin); }
.features, .demo-section, .process-section { 
    padding: 80px 0; 
    border-bottom: var(--border-thin);
}

/* ==========================================================================
   COMPONENTS.CSS - UI Elements
   ========================================================================== */
/* Buttons */
.btn-primary, .btn-cta-pill, .btn-login, .demo-pill, .btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    background: var(--bg-paper);
    border: var(--border-thick);
    color: var(--olive-dark);
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-solid);
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: var(--font-sans);
}

.btn-primary:hover, .btn-cta-pill:hover, .demo-pill:hover:not(:disabled) {
    transform: translate(3px, 3px);
    box-shadow: 3px 3px 0px var(--olive-dark);
    background: var(--olive-light);
    color: var(--bg-paper);
}

.btn-primary { background: var(--olive-dark); color: var(--bg-paper); }

/* Cards */
.feature-card, .process-card, .demo-interface-wrapper {
    background: var(--bg-paper);
    border: var(--border-thick);
    padding: 30px;
    position: relative;
    box-shadow: var(--shadow-solid);
    margin-bottom: 20px;
    transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s;
}

.feature-card:hover, .process-card:hover {
    transform: translate(3px, 3px);
    box-shadow: 3px 3px 0px var(--olive-dark);
    background-color: rgba(59, 66, 42, 0.03);
    cursor: default;
}

.feature-card::before, .process-card::before {
    content: attr(data-id);
    position: absolute;
    top: -14px;
    left: 15px;
    background: var(--olive-dark);
    color: var(--bg-paper);
    padding: 2px 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    border: none;
    text-transform: uppercase;
}

.feature-card::after {
    content: "X:" attr(data-x) " Y:" attr(data-y);
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    opacity: 0.5;
}

/* Dropdowns */
.dropdown {
    position: relative;
}

.dropbtn {
    background: var(--bg-paper);
    border: var(--border-thick);
    padding: 8px 16px;
    text-transform: uppercase;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.dropdown-content {
    background: var(--bg-paper);
    border: var(--border-thick);
    box-shadow: var(--shadow-solid);
    display: none;
    z-index: 1000;
}

.dropdown-content.dropdown-active { display: block; position: absolute; right: 0; top: 100%; margin-top: 10px; width: 200px; }
.dropdown-content a { padding: 12px; display: block; border-bottom: var(--border-thin); font-weight: 700; text-decoration: none; color: inherit; }
.dropdown-content a:hover { background: var(--olive-dark); color: var(--bg-paper); }

/* Demo Interface Specifics */
.window-controls { border-bottom: var(--border-thick); background: var(--olive-dark); color: var(--bg-paper); padding: 10px 20px; }
.demo-body { display: grid; grid-template-columns: 1.5fr 1fr; border-top: none; }
.demo-chat-panel { border-right: var(--border-thick); display: flex; flex-direction: column; background: rgba(59, 66, 42, 0.02); }
.demo-stats-panel { background: rgba(59, 66, 42, 0.05); }

/* Chat Messages - Highlighted Schematic Style */
.demo-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: msgIn 0.3s ease-out;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    background: var(--olive-dark);
    color: var(--bg-paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.7rem;
    border: var(--border-thin);
    flex-shrink: 0;
}

.bubble {
    padding: 12px 16px;
    border: var(--border-thick);
    background: var(--bg-paper);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    position: relative;
    box-shadow: var(--shadow-solid-sm);
    max-width: 80%;
}

.message.bot .bubble {
    background: #fff9c4; /* Soft yellow highlight */
    border-left: 8px solid var(--olive-dark); /* Bold accent border */
}

.message.user .bubble {
    background: var(--olive-dark);
    color: var(--bg-paper);
    box-shadow: -4px 4px 0px var(--olive-light);
}

.stat-row { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--olive-dark); padding: 8px 0; }
.stat-row.highlight { border-bottom: none; background: var(--olive-dark); color: var(--bg-paper); padding: 12px; margin-top: 10px; }

/* Schematic Hero Visual */
.schematic-diagram {
    border: var(--border-thin);
    padding: 20px;
    background: rgba(255,255,255,0.3);
    position: relative;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.schematic-node {
    border: var(--border-thick);
    padding: 15px;
    background: var(--bg-paper);
    z-index: 2;
    box-shadow: var(--shadow-solid-sm);
}

.schematic-line {
    position: absolute;
    border-top: 2px dashed var(--olive-dark);
    width: 60%;
    top: 50%;
    z-index: 1;
}

/* Mobile Toggle */
.hamburger-menu {
    display: none;
    background: var(--bg-paper);
    border: var(--border-thick);
    padding: 8px;
    cursor: pointer;
}

/* Mobile Sidebar Specifics */
.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-links .nav-item {
    width: 100%;
    text-align: center;
}

.sidebar-auth {
    margin-top: 30px;
    padding-top: 30px;
    border-top: var(--border-thin);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-auth .dropdown {
    width: 100%;
}

.sidebar-auth .dropbtn {
    width: 100%;
    justify-content: center;
    margin-bottom: 5px;
}

.sidebar-auth .dropdown-content {
    position: relative; /* Push layout */
    top: 0;
    width: 100%;
    display: none; /* Controlled by .dropdown-active */
    box-shadow: none;
    border-style: dashed;
    background: rgba(59, 66, 42, 0.05);
}

.sidebar-auth .dropdown-content.dropdown-active {
    display: block;
}

.sidebar-auth .dropdown-content a {
    text-align: center;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(59, 66, 42, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen */
    width: 85vw;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-paper);
    border-left: var(--border-thick);
    z-index: 2000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Header is fixed, content scrolls */
}
.mobile-sidebar.active { right: 0; }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 60px 20px; /* Increased bottom padding for safe area */
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.no-scroll {
    overflow: hidden !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .demo-body { grid-template-columns: 1fr; }
    .demo-chat-panel { border-right: none; border-bottom: var(--border-thick); }
}

@media (max-width: 768px) {
    :root { --notebook-margin: 20px; }
    .container { padding: 0 20px; }
    .notebook-spine { display: none; }
    .desktop-only { display: none !important; }
    .hamburger-menu { display: block; }
    .hero-content-split { grid-template-columns: 1fr !important; text-align: center; gap: 20px !important; }
    
    /* Mobile Spacing Optimizations */
    .sidebar-links { gap: 10px; }
    .sidebar-auth { margin-top: 20px; padding-top: 20px; gap: 10px; }
    .sidebar-auth .ui-label { font-size: 0.65rem; margin-bottom: 4px; }
    
    /* Demo Section Mobile Fixes */
    .demo-interface-wrapper { box-shadow: 6px 6px 0px var(--olive-dark); }
    .demo-stats-panel { padding: 20px !important; }
    .demo-messages { padding: 15px !important; height: 250px !important; }
    .demo-interaction-area { padding: 15px !important; }
    .demo-pill { padding: 8px 12px; font-size: 0.75rem; }
    .demo-input-fake { font-size: 0.75rem; padding: 8px !important; flex-wrap: wrap; }
    .demo-input-fake .input-prompt { margin-right: 5px !important; font-size: 0.65rem; }
    #demo-typing-area { word-break: break-all; }
    
    /* Hero Image Mobile Fix */
    .hero-visual-wrapper img { width: 100% !important; transform: none !important; margin-top: 20px; }
    .hero-text-wrapper-left h1 { font-size: 2.5rem !important; }
}

/* Extra Small Devices (iPhone SE, etc.) */
@media (max-width: 380px) {
    .mobile-sidebar { width: 90vw; }
    .sidebar-content { padding: 15px 15px 50px 15px; }
    .sidebar-links li { margin-bottom: 10px !important; }
    .nav-item { padding: 6px 10px; font-size: 0.7rem; }
    .sidebar-auth { margin-top: 15px; padding-top: 15px; }
    .sidebar-header { padding: 15px !important; }
}

/* =========================================
   URDU LOCALIZATION STYLES
   ========================================= */
[lang="ur"] {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Nastaliq Urdu', serif !important;
}

[lang="ur"] .nav-links,
[lang="ur"] .auth-buttons,
[lang="ur"] .footer-links,
[lang="ur"] .demo-controls,
[lang="ur"] .stats-grid,
[lang="ur"] .hero-content-split {
    direction: rtl;
}

/* Fix for icons/arrows in RTL */
[lang="ur"] .dropbtn svg,
[lang="ur"] .back-btn svg {
    margin-right: 10px;
    margin-left: 0;
}

[lang="ur"] .logo {
    letter-spacing: 0;
}

