/* Custom CSS for IGNIFY Administration */

/* ============================================================================
 * Phase 4.5 Slice D.4 — Visual system tokens
 * ============================================================================
 *
 * Design tokens for the admin UI. New surfaces should consume these via
 * `var(--token-name)` instead of hardcoded values. Existing rules below
 * use hardcoded values; they continue to work and migrate opportunistically
 * to tokens as they're touched.
 *
 * Vocabulary
 * ----------
 *   --color-*        Raw palette swatches (warm teal primary + warm-stone
 *                    neutrals). Use the SEMANTIC tokens (--surface-*,
 *                    --text-*, --border-*) in component code; reach into
 *                    raw palette only when a semantic doesn't fit.
 *
 *   --surface-*      Background fills for distinct UI layers (page, card,
 *                    inset). Layered light-to-dark when multiple stack.
 *
 *   --text-*         Foreground colors for text. `default` for body copy,
 *                    `muted` for secondary, `inverse` for dark surfaces.
 *
 *   --border-*       Hairline + emphasis borders. `default` for cards;
 *                    `strong` for active/focus states.
 *
 *   --status-*       Semantic intent colors (success, warning, danger,
 *                    info) — applied to badges, alerts, status pills.
 *
 *   --font-*         Family stacks + weight scale. Inter is the primary
 *                    face; system fallback chain is comprehensive so the
 *                    UI remains crisp before Inter loads.
 *
 *   --space-*        4px base scale (0.5x, 1x, 2x, 3x, 4x, 6x, 8x, 12x).
 *                    Use these for padding/margin/gap; never inline px.
 *
 *   --radius-*       Border-radius scale: sm (cards), md (buttons),
 *                    lg (dialogs), pill (badges, chips).
 *
 *   --shadow-*       Elevation: e1 (resting card), e2 (hover/active),
 *                    e3 (popover), e4 (dialog overlay).
 *
 *   --transition-*   Animation primitives: `fast` (focus ring, hover),
 *                    `base` (content fades), `slow` (drawer slide).
 *
 * Naming convention: every token is BCP-style kebab-case; semantic
 * tokens come BEFORE raw palette references in the file so the
 * cascade resolution path is visible at a glance.
 * ============================================================================ */
:root {
    /* ── Raw palette ─ warm teal primary ───────────────────────────────── */
    --color-teal-50:  #ECFDFB;
    --color-teal-100: #CFFAF6;
    --color-teal-200: #A0F1EA;
    --color-teal-300: #65E1D8;
    --color-teal-400: #2BC9BD;
    --color-teal-500: #0EA5A2;   /* primary */
    --color-teal-600: #0B8482;
    --color-teal-700: #0A6B6A;
    --color-teal-800: #0D5454;
    --color-teal-900: #103F3F;

    /* ── Raw palette ─ warm-stone neutrals (NOT slate) ─────────────────── */
    --color-stone-50:  #FAFAF7;
    --color-stone-100: #F4F2EC;
    --color-stone-200: #E8E5DC;
    --color-stone-300: #D5D0C2;
    --color-stone-400: #B0A99A;
    --color-stone-500: #8A8473;
    --color-stone-600: #6B6657;
    --color-stone-700: #4F4B40;
    --color-stone-800: #34322B;
    --color-stone-900: #1F1E1A;

    /* ── Status / intent palette ───────────────────────────────────────── */
    --color-success-bg:    #E6F9EC;
    --color-success-fg:    #0F7A38;
    --color-warning-bg:    #FFF3D6;
    --color-warning-fg:    #8A5A00;
    --color-danger-bg:     #FCE4E4;
    --color-danger-fg:     #A12222;
    --color-info-bg:       #E6F1FB;
    --color-info-fg:       #105A99;

    /* ── Semantic surface ──────────────────────────────────────────────── */
    --surface-page:        var(--color-stone-50);
    --surface-card:        #FFFFFF;
    --surface-inset:       var(--color-stone-100);
    --surface-overlay:     rgba(31, 30, 26, 0.45);
    --surface-emphasis:    var(--color-teal-50);

    /* ── Semantic text ─────────────────────────────────────────────────── */
    --text-default:        var(--color-stone-800);
    --text-muted:          var(--color-stone-600);
    --text-subtle:         var(--color-stone-500);
    --text-inverse:        var(--color-stone-50);
    --text-link:           var(--color-teal-600);
    --text-link-hover:     var(--color-teal-700);
    --text-on-primary:     #FFFFFF;

    /* ── Semantic border ───────────────────────────────────────────────── */
    --border-default:      var(--color-stone-200);
    --border-strong:       var(--color-stone-300);
    --border-focus:        var(--color-teal-500);

    /* ── Semantic status (for badges, alerts, status pills) ────────────── */
    --status-success-bg:   var(--color-success-bg);
    --status-success-fg:   var(--color-success-fg);
    --status-warning-bg:   var(--color-warning-bg);
    --status-warning-fg:   var(--color-warning-fg);
    --status-danger-bg:    var(--color-danger-bg);
    --status-danger-fg:    var(--color-danger-fg);
    --status-info-bg:      var(--color-info-bg);
    --status-info-fg:      var(--color-info-fg);

    /* ── Typography ────────────────────────────────────────────────────── */
    /* Inter is the primary face. Fallback chain handles pre-load + system
     * defaults across macOS / Windows / Linux / iOS / Android so the UI
     * stays crisp before the webfont resolves. */
    --font-sans:           'Inter', -apple-system, BlinkMacSystemFont,
                           'Segoe UI', Roboto, 'Helvetica Neue', Arial,
                           sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
    --font-mono:           'JetBrains Mono', 'SF Mono', Menlo, Consolas,
                           'Liberation Mono', monospace;

    --font-size-xs:        12px;
    --font-size-sm:        13px;
    --font-size-base:      14px;
    --font-size-md:        15px;
    --font-size-lg:        17px;
    --font-size-xl:        20px;
    --font-size-2xl:       24px;
    --font-size-3xl:       30px;
    --font-size-4xl:       36px;

    --font-weight-regular: 400;
    --font-weight-medium:  500;
    --font-weight-semibold: 600;
    --font-weight-bold:    700;

    --line-height-tight:   1.25;
    --line-height-base:    1.5;
    --line-height-loose:   1.75;

    /* ── Spacing scale (4px base) ──────────────────────────────────────── */
    --space-0:             0;
    --space-px:            1px;
    --space-0_5:           2px;   /* 0.5x */
    --space-1:             4px;
    --space-2:             8px;
    --space-3:             12px;
    --space-4:             16px;
    --space-5:             20px;
    --space-6:             24px;
    --space-8:             32px;
    --space-10:            40px;
    --space-12:            48px;
    --space-16:            64px;
    --space-20:            80px;
    --space-24:            96px;

    /* ── Border radius ─────────────────────────────────────────────────── */
    --radius-none:         0;
    --radius-sm:           4px;   /* cards, inputs */
    --radius-md:           6px;   /* buttons */
    --radius-lg:           10px;  /* dialogs, sheets */
    --radius-xl:           16px;  /* hero panels */
    --radius-pill:         9999px; /* badges, chips */

    /* ── Shadows (elevation) ───────────────────────────────────────────── */
    --shadow-e1:           0 1px 2px rgba(31, 30, 26, 0.06),
                           0 1px 1px rgba(31, 30, 26, 0.04);
    --shadow-e2:           0 2px 6px rgba(31, 30, 26, 0.08),
                           0 1px 2px rgba(31, 30, 26, 0.04);
    --shadow-e3:           0 8px 16px rgba(31, 30, 26, 0.10),
                           0 2px 4px rgba(31, 30, 26, 0.06);
    --shadow-e4:           0 16px 32px rgba(31, 30, 26, 0.14),
                           0 4px 8px rgba(31, 30, 26, 0.08);
    --shadow-focus-ring:   0 0 0 3px rgba(14, 165, 162, 0.32);

    /* ── Transitions ───────────────────────────────────────────────────── */
    --transition-fast:     120ms cubic-bezier(0.4, 0.0, 0.2, 1);
    --transition-base:     200ms cubic-bezier(0.4, 0.0, 0.2, 1);
    --transition-slow:     300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ============================================================================
 * D.4 dogfood — refactor body + page surface to consume tokens.
 * Existing class rules below this block continue to use hardcoded values;
 * they're untouched so this slice ships zero risk to current screens.
 * Migrate them opportunistically as surfaces are touched.
 * ============================================================================ */

body {
    font-family: var(--font-sans);
    background: var(--surface-page);
    color: var(--text-default);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    overflow-x: hidden;
}

/* Layout Styles */
.nav-md .container.body {
    margin: 0;
    width: 100%;
}

.nav-md .main_container {
    position: relative;
    width: 100%;
}

.nav-md .main_container .left_col {
    width: 230px;
    height: 100vh;
    position: fixed;
    z-index: 9999;
    overflow-y: auto;
}

.nav-md .container.body .right_col {
    margin-left: 230px;
    width: calc(100% - 230px);
    padding: 20px;
    min-height: 100vh;
}

/* Responsive */
@media (max-width: 991px) {
    .nav-md .container.body .right_col {
        margin-left: 0;
        width: 100%;
    }
    
    .nav-md .main_container .left_col {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .nav-md .main_container .left_col.active {
        transform: translateX(0);
    }
}

/* Sidebar Styles */
.left_col {
    background: #013B69;
    color: white;
}

.left_col .scroll-view {
    height: 100%;
    padding-bottom: 60px;
}

/* Navigation Title */
.navbar.nav_title {
    background: white;
    border: 0;
    margin-bottom: 0;
    padding: 0;
    height: 65px;
    display: flex;
    align-items: center;
}

.navbar.nav_title a.site_title {
    color: #013B69 !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    width: 100%;
}

.navbar.nav_title a.site_title img {
    border-radius: 50%;
    margin-right: 10px;
}

/* Profile Section */
.profile {
    background: rgba(255, 255, 255, 0.1);
    margin: 0 15px 20px;
    padding: 15px;
    border-radius: 10px;
}

.profile_pic {
    float: left;
    margin-right: 15px;
}

.profile_img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid white;
}

.profile_info {
    overflow: hidden;
}

.profile_info span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.profile_info h2 {
    font-size: 16px;
    color: white;
    margin: 0;
    font-weight: 300;
}

/* Sidebar Menu */
.main_menu_side {
    padding: 0;
}

.side-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.side-menu > li > a {
    color: rgba(255, 255, 255, 0.9);
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.side-menu > li > a:hover,
.side-menu > li.active > a {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.side-menu > li > a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Child Menu */
.child_menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
    display: none;
}

.side-menu > li.active .child_menu {
    display: block;
}

.child_menu li a {
    color: rgba(255, 255, 255, 0.7);
    display: block;
    padding: 10px 15px 10px 45px;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.child_menu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Top Navigation */
.top_nav {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    width: calc(100% - 230px);
    height: 65px;
    margin-left: 230px;
}

@media (max-width: 991px) {
    .top_nav {
        width: 100%;
        margin-left: 0;
    }
}

.nav_menu {
    height: 65px;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.nav.toggle {
    display: flex;
    align-items: center;
}

#menu_toggle {
    color: #013B69;
    font-size: 18px;
    cursor: pointer;
    text-decoration: none;
}

/* Main Content */
.right_col {
    margin-top: 65px;
    padding-top: 20px;
}

/* Tiles */
.tile_count {
    margin-bottom: 30px;
}

.tile_stats_count {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.count_top {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    display: block;
    font-weight: 500;
}

.count {
    font-size: 32px;
    font-weight: bold;
    color: #013B69;
    line-height: 1;
}

/* Panels */
.x_panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.x_title {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.x_title h2 {
    margin: 0;
    font-size: 18px;
    color: #013B69;
    font-weight: 500;
}

.x_content {
    padding: 20px;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #013B69;
    color: #013B69;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
}

.table td {
    vertical-align: middle;
    font-size: 14px;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #013B69;
    border-color: #013B69;
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background: #218838;
    border-color: #218838;
    transform: translateY(-1px);
}

/* Forms */
.form-control {
    border-radius: 6px;
    border: 2px solid #e9ecef;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #013B69;
    box-shadow: 0 0 0 0.2rem rgba(1, 59, 105, 0.25);
}

/* Badge */
.badge {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 15px;
}

.badge-success {
    background: #28a745;
    color: white;
}

/* Footer */
footer {
    background: white;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    margin-top: 40px;
    color: #666;
    font-size: 13px;
}

/* Utilities */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.pull-right {
    float: right;
}

.text-muted {
    color: #6c757d;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 50px;
    color: #666;
}

.loading i {
    font-size: 24px;
    margin-right: 10px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
}

.error i {
    margin-right: 8px;
}

/* Page Title */
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.title_left h3 {
    margin: 0;
    color: #013B69;
    font-weight: 500;
}

.title_right {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .page-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .title_right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Notifications */
.notification {
    position: relative;
    margin-bottom: 15px;
    z-index: 1050;
}

.notification .btn-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
}

.notification .btn-close:hover {
    opacity: 1;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Navigation active states */
.side-menu > li.active > a {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.side-menu > li.active .fa-chevron-down {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

/* Mobile responsive improvements */
@media (max-width: 991px) {
    .left_col {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .left_col.active {
        transform: translateX(0);
    }
    
    .tile_stats_count {
        margin-bottom: 15px;
    }
    
    .x_panel {
        margin-bottom: 20px;
    }
    
    .profile_info h2 {
        font-size: 14px;
    }
    
    .side-menu > li > a {
        padding: 15px;
        font-size: 16px;
    }
}