/* 
   PROJECT: Synzo AI Agent Showcase
   VERSION: 2.0 (2026 Modern/Glassmorphism)
   AUTHOR: Paul O'Hagan
   
   TABLE OF CONTENTS:
   1. Theme Variables (Colors, Shadows, Geometry)
   2. Global Reset & Base Styles
   3. App Layout Architecture
   4. Sidebar: Shared Base Styles
   5. Sidebar: Desktop Logic (Hover/Expand Dock)
   6. Sidebar: Mobile Logic (Touch Drawer & Safe Areas)
   7. Content Containers & Typography
   8. UI Components (Buttons, Inputs, Cards)
   9. Navigation Tabs (Segmented Control)
   10. Utilities (Scrollbars, Animations)
   11. Mobile Content Overrides
*/

/* ==========================================================================
   1. THEME VARIABLES
   ========================================================================== */
:root {
    /* --- Brand Palette (Indigo/Violet) --- */
    --brand-primary: #4f46e5;       
    --brand-secondary: #7c3aed;     
    --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    
    /* --- Semantic Surfaces --- */
    --surface-card: rgba(255, 255, 255, 0.85); /* High translucency for glass */
    --surface-ground: #f5f5f7;      /* Apple-style off-white background */
    
    /* --- Typography Colors --- */
    --text-primary: #1e293b;        /* Slate 800 - softer than pure black */
    --text-secondary: #64748b;      /* Slate 500 - high readability grey */
    
    /* --- Borders & Shadows --- */
    --border-subtle: rgba(0, 0, 0, 0.06); 
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    /* Apple-style diffuse shadows */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    
    /* --- Geometry --- */
    --radius-md: 10px;
    --radius-lg: 16px;
    
    /* --- Font Stack --- */
    /* Prioritizes System Fonts (San Francisco) for native feel */
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ==========================================================================
   2. GLOBAL RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Remove tap highlights on mobile for a native app feel */
* { -webkit-tap-highlight-color: transparent; }

/* Brand-colored text selection */
::selection {
    background: rgba(79, 70, 229, 0.2);
    color: var(--text-primary);
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased; /* Crisp text for MacOS */
    -moz-osx-font-smoothing: grayscale;
    
    /* Mesh Gradient Background */
    background: 
        radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.08), transparent 25%), 
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.08), transparent 25%),
        var(--surface-ground);
    
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden; /* App-like structure: Body doesn't scroll, content area does */
}

/* ==========================================================================
   3. APP LAYOUT ARCHITECTURE
   ========================================================================== */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background-color: transparent; 
    scroll-behavior: smooth;
}

#main-content-wrapper {
    padding: 2.5rem;
}

/* Mobile header hidden by default on desktop */
.mobile-header, .mobile-overlay { 
    display: none; 
}

/* ==========================================================================
   4. SIDEBAR: SHARED BASE STYLES
   ========================================================================== */
.sidebar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
    z-index: 100;
    overflow: hidden; 
}

.sidebar ul {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* The Link Container (Row) */
.sidebar-link {
    display: flex;
    align-items: center;
    height: 72px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 18px;
    margin: 0 10px;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* The 3D Icon (Anchor) */
.sidebar-icon-img {
    min-width: 48px;
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 12px;
    background-color: white;
    
    /* Subtle inner light + drop shadow for depth */
    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.08), 
        inset 0 0 0 1px rgba(255, 255, 255, 0.4); 
    
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* The Text Label */
.sidebar-link span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 20px;
    transition: all 0.2s ease;
}

/* The Brand Logo (Top Left) */
.brand-logo {
    min-width: 56px; 
    width: 56px;
    height: 56px;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
    object-fit: cover;
}

/* ==========================================================================
   5. SIDEBAR: DESKTOP LOGIC (Hover/Expand Dock)
   APPLIES TO: Screens > 768px
   ========================================================================== */
@media (min-width: 769px) {
    body { background-attachment: fixed; } /* Desktop supports fixed bg */

    .sidebar {
        width: 96px; /* Default collapsed width */
        height: 100vh;
        transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    /* Expand Sidebar on Hover */
    .sidebar:hover {
        width: 300px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 10px 0 50px rgba(0,0,0,0.1);
    }

    /* --- HEADER CENTERING LOGIC --- */
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: center; /* Center logo when collapsed */
        padding: 0 0 2rem 0;
        margin-bottom: 0.5rem;
        white-space: nowrap;
        width: 100%;
    }

    /* Text starts hidden (0 width) to prevent layout shift */
    .sidebar-header span {
        font-size: 1.4rem; font-weight: 800; color: var(--text-primary);
        max-width: 0; margin-left: 0; opacity: 0; transform: translateX(-10px);
        overflow: hidden; 
        transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    /* Text reveals on hover */
    .sidebar:hover .sidebar-header span {
        max-width: 200px; margin-left: 18px; opacity: 1; transform: translateX(0);
        transition-delay: 0.1s;
    }

    /* Shift alignment to left when expanded */
    .sidebar:hover .sidebar-header {
        justify-content: flex-start;
        padding-left: 10px; 
    }

    /* --- LINK CENTERING LOGIC --- */
    .sidebar-link {
        /* Math: (96px Sidebar - 20px Margin - 48px Icon) / 2 = 14px Padding */
        padding-left: 14px; 
    }

    .sidebar-link span {
        opacity: 0;
        transform: translateX(-15px);
    }

    .sidebar:hover .sidebar-link span {
        opacity: 1;
        transform: translateX(0);
        transition-delay: 0.05s;
    }

    /* --- INTERACTION STATES --- */
    .sidebar-link:hover { background-color: rgba(0, 0, 0, 0.04); }
    .sidebar-link:hover .sidebar-icon-img { transform: scale(1.15); box-shadow: 0 12px 24px rgba(0,0,0,0.15); }
    .sidebar-link:hover span { color: var(--text-primary); }

    /* Active State (Selected Tab) */
    .sidebar-link.active { background-color: transparent; }
    .sidebar:hover .sidebar-link.active { background-color: rgba(255, 255, 255, 0.6); }
    
    .sidebar-link.active .sidebar-icon-img { 
        transform: scale(1.05); 
        box-shadow: 0 0 0 3px var(--brand-primary), 0 8px 20px rgba(79, 70, 229, 0.25); 
    }
    .sidebar-link.active span { color: var(--brand-primary); font-weight: 700; }
}

/* ==========================================================================
   6. SIDEBAR: MOBILE LOGIC (Touch Drawer)
   APPLIES TO: Screens <= 768px
   ========================================================================== */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    
    body { background-attachment: scroll; } /* Fix iOS jitter */

    /* The Drawer */
    .sidebar { 
        position: fixed; 
        top: 0; left: 0; 
        width: 280px; 
        height: 100dvh; /* Dynamic Height for Safari Bottom Bar */
        transform: translateX(-100%); /* Start hidden off-screen */
        z-index: 2000;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 10px 0 30px rgba(0,0,0,0.15);
        overflow-y: auto; 
        padding: 24px 10px;
        
        /* iOS Safe Area Insets (Notch support) */
        padding-top: max(24px, env(safe-area-inset-top)); 
        padding-bottom: max(80px, env(safe-area-inset-bottom));
        
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Open State */
    .sidebar.show { transform: translateX(0); }
    
    /* Ensure text is always visible on mobile */
    .sidebar-link span, .sidebar-header span { 
        opacity: 1 !important; 
        transform: none !important; 
        max-width: none; 
        margin-left: 18px; 
    }
    
    .sidebar-header {
        justify-content: flex-start; /* Left align on mobile */
        padding-left: 10px;
    }
    
    /* Dark Overlay Backdrop */
    .mobile-overlay { 
        display: block; /* Enabled via CSS, hidden via opacity */
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.4); 
        backdrop-filter: blur(4px);
        z-index: 1500; 
        opacity: 0; 
        pointer-events: none; /* Click-through when hidden */
        transition: opacity 0.3s;
    }
    .mobile-overlay.show { opacity: 1; pointer-events: auto; }
    
    /* Native iOS-Style Header Bar */
    .mobile-header { 
        display: flex; 
        align-items: center; 
        justify-content: space-between;
        height: auto; 
        padding: 1rem 1.5rem;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-subtle);
        position: sticky; top: 0; z-index: 50;
        
        /* Handle Notch Height */
        padding-top: max(1rem, env(safe-area-inset-top)); 
    }
    
    .mobile-menu-toggle { 
        background: none; border: none; font-size: 1.75rem; color: var(--text-primary); cursor: pointer; padding: 0;
    }
    
    /* Mobile Brand Centerpiece */
    .mobile-brand { display: flex; align-items: center; gap: 10px; }
    .mobile-brand img { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2); }
    .mobile-brand span { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
    .mobile-spacer { width: 30px; } /* Balances menu button */
    
    /* Fix Content Padding */
    #main-content-wrapper { 
        padding: 1.5rem 1rem; 
        padding-bottom: 120px; /* Space for scrolling past bottom */
    }
}

/* ==========================================================================
   7. CONTENT CONTAINERS & TYPOGRAPHY
   ========================================================================== */
.feature-container {
    background: var(--surface-card);
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6); 
    box-shadow: var(--shadow-xl); 
    border-radius: var(--radius-lg);
    padding: 3rem;
    max-width: 1000px;
    margin: 0 auto;
    position: relative; 
    overflow: hidden; 
}

h1 { font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: -0.03em; color: var(--text-primary); line-height: 1.2; display: flex; align-items: center; gap: 12px; }
h1 img { border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
h2 { font-size: 1.5rem; font-weight: 600; margin: 2rem 0 1rem 0; letter-spacing: -0.025em; color: var(--text-primary); }
h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 0.75rem; font-weight: 700; }
p { line-height: 1.65; margin-bottom: 1rem; color: var(--text-secondary); font-size: 1rem; }

/* ==========================================================================
   8. UI COMPONENTS (Buttons, Inputs, Grids)
   ========================================================================== */

/* Primary Action Button */
.submit-button, button[type="submit"] {
    background: var(--text-primary); 
    color: white; 
    border: none; 
    padding: 0.75rem 1.5rem; 
    border-radius: 8px; 
    font-weight: 500; 
    cursor: pointer; 
    font-size: 0.95rem; 
    transition: all 0.15s ease; 
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.submit-button:hover { background: #1f2937; transform: translateY(-1px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); }
.submit-button:active { transform: scale(0.97); }
.submit-button:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; transform: none; box-shadow: none; }

/* Secondary Button */
.btn-secondary {
    background: white; border: 1px solid var(--border-subtle); color: var(--text-secondary);
    padding: 0.75rem 1.5rem; border-radius: 8px; cursor: pointer; font-weight: 500;
    transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: #f9fafb; color: var(--text-primary); border-color: #d1d5db; transform: translateY(-1px); }

/* Drag & Drop Zone */
.drop-zone-style {
    display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%;
    border: 2px dashed #cbd5e1; background: #f8fafc; border-radius: 16px;
    padding: 3rem 2rem; text-align: center; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); gap: 1rem;
}
.drop-zone-style:hover {
    border-color: var(--brand-primary);
    background: #eff6ff; 
    transform: scale(1.01); box-shadow: var(--shadow-md);
}

/* Inputs & Sliders */
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); border-color: var(--brand-primary); }

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; height: 24px; cursor: pointer; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 6px; background: #e2e8f0; border-radius: 99px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 22px; width: 22px; border-radius: 50%; background: var(--brand-primary); margin-top: -8px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); border: 2px solid #ffffff; transition: transform 0.1s ease; }

/* Grids */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.feature-item { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(10px); border: 1px solid var(--border-subtle); padding: 1.5rem; border-radius: var(--radius-md); transition: all 0.3s ease; }
.feature-item:hover { box-shadow: var(--shadow-lg); background: rgba(255, 255, 255, 0.9); transform: translateY(-2px); border-color: rgba(79, 70, 229, 0.2); }

/* Messages & Spinners */
.message-item { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; animation: slideInDown 0.3s ease; box-shadow: var(--shadow-sm); }
.message-item.category-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.message-item.category-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.message-item.category-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
@keyframes slideInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   9. TABS (SEGMENTED CONTROL)
   ========================================================================== */

/* The Container (Track) */
.feature-tabs {
    display: inline-flex;
    background-color: #f1f5f9;
    padding: 6px;
    border-radius: 20px;
    gap: 0;
    margin-bottom: 2rem;
    border: 1px solid rgba(0,0,0,0.05);
    overflow-x: auto;
}
.feature-tabs::-webkit-scrollbar { display: none; }

/* The Tab Button */
.feature-tabs .tab-link {
    display: inline-flex; align-items: center;
    padding: 8px 24px;
    height: 70px;
    background: none; border: 2px solid transparent; border-radius: 16px;
    cursor: pointer;
    font-family: var(--font-sans); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; color: #64748b;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
}

/* 50px 3D Icons */
.tab-icon-img {
    width: 50px; height: 50px;
    object-fit: contain;
    margin-right: 16px;
    vertical-align: middle;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12)); 
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* States */
.feature-tabs .tab-link:hover { background-color: rgba(255, 255, 255, 0.5); color: #334155; }
.tab-link:hover .tab-icon-img { transform: scale(1.1) translateY(-2px); filter: drop-shadow(0 8px 12px rgba(0,0,0,0.15)); }

.feature-tabs .tab-link.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-color: rgba(0,0,0,0.02);
}
.tab-link.active .tab-icon-img { transform: scale(1.1) translateY(-2px); filter: drop-shadow(0 6px 15px rgba(79, 70, 229, 0.35)); }

/* ==========================================================================
   10. UTILITIES
   ========================================================================== */
/* Custom Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 70, 229, 0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0.2) transparent; }

/* ==========================================================================
   11. MOBILE CONTENT OVERRIDES (Specific Fixes)
   ========================================================================== */
@media (max-width: 768px) {
    .feature-container { padding: 1.5rem; }
    
    /* 1. Mobile Tabs: Shrink to Segmented Control */
    .feature-tabs { width: 100%; display: flex; padding: 4px; background-color: #e2e8f0; }
    .feature-tabs .tab-link { flex: 1; justify-content: center; height: 56px; padding: 0 4px; font-size: 0.9rem; }
    .tab-icon-img { width: 28px; height: 28px; margin-right: 6px; filter: none; } /* Reset big 3D effects on mobile */
    
    /* 2. Grid Collapsing */
    .feature-grid, .info-grid, .capability-grid, .connect-grid { grid-template-columns: 1fr !important; }
    .about-me-layout { display: flex; flex-direction: column; }
    .profile-card { width: 100%; max-width: 100%; }
    
    /* 3. Hero Resizing */
    .welcome-hero { padding: 2.5rem 1.5rem; min-height: auto; }
    .welcome-hero h1 { font-size: 1.75rem; }
    
    /* 4. Page Header Fixes */
    h1 { font-size: 1.5rem; flex-direction: column; align-items: flex-start; gap: 10px; }
    h1 img { width: 48px !important; height: 48px !important; margin: 0 !important; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
    
    /* 5. Hide Info Cards on Mobile (Fixes Squished UI) */
    .info-grid { display: none !important; }
    .control-panel { margin-top: 1rem; }
    
    /* 6. Tables */
    table { display: block; overflow-x: auto; white-space: nowrap; }
}