/**
 * Base Styles
 * Shared reset and common styles across all pages
 * This file should be loaded FIRST, before navigation.css and page-specific CSS
 */

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --card-bg: #1e293b;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-light: rgba(255, 255, 255, 0.1);

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    /* Portfolio Theme */
    --portfolio-primary: #818cf8;
    --portfolio-bg: rgba(129, 140, 248, 0.2);
    --portfolio-border: rgba(129, 140, 248, 0.3);

    /* CIS Theme */
    --cis-primary: #34d399;
    --cis-bg: rgba(52, 211, 153, 0.2);
    --cis-border: rgba(52, 211, 153, 0.3);

    /* Semantic Colors */
    --color-success: #22c55e;
    --color-success-bg: rgba(34, 197, 94, 0.1);
    --color-success-border: rgba(34, 197, 94, 0.3);
    --color-success-text: #15803d;

    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.1);
    --color-warning-border: rgba(245, 158, 11, 0.3);
    --color-warning-text: #92400e;

    --color-danger: #ef4444;
    --color-danger-bg: rgba(239, 68, 68, 0.1);
    --color-danger-border: rgba(239, 68, 68, 0.3);
    --color-danger-text: #991b1b;

    --color-info: #3b82f6;
    --color-info-bg: rgba(59, 130, 246, 0.1);
    --color-info-border: rgba(59, 130, 246, 0.3);
    --color-info-text: #1e40af;

    /* Hover variants for buttons */
    --color-success-hover: #16a34a;
    --color-warning-hover: #d97706;
    --color-danger-hover: #dc2626;

    /* Additional semantic colors */
    --color-cyan: #06b6d4;
    --color-cyan-bg: rgba(6, 182, 212, 0.1);
    --color-cyan-border: rgba(6, 182, 212, 0.3);

    --color-orange: #f97316;
    --color-orange-bg: rgba(249, 115, 22, 0.2);

    --color-pink: #ec4899;
    --color-pink-bg: rgba(236, 72, 153, 0.2);

    /* Buttons */
    --btn-primary-bg: #6366f1;
    --btn-primary-bg-hover: #4f46e5;
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: transparent;
    --btn-secondary-border: #334155;
    --btn-secondary-text: #e2e8f0;
    --btn-secondary-bg-hover: #1f2937;
    --btn-secondary-text-hover: #cbd5e1;

    /* Semantic Card Backgrounds */
    --card-success-bg: rgba(34, 197, 94, 0.08);
    --card-danger-bg: rgba(239, 68, 68, 0.08);
    --card-warning-bg: rgba(245, 158, 11, 0.08);
    --card-info-bg: rgba(59, 130, 246, 0.08);

    /* Header/Gradient backgrounds */
    --header-gradient-start: #1e293b;
    --header-gradient-end: #334155;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --sidebar-width-collapsed: 60px;
    --sidebar-width-expanded: 260px;
    --container-padding: 2rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    /* Border Radius */
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-sm: 8px;

    /* Layout */
    --content-max-width: 1800px;
    --content-padding: 2rem;
    --content-padding-md: 1.5rem;
    --content-padding-sm: 1.25rem;

    /* Header */
    --header-padding: 2.5rem 2rem;
    --header-radius: 12px;
    --header-icon-size: 56px;
    --header-gradient: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1a4971 100%);
    --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);

    /* Card Backgrounds (used across all pages) */
    --bg-card: var(--bg-secondary);
    --bg-card-hover: var(--bg-tertiary);

    /* Primary Color (alias for accent-primary, used in executive summaries) */
    --color-primary: #6366f1;
    --color-primary-light: rgba(99, 102, 241, 0.15);

    /* Transition shorthand (used across pages) */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing - Section and Card Gaps */
    --section-gap: 2rem;
    --card-gap: 1.5rem;
    --card-gap-sm: 1rem;

    /* Gap Utilities (aliased for semantic use) */
    --gap-xs: 0.5rem;
    --gap-sm: 0.75rem;
    --gap-md: 1rem;
    --gap-lg: 1.5rem;
    --gap-xl: 2rem;

    /* Shadows - Dark Theme */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.35);

    /* Card shadow shorthand */
    --card-shadow: var(--shadow-sm);
    --card-shadow-hover: var(--shadow-md);
}

/* Base Body Styles */
body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    margin-left: var(--sidebar-width-collapsed);
    transition: none;
    line-height: 1.5;
}

/* Expanded sidebar state - set by navigation.js */
body.sidebar-expanded {
    margin-left: var(--sidebar-width-expanded);
}

/* Once JS has applied sidebar state, use CSS variables (override any initial !important rules) */
body.sidebar-state-applied {
    margin-left: var(--sidebar-width-collapsed);
}

body.sidebar-state-applied.sidebar-expanded {
    margin-left: var(--sidebar-width-expanded);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Common Link Styles */
a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Common Button Base */
button {
    font-family: var(--font-family);
    cursor: pointer;
}

/* Button Variants */
.btn-primary,
.no-data-btn.primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--btn-primary-bg);
}

.btn-primary:hover,
.no-data-btn.primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
}

.btn-secondary,
.no-data-btn.secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
}

.btn-secondary:hover,
.no-data-btn.secondary:hover {
    background: var(--btn-secondary-bg-hover);
    color: var(--btn-secondary-text-hover);
    border-color: var(--btn-secondary-border);
}

/* No Data / Empty State (shared across pages) */
.no-data-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 2rem;
}

.no-data-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    max-width: 540px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.no-data-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(52, 211, 153, 0.15));
    border-radius: 50%;
    margin-bottom: 1.5rem;
    color: var(--btn-primary-bg);
}

.no-data-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.no-data-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0 0 2rem 0;
    line-height: 1.5;
}

.no-data-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.no-data-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.no-data-btn svg {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .no-data-card {
        padding: 2rem;
    }

    .no-data-actions {
        gap: 0.75rem;
    }
}

/* Responsive - Collapsed Sidebar */
@media (max-width: 640px) {
    body {
        margin-left: 0;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Light Theme - Professional Design with Clear Visual Hierarchy */
@media (prefers-color-scheme: light) {
    :root {
        /*
         * Color Strategy:
         * - bg-primary: Page background (cool neutral)
         * - bg-secondary: Section/card backgrounds (slightly warm, higher contrast)
         * - bg-tertiary: Nested elements (soft accent)
         */
        --bg-primary: #e2e8f0;
        --bg-secondary: #f1f5f9;
        --bg-tertiary: #e8eef5;
        --card-bg: #ffffff;

        --text-primary: #1e293b;
        --text-secondary: #475569;
        --text-muted: #64748b;

        --border-color: #cbd5e1;
        --border-light: rgba(30, 41, 59, 0.06);

        /* Portfolio Theme - Light Mode */
        --portfolio-primary: #5558e3;
        --portfolio-bg: rgba(99, 102, 241, 0.1);
        --portfolio-border: rgba(99, 102, 241, 0.2);

        /* CIS Theme - Light Mode */
        --cis-primary: #059669;
        --cis-bg: rgba(16, 185, 129, 0.1);
        --cis-border: rgba(16, 185, 129, 0.2);

        /* Semantic Colors - Light Mode */
        --color-success-bg: rgba(34, 197, 94, 0.15);
        --color-warning-bg: rgba(245, 158, 11, 0.15);
        --color-danger-bg: rgba(239, 68, 68, 0.15);
        --color-info-bg: rgba(59, 130, 246, 0.15);

        /* Semantic Card Backgrounds - Light Mode */
        --card-success-bg: rgba(34, 197, 94, 0.08);
        --card-danger-bg: rgba(239, 68, 68, 0.08);
        --card-warning-bg: rgba(245, 158, 11, 0.08);
        --card-info-bg: rgba(59, 130, 246, 0.08);

        /* Header/Gradient backgrounds - Light Mode */
        --header-gradient-start: #cbd5e1;
        --header-gradient-end: #e2e8f0;

        /* Hover variants - Light Mode */
        --color-success-hover: #16a34a;
        --color-warning-hover: #d97706;
        --color-danger-hover: #dc2626;

        /* Additional semantic colors - Light Mode */
        --color-cyan: #0891b2;
        --color-cyan-bg: rgba(6, 182, 212, 0.12);
        --color-cyan-border: rgba(6, 182, 212, 0.25);

        --color-orange: #ea580c;
        --color-orange-bg: rgba(249, 115, 22, 0.12);

        --color-pink: #db2777;
        --color-pink-bg: rgba(236, 72, 153, 0.12);

        /* Buttons - Light Mode */
        --btn-primary-bg: #4f46e5;
        --btn-primary-bg-hover: #4338ca;
        --btn-primary-text: #ffffff;
        --btn-secondary-bg: transparent;
        --btn-secondary-border: #94a3b8;
        --btn-secondary-text: #1e293b;
        --btn-secondary-bg-hover: #cbd5e1;
        --btn-secondary-text-hover: #111827;

        /* Layout - Light Mode - keep blue gradient for headers */
        --header-gradient: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1a4971 100%);

        /* Card Backgrounds - Light Mode (white cards on light gray background) */
        --bg-card: #ffffff;
        --bg-card-hover: #f8fafc;

        /* Primary Color - Light Mode */
        --color-primary: #4f46e5;
        --color-primary-light: rgba(79, 70, 229, 0.12);

        /* Shadows - Light Mode (softer shadows) */
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
        --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
        --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
        --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
}

/* Dark Mode Override - Manual toggle via body class */
/* This overrides light mode even when system prefers light */
body.dark-mode,
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --card-bg: #1e293b;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-light: rgba(255, 255, 255, 0.1);

    /* Portfolio Theme - Dark Mode */
    --portfolio-primary: #818cf8;
    --portfolio-bg: rgba(129, 140, 248, 0.2);
    --portfolio-border: rgba(129, 140, 248, 0.3);

    /* CIS Theme - Dark Mode */
    --cis-primary: #34d399;
    --cis-bg: rgba(52, 211, 153, 0.2);
    --cis-border: rgba(52, 211, 153, 0.3);

    /* Semantic Colors - Dark Mode */
    --color-success-bg: rgba(34, 197, 94, 0.1);
    --color-warning-bg: rgba(245, 158, 11, 0.1);
    --color-danger-bg: rgba(239, 68, 68, 0.1);
    --color-info-bg: rgba(59, 130, 246, 0.1);

    /* Card Backgrounds - Dark Mode */
    --bg-card: var(--bg-secondary);
    --bg-card-hover: var(--bg-tertiary);

    /* Shadows - Dark Mode (deeper shadows) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
}
