/* 
    Premium Vanilla CSS Design System 
    Propofolio — Dark & Light Theme Support
*/

:root {
    /* ── LIGHT THEME (Default) ── */
    --clr-bg: #f5f7f7;
    --clr-surface: rgba(255, 255, 255, 0.85);
    --clr-surface-solid: #ffffff;
    --clr-surface-hover: rgba(235, 240, 240, 0.95);
    --clr-primary: #698a8a;
    --clr-primary-glow: rgba(105, 138, 138, 0.2);
    --clr-secondary: #4a6666;
    --clr-text-main: #0f172a;
    --clr-text-muted: #64748b;
    --clr-border: rgba(0, 0, 0, 0.1);
    --clr-error: #dc2626;
    --clr-success: #16a34a;
    --clr-sidebar-bg: rgba(248, 250, 252, 0.97);
    --clr-input-bg: rgba(255, 255, 255, 0.8);
    --clr-code-bg: rgba(0, 0, 0, 0.06);
    --clr-on-primary: #ffffff; /* Guaranteed contrast on gradients */

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;

    /* Effects */
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --glass-blur: blur(14px);

    /* Spacing */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;

    /* Transitions */
    --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.38s cubic-bezier(0.16, 1, 0.3, 1);

    /* Force light mode — dark theme is not supported */
    color-scheme: light;

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
}

/* Dark mode intentionally disabled — site enforces light theme.
@media (prefers-color-scheme: dark) {
    :root {
        --clr-bg: #0e1414;
        --clr-surface: rgba(21, 29, 29, 0.85);
        --clr-surface-solid: #151d1d;
        --clr-surface-hover: rgba(30, 42, 42, 0.95);
        --clr-border: rgba(255, 255, 255, 0.08);
        --clr-text-main: #f1f5f5;
        --clr-text-muted: #8da3a3;
        --clr-sidebar-bg: rgba(10, 15, 15, 0.97);
        --clr-input-bg: rgba(0, 0, 0, 0.4);
        --clr-code-bg: rgba(255, 255, 255, 0.08);
        --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
        --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}
*/

/* Global Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
    color: var(--clr-text-main);
    margin-bottom: var(--space-sm);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text; /* standard property added */
    letter-spacing: -1px;
}

p {
    color: var(--clr-text-muted);
    margin-bottom: var(--space-md);
}

a {
    color: var(--clr-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--clr-text-main);
    text-shadow: 0 0 10px var(--clr-primary-glow);
}

/* Background Effects */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    background: radial-gradient(circle, var(--clr-primary-glow) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
}

/* Components */
.glass-panel {
    background: var(--clr-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-smooth), border-color var(--transition-fast);
}

.glass-panel:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: all var(--transition-smooth);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    color: var(--clr-on-primary);
    box-shadow: 0 4px 15px var(--clr-primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px var(--clr-primary-glow);
    filter: brightness(1.1);
    color: var(--clr-on-primary);
}

.btn-surface {
    background: var(--clr-surface);
    color: var(--clr-text-main);
    border: 1px solid var(--clr-border);
}

.btn-surface:hover {
    background: var(--clr-surface-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Inputs */
.input-control {
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: var(--clr-input-bg);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    color: var(--clr-text-main);
    font-family: var(--font-body);
    transition: all var(--transition-fast);
    outline: none;
}

.input-control:focus {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-primary-glow);
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-lg); }
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Layouts */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--clr-sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--clr-border);
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--clr-text-muted);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: var(--clr-surface);
    color: var(--clr-primary);
}

/* Markdown Content Styling */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2 {
    margin-top: 2rem;
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: 0.5rem;
    color: var(--clr-text-main);
}

.article-content code {
    background: var(--clr-code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: var(--clr-primary);
}

.article-content pre {
    background: var(--clr-code-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    border: 1px solid var(--clr-border);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn var(--transition-smooth) forwards;
}


/* ── MOBILE RESPONSIVENESS & WEBVIEW UX ─────────────────────────── */

.mobile-header {
    display: none; /* Hidden on desktop */
}

.sidebar-overlay {
    display: none;
}

#mobile-sidebar-toggle {
    display: none;
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    /* Transform Sidebar into an Off-Canvas Drawer */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height support */
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        border-right: 1px solid var(--clr-border);
        box-shadow: none;
    }
    
    /* When hidden checkbox is checked, slide sidebar IN */
    #mobile-sidebar-toggle:checked ~ .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    
    /* Reveal the darkened overlay backdrop when open */
    #mobile-sidebar-toggle:checked ~ .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 999;
    }

    /* The Sticky Mobile Top Bar */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: max(12px, env(safe-area-inset-top)) var(--space-md) 10px var(--space-md);
        background: var(--clr-surface);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        position: sticky;
        top: 0;
        z-index: 900;
        border-bottom: 1px solid var(--clr-border);
    }

    .mobile-header h2 {
        font-size: 1.35rem; 
        margin: 0; 
        background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary)); 
        -webkit-background-clip: text; 
        background-clip: text; 
        -webkit-text-fill-color: transparent;
    }

    .hamburger-btn {
        background: transparent;
        border: none;
        color: var(--clr-text-main);
        font-size: 1.8rem;
        cursor: pointer;
        padding: 0.2rem;
    }

    /* Release the 280px rigid margin clamping the content */
    .main-content {
        margin-left: 0;
        padding: var(--space-md);
        padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
        width: 100%;
    }
    
    /* Typography adjustments to prevent horizontal bleed */
    h1 {
        font-size: 2rem !important;
    }
    
    /* Touch target minimum constraints (Apple HIG) */
    .btn, .input-control, .nav-link {
        min-height: 44px;
    }

    /* Target the Chat Widget specifically if embedded */
    .chat-fab-container {
        right: 15px !important;
        bottom: max(15px, env(safe-area-inset-bottom)) !important;
    }
    .chat-fab-container button {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.2rem !important;
    }
    
    .chat-window {
        width: 90vw !important;
        right: -10px !important;
        max-height: 70vh !important;
    }
}


/* Dashboard Grid Component Styles */
.dashboard-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.dashboard-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .dashboard-hero-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-quick-grid {
        grid-template-columns: 1fr;
    }
}
