/**
 * CNPERP Design System v1.0
 * Unified color, typography, and component styling
 */

:root {
    /* ============================================ */
    /* COLOR PALETTE */
    /* ============================================ */

    /* Primary Colors */
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --primary-light: #6ea8fe;
    --primary-lighter: #cfe2ff;

    /* Secondary Colors */
    --secondary: #6c757d;
    --secondary-dark: #5c636a;
    --secondary-light: #adb5bd;
    --secondary-lighter: #e2e3e5;

    /* Success Colors */
    --success: #198754;
    --success-dark: #157347;
    --success-light: #75b798;
    --success-lighter: #d1e7dd;

    /* Warning Colors */
    --warning: #ffc107;
    --warning-dark: #ffb906;
    --warning-light: #ffeeba;
    --warning-lighter: #fff3cd;

    /* Danger Colors */
    --danger: #dc3545;
    --danger-dark: #bd2130;
    --danger-light: #f8d7da;
    --danger-lighter: #f8d7da;

    /* Info Colors */
    --info: #0dcaf0;
    --info-dark: #0ba5e0;
    --info-light: #6edff6;
    --info-lighter: #cff4fc;

    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* ============================================ */
    /* SEMANTIC COLORS */
    /* ============================================ */

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f3f7;
    --bg-inverse: #1f2937;

    /* Text */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-tertiary: #adb5bd;
    --text-inverse: #ffffff;

    /* Borders */
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --border-dark: #adb5bd;

    /* ============================================ */
    /* TYPOGRAPHY */
    /* ============================================ */

    /* Font Families */
    --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Monaco', 'Courier New', Courier, monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    /* 12px */
    --text-sm: 0.875rem;
    /* 14px */
    --text-base: 1rem;
    /* 16px */
    --text-lg: 1.125rem;
    /* 18px */
    --text-xl: 1.25rem;
    /* 20px */
    --text-2xl: 1.5rem;
    /* 24px */
    --text-3xl: 1.875rem;
    /* 30px */
    --text-4xl: 2.25rem;
    /* 36px */
    --text-5xl: 3rem;
    /* 48px */

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;

    /* Letter Spacing */
    --letter-tight: -0.02em;
    --letter-normal: 0;
    --letter-wide: 0.02em;

    /* ============================================ */
    /* SPACING */
    /* ============================================ */

    --space-0: 0;
    --space-1: 0.25rem;
    /* 4px */
    --space-2: 0.5rem;
    /* 8px */
    --space-3: 0.75rem;
    /* 12px */
    --space-4: 1rem;
    /* 16px */
    --space-5: 1.25rem;
    /* 20px */
    --space-6: 1.5rem;
    /* 24px */
    --space-7: 1.75rem;
    /* 28px */
    --space-8: 2rem;
    /* 32px */
    --space-10: 2.5rem;
    /* 40px */
    --space-12: 3rem;
    /* 48px */
    --space-16: 4rem;
    /* 64px */
    --space-20: 5rem;
    /* 80px */

    /* ============================================ */
    /* BORDER RADIUS */
    /* ============================================ */

    --radius-none: 0;
    --radius-sm: 0.25rem;
    /* 4px */
    --radius-base: 0.5rem;
    /* 8px */
    --radius-md: 0.75rem;
    /* 12px */
    --radius-lg: 1rem;
    /* 16px */
    --radius-xl: 1.5rem;
    /* 24px */
    --radius-2xl: 2rem;
    /* 32px */
    --radius-full: 9999px;

    /* ============================================ */
    /* SHADOWS */
    /* ============================================ */

    /* Subtle shadow for cards and containers */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

    /* Default shadow for elevated elements */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);

    /* Medium shadow for dropdowns and popovers */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* Large shadow for modals */
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Extra large shadow for floating elements */
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Inner shadow */
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

    /* ============================================ */
    /* TRANSITIONS */
    /* ============================================ */

    --duration-fast: 150ms;
    --duration-base: 300ms;
    --duration-slow: 500ms;

    --timing-ease: ease;
    --timing-ease-in: ease-in;
    --timing-ease-out: ease-out;
    --timing-ease-in-out: ease-in-out;
    --timing-linear: linear;
    --timing-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    /* ============================================ */
    /* Z-INDEX */
    /* ============================================ */

    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* ============================================ */
    /* BREAKPOINTS */
    /* ============================================ */

    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;
}

/* ============================================ */
/* DARK MODE OVERRIDES */
/* ============================================ */

[data-theme="dark"],
body.dark-mode {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #0f172a;

    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;

    --border-color: #374151;
    --border-light: #4b5563;
    --border-dark: #6b7280;
}

/* ============================================ */
/* GLOBAL STYLES */
/* ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-base);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: background-color var(--duration-base) var(--timing-smooth),
        color var(--duration-base) var(--timing-smooth);
}

/* ============================================ */
/* TYPOGRAPHY */
/* ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    letter-spacing: var(--letter-tight);
    margin: var(--space-0);
}

h1 {
    font-size: var(--text-5xl);
}

h2 {
    font-size: var(--text-4xl);
}

h3 {
    font-size: var(--text-3xl);
}

h4 {
    font-size: var(--text-2xl);
}

h5 {
    font-size: var(--text-xl);
}

h6 {
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
}

p {
    margin: var(--space-0);
    line-height: var(--leading-relaxed);
}

code {
    font-family: var(--font-mono);
    background-color: var(--bg-tertiary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

pre {
    background-color: var(--bg-inverse);
    color: var(--text-inverse);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

/* ============================================ */
/* UTILITY CLASSES */
/* ============================================ */

/* Display utilities */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.invisible {
    visibility: hidden !important;
}

/* Visibility utilities */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Opacity utilities */
.opacity-0 {
    opacity: 0;
}

.opacity-25 {
    opacity: 0.25;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-75 {
    opacity: 0.75;
}

.opacity-100 {
    opacity: 1;
}

/* ============================================ */
/* FOCUS STYLES */
/* ============================================ */

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================ */
/* SCROLLBAR STYLING */
/* ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ============================================ */
/* SELECTION */
/* ============================================ */

::selection {
    background-color: var(--primary);
    color: var(--text-inverse);
}

/* ============================================ */
/* RESPONSIVE UTILITIES */
/* ============================================ */

@media (max-width: 575.98px) {
    .d-sm-none {
        display: none !important;
    }
}

@media (min-width: 576px) {
    .d-sm-block {
        display: block !important;
    }
}

@media (min-width: 768px) {
    .d-md-block {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .d-lg-block {
        display: block !important;
    }
}

@media (min-width: 1200px) {
    .d-xl-block {
        display: block !important;
    }
}

/* ============================================ */
/* PRINT STYLES */
/* ============================================ */

@media print {
    body {
        background-color: var(--white);
        color: var(--black);
    }

    a {
        text-decoration: underline;
    }

    .no-print {
        display: none !important;
    }
}
