/* ═══════════════════════════════════════════════════
   NBR Platform — Global Design System
   Theme: Corporate Slate & Amber
   Aesthetic: Executive ERP — structured, dense, trustworthy
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* ─── Core Palette ─── */
    --slate-950: #0c1018;
    --slate-900: #111827;
    --slate-800: #1a2234;
    --slate-700: #243044;
    --slate-600: #334155;
    --slate-500: #475569;
    --slate-400: #7c8ba1;
    --slate-300: #a8b5c8;
    --slate-200: #c8d1df;
    --slate-100: #e8ecf1;
    --slate-50:  #f3f5f8;

    /* ─── Accent: Amber/Gold — authority, warmth ─── */
    --amber-500: #d97706;
    --amber-400: #f59e0b;
    --amber-300: #fbbf24;
    --amber-200: #fde68a;
    --amber-glow: rgba(245, 158, 11, 0.15);

    /* ─── Semantic Colors ─── */
    --success: #059669;
    --success-soft: rgba(5, 150, 105, 0.1);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.1);
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --info: #2563eb;
    --info-soft: rgba(37, 99, 235, 0.1);

    /* ─── Surfaces ─── */
    --bg-app: var(--slate-50);
    --bg-sidebar: var(--slate-900);
    --bg-card: #ffffff;
    --bg-card-alt: var(--slate-50);
    --bg-inset: white;

    /* ─── Typography ─── */
    --font-ui: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-tertiary: var(--slate-400);
    --text-inverse: #ffffff;

    /* ─── Borders ─── */
    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-sidebar: rgba(255, 255, 255, 0.06);

    /* ─── Shadows ─── */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    /* ─── Sidebar Variables (used by scoped CSS) ─── */
    --sb-text-primary: #f1f5f9;
    --sb-text-secondary: #94a3b8;
    --sb-text-dim: #64748b;
    --sb-hover-bg: rgba(255, 255, 255, 0.05);
    --sb-active-bg: rgba(245, 158, 11, 0.12);
    --sb-divider: rgba(255, 255, 255, 0.06);
    --sb-accent: var(--amber-400);
    --sb-glass-border: rgba(255, 255, 255, 0.06);
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 0;
    color: var(--text-primary);
}

a { color: var(--amber-500); text-decoration: none; }
a:hover { color: var(--amber-400); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* Dark scrollbar for sidebar */
.sidebar ::-webkit-scrollbar-thumb { background: var(--slate-600); }
.sidebar ::-webkit-scrollbar-thumb:hover { background: var(--slate-500); }

/* ─── Typography Utils ─── */
.text-primary-accent { color: var(--amber-500); }
.text-muted { color: var(--text-secondary) !important; }
.text-dim { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }

/* ─── Card System ─── */
.card-premium {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}
.card-premium:hover {
    box-shadow: var(--shadow-md);
}

/* ─── Buttons ─── */
.btn-primary-erp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--amber-500);
    color: #fff;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.01em;
}
.btn-primary-erp:hover {
    background: var(--amber-400);
    box-shadow: 0 2px 8px var(--amber-glow);
}

.btn-emerald {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--amber-500);
    color: #fff;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-emerald:hover {
    background: var(--amber-400);
    box-shadow: 0 2px 8px var(--amber-glow);
}

.btn-primary-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #FF5F6D 0%, #FFC371 100%) !important;
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-solid:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
    color: white !important;
}

.btn-primary-solid:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Badge ─── */
.badge { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.03em; }
.bg-success { background-color: var(--success) !important; }

/* ─── Table ─── */
.table { color: var(--text-primary); }
.table th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); }

/* ─── Layout Foundations ─── (overridden by scoped CSS, but kept as fallback) */
.page {
    display: flex;
    height: 100vh;
    width: 100vw;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
    overflow: auto;
}

/* ─── Loading ─── */
.loading-progress { display: none !important; }

/* ─── Global Modern Alert (window.alert override) ─── */
.custom-alert-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: alertFadeIn 0.3s ease-out;
}

.custom-alert-card {
    background: #ffffff;
    width: 95%;
    max-width: 400px;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: alertZoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.alert-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    font-size: 1.75rem;
}

.alert-icon-wrapper.success { background: #ecfdf5; color: #10b981; }
.alert-icon-wrapper.error { background: #fef2f2; color: #ff4757; }
.alert-icon-wrapper.info { background: #eff6ff; color: #3b82f6; }

.alert-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.alert-message {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.alert-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(90deg, #FF5F6D 0%, #FFC371 100%);
    color: white;
}

.alert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 95, 109, 0.3);
}

@keyframes alertFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes alertZoomIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* ─── Global Pagination System ─── */
.management-container .pagination-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.management-container .pagination-btn {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px !important;
    background: var(--accent-gradient, linear-gradient(90deg, #FF5F6D 0%, #FFC371 100%)) !important;
    color: white !important;
    border: none !important;
    transition: all 0.2s;
    cursor: pointer;
}

.management-container .pagination-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
    filter: brightness(1.1);
}

.management-container .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .management-container .pagination-layout {
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        gap: 0.25rem !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    .management-container .pagination-layout > div {
        flex-shrink: 1 !important;
        gap: 0.15rem !important;
    }

    .management-container .pagination-layout select.form-select-sm {
        padding: 0 1.25rem 0 0.5rem !important;
        font-size: 0.75rem !important;
        width: 55px !important;
        height: 24px !important;
        background-position: right 0.25rem center !important;
        background-size: 10px !important;
        border-radius: 6px !important;
    }

    .management-container .pagination-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.7rem !important;
        border-radius: 6px !important;
    }

    .management-container .pagination-layout input[type="number"] {
        width: 35px !important;
        height: 24px !important;
        padding: 0.1rem !important;
        font-size: 0.75rem !important;
        border-radius: 6px !important;
    }

    .management-container .pagination-layout .small.text-muted {
        font-size: 0.65rem !important;
        white-space: nowrap !important;
    }

    .management-container .pagination-layout .px-2 {
        padding-left: 0.15rem !important;
        padding-right: 0.15rem !important;
    }
}
