/* css/main.css - Core Design System & Global Styles for Nodaar Web Portal */

/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   CSS CUSTOM PROPERTIES (EXTENDING TOKENS)
   ========================================================================== */
:root {
    /* Brand accents & tints */
    --color-primary-glow: rgba(255, 136, 0, 0.25);
    --color-primary-subtle: rgba(255, 136, 0, 0.12);
    --color-primary-border: rgba(255, 136, 0, 0.3);

    /* Functional Surface Colors (Light Mode) */
    --surface-bg: #F4F6F9;
    --surface-card: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --surface-sidebar: #FFFFFF;
    --surface-header: #FFFFFF;
    --surface-hover: #F8FAFC;
    --surface-active: #F1F5F9;
    --surface-overlay: rgba(7, 12, 27, 0.6);

    /* Functional Borders */
    --border-default: #E2E8F0;
    --border-light: #EDF2F7;
    --border-medium: #CBD5E1;
    --border-strong: #94A3B8;

    /* Text Colors */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;
    --text-accent: #FF8800;

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-dropdown: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);

    /* Dimensions */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 68px;
    --topbar-height: 64px;
    --bottom-nav-height: 64px;
    --page-max-width: 1360px;

    /* Transitions */
    --trans-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --trans-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --trans-bounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   DARK MODE OVERRIDES (data-theme="dark" & .dark-mode)
   Base: #070C1B, Cards: #0D1320
   ========================================================================== */
html[data-theme="dark"],
.dark-mode {
    --surface-bg: #070C1B;
    --surface-card: #0D1320;
    --surface-elevated: #141A29;
    --surface-sidebar: #090E1D;
    --surface-header: #0D1320;
    --surface-hover: rgba(255, 255, 255, 0.04);
    --surface-active: rgba(255, 255, 255, 0.08);
    --surface-overlay: rgba(3, 6, 15, 0.75);

    --border-default: #1B2234;
    --border-light: #161D2D;
    --border-medium: #27314A;
    --border-strong: #3D4A68;

    --text-primary: #F3F4F6;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --text-inverse: #070C1B;
    --text-accent: #FF8800;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.35);

    color-scheme: dark;
}

/* Base Body Styles */
body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--surface-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--trans-normal), color var(--trans-normal);
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

small {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.mono {
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

.currency {
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInSimple {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.animate-fade-in {
    animation: fadeIn var(--trans-normal) forwards ease-out;
}

.animate-slide-up {
    animation: slideUp var(--trans-normal) forwards ease-out;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   SKELETON LOADING
   ========================================================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-hover) 25%,
        var(--surface-active) 37%,
        var(--surface-hover) 63%
    );
    background-size: 400% 100%;
    animation: shimmer 1.6s ease infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 8px;
    border-radius: var(--radius-xs);
}

.skeleton-title {
    height: 22px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    height: 140px;
    width: 100%;
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   SCROLLBAR STYLES
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ==========================================================================
   LAYOUT & UTILITY CLASSES
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Flex utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Grid utilities */
.grid {
    display: grid;
    gap: 1.25rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* Responsive Grid Breakpoints */
@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sm\:flex-row { flex-direction: row; }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

/* Text alignment & helpers */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--color-primary-500); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Visibility */
.hidden { display: none !important; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Divider */
.divider {
    height: 1px;
    background-color: var(--border-default);
    width: 100%;
    margin: 1rem 0;
}
