/* ═══════════════════════════════════════════════════════════════════════════
   chainsaw-design-system.css
   Chainsaw Legends — Design Token System
   ═══════════════════════════════════════════════════════════════════════════

   BRAND INSPIRATION: Stihl chainsaws.
   • Orange (#F37A1F) — the heartbeat of the brand
   • Charcoal (#2A2A2A) — the steel body
   • Concrete (#E8E5E0) — sawdust, raw wood, workshop walls
   • White (#FFFFFF) — clean workspace, fresh cuts

   Every color, spacing unit, radius, and font choice channels the weight
   and precision of professional chainsaw equipment.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ─── BRAND COLORS ──────────────────────────────────────────────────── */
    --cl-stihl-orange: #F37A1F;
    --cl-orange: #F37A1F;
    --cl-orange-dark: #D4691A;
    --cl-orange-light: #FDEAD1;
    --cl-charcoal: #2A2A2A;
    --cl-charcoal-light: #3D3D3D;
    --cl-steel: #6B6B6B; /* Body text secondary */
    --cl-ash: #9A9A9A; /* Muted / disabled */
    --cl-slate: #4A4A4A; /* Body text primary */

    --cl-concrete: #E8E5E0; /* Borders, dividers, table rows */
    --cl-concrete-light: #F0EDE8; /* Hover backgrounds, subtle fills */

    --cl-white: #FFFFFF;
    --cl-bg: #FAFAF8; /* Page background — warm off-white */
    /* ─── SEMANTIC COLORS ───────────────────────────────────────────────── */
    --cl-success: #2D9D5E;
    --cl-success-light: #E6F5ED;
    --cl-warning: #E5A117;
    --cl-warning-light: #FFF7E0;
    --cl-danger: #D94343;
    --cl-danger-light: #FDE8E8;
    --cl-info: #3B82C4;
    --cl-info-light: #E8F1FA;
    /* ─── PRO / PREMIUM ─────────────────────────────────────────────────── */
    --cl-pro-gold: #C59B2C;
    --cl-pro-gold-light: #FBF3DE;
    /* ─── TYPOGRAPHY ────────────────────────────────────────────────────── */
    --cl-font-body: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    --cl-font-heading: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
    --cl-font-condensed: 'Roboto Condensed', sans-serif;
    --cl-font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --cl-text-xs: 0.75rem; /* 12px */
    --cl-text-sm: 0.875rem; /* 14px */
    --cl-text-base: 1rem; /* 16px */
    --cl-text-lg: 1.125rem; /* 18px */
    --cl-text-xl: 1.25rem; /* 20px */
    --cl-text-2xl: 1.5rem; /* 24px */
    --cl-text-3xl: 1.875rem; /* 30px */
    --cl-text-4xl: 2.25rem; /* 36px */
    /* ─── SPACING (4px base) ────────────────────────────────────────────── */
    --cl-space-1: 4px;
    --cl-space-2: 8px;
    --cl-space-3: 12px;
    --cl-space-4: 16px;
    --cl-space-5: 20px;
    --cl-space-6: 24px;
    --cl-space-8: 32px;
    --cl-space-10: 40px;
    --cl-space-12: 48px;
    --cl-space-16: 64px;
    /* ─── BORDERS & RADII ───────────────────────────────────────────────── */
    --cl-border: 1px solid #E8E5E0;
    --cl-border-color: #E8E5E0;
    --cl-radius-sm: 4px;
    --cl-radius: 6px;
    --cl-radius-md: 8px;
    --cl-radius-lg: 12px;
    /* ─── SHADOWS ───────────────────────────────────────────────────────── */
    --cl-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --cl-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --cl-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    /* ─── LAYOUT DIMENSIONS ─────────────────────────────────────────────── */
    --cl-sidebar-width: 260px;
    --cl-topbar-height: 56px;
    /* ─── Z-INDEX LAYERS ────────────────────────────────────────────────── */
    --cl-z-sidebar: 40;
    --cl-z-topbar: 30;
    --cl-z-overlay: 50;
    --cl-z-drawer: 60;
    --cl-z-modal: 70;
    --cl-z-toast: 80;
}

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


/* ═══════════════════════════════════════════════════════════════════════════
   BASE RESET & TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

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

body {
    margin: 0;
    font-family: var(--cl-font-body);
    font-size: var(--cl-text-base);
    color: var(--cl-slate);
    background: var(--cl-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--cl-font-heading);
    font-weight: 700;
    color: var(--cl-charcoal);
    line-height: 1.25;
    margin: 0 0 var(--cl-space-2);
}

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

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

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

h4 {
    font-size: var(--cl-text-lg);
}


/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

.text-xs {
    font-size: var(--cl-text-xs);
}

.text-sm {
    font-size: var(--cl-text-sm);
}

.text-lg {
    font-size: var(--cl-text-lg);
}

.text-steel {
    color: var(--cl-steel);
}

.text-ash {
    color: var(--cl-ash);
}

.mono {
    font-family: var(--cl-font-mono);
}

.label {
    font-size: var(--cl-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--cl-steel);
}

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

/* ─── FLEX / GRID HELPERS ───────────────────────────────────────────────── */

.cl-flex {
    display: flex;
}

.cl-flex-col {
    display: flex;
    flex-direction: column;
}

.cl-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cl-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cl-gap-1 {
    gap: var(--cl-space-1);
}

.cl-gap-2 {
    gap: var(--cl-space-2);
}

.cl-gap-3 {
    gap: var(--cl-space-3);
}

.cl-gap-4 {
    gap: var(--cl-space-4);
}

.cl-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--cl-space-4);
}

.cl-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--cl-space-4);
}

.cl-grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--cl-space-4);
}

@media (max-width: 1024px) {
    .cl-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cl-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .cl-grid-4 {
        grid-template-columns: 1fr;
    }

    .cl-grid-3 {
        grid-template-columns: 1fr;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-card {
    background: var(--cl-white);
    border: var(--cl-border);
    border-radius: var(--cl-radius-md);
    padding: var(--cl-space-5);
    box-shadow: var(--cl-shadow-sm);
}

.cl-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--cl-space-4);
}

.cl-card-header-title {
    font-family: var(--cl-font-heading);
    font-size: var(--cl-text-lg);
    font-weight: 700;
    color: var(--cl-charcoal);
}


/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   Stihl-orange primary, charcoal secondary, ghost for tertiary.
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cl-space-2);
    padding: var(--cl-space-2) var(--cl-space-4);
    font-family: var(--cl-font-heading);
    font-weight: 600;
    font-size: var(--cl-text-sm);
    border-radius: var(--cl-radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--cl-duration-fast, 180ms) var(--cl-ease-settle), border-color var(--cl-duration-fast, 180ms) var(--cl-ease-settle), transform var(--cl-duration-fast, 180ms) var(--cl-ease-settle), box-shadow var(--cl-duration-fast, 180ms) var(--cl-ease-settle);
    line-height: 1.4;
}

    .cl-btn:active {
        transform: translateY(1px);
        transition-duration: 60ms;
    }

.cl-btn-primary {
    background: var(--cl-stihl-orange);
    color: var(--cl-white);
}

    .cl-btn-primary:hover {
        background: var(--cl-orange-dark);
        box-shadow: 0 2px 8px rgba(243, 122, 31, 0.25);
    }

.cl-btn-secondary {
    background: var(--cl-charcoal);
    color: var(--cl-white);
}

    .cl-btn-secondary:hover {
        background: var(--cl-charcoal-light);
    }

.cl-btn-ghost {
    background: transparent;
    color: var(--cl-slate);
    border-color: var(--cl-concrete);
}

    .cl-btn-ghost:hover {
        background: var(--cl-concrete-light);
        border-color: var(--cl-steel);
    }

.cl-btn-danger {
    background: var(--cl-danger);
    color: var(--cl-white);
}

    .cl-btn-danger:hover {
        background: #C23838;
    }

.cl-btn-sm {
    padding: var(--cl-space-1) var(--cl-space-3);
    font-size: var(--cl-text-xs);
}

.cl-btn-icon {
    padding: var(--cl-space-2);
}

.cl-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--cl-space-2);
    font-size: var(--cl-text-xs);
    font-weight: 600;
    font-family: var(--cl-font-heading);
    border-radius: 100px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.cl-badge-orange {
    background: var(--cl-orange-light);
    color: var(--cl-orange-dark);
}

.cl-badge-success {
    background: var(--cl-success-light);
    color: var(--cl-success);
}

.cl-badge-warning {
    background: var(--cl-warning-light);
    color: #9A7212;
}

.cl-badge-danger {
    background: var(--cl-danger-light);
    color: var(--cl-danger);
}

.cl-badge-info {
    background: var(--cl-info-light);
    color: var(--cl-info);
}

.cl-badge-steel {
    background: var(--cl-concrete);
    color: var(--cl-steel);
}

.cl-badge-pro {
    background: var(--cl-pro-gold-light);
    color: var(--cl-pro-gold);
}


/* ═══════════════════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--cl-space-1);
}

.cl-input-label {
    font-size: var(--cl-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cl-steel);
}

.cl-input,
.cl-input select {
    padding: var(--cl-space-2) var(--cl-space-3);
    font-family: var(--cl-font-body);
    font-size: var(--cl-text-sm);
    color: var(--cl-charcoal);
    background: var(--cl-white);
    border: var(--cl-border);
    border-radius: var(--cl-radius);
    outline: none;
    transition: border-color var(--cl-duration-fast) var(--cl-ease-settle), box-shadow var(--cl-duration-fast) var(--cl-ease-settle);
    width: 100%;
}

    .cl-input:focus {
        border-color: var(--cl-stihl-orange);
        box-shadow: 0 0 0 3px rgba(243, 122, 31, 0.12);
    }


/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-table-wrap {
    overflow-x: auto;
}

.cl-table {
    width: 100%;
    border-collapse: collapse;
}

    .cl-table th {
        text-align: left;
        padding: var(--cl-space-3) var(--cl-space-4);
        font-family: var(--cl-font-heading);
        font-size: var(--cl-text-xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--cl-steel);
        border-bottom: 2px solid var(--cl-concrete);
    }

    .cl-table td {
        padding: var(--cl-space-3) var(--cl-space-4);
        font-size: var(--cl-text-sm);
        border-bottom: 1px solid var(--cl-concrete-light);
        vertical-align: middle;
    }

    .cl-table tr {
        transition: background var(--cl-duration-fast) var(--cl-ease-settle);
    }

    .cl-table tbody tr:hover {
        background: var(--cl-concrete-light);
    }

.cl-table-empty {
    text-align: center;
    padding: var(--cl-space-12) var(--cl-space-4);
    color: var(--cl-steel);
}


/* ═══════════════════════════════════════════════════════════════════════════
   AVATARS
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cl-concrete);
    color: var(--cl-steel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cl-font-heading);
    font-weight: 700;
    font-size: var(--cl-text-sm);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

    .cl-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.cl-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.cl-avatar-lg {
    width: 52px;
    height: 52px;
    font-size: var(--cl-text-lg);
}


/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-alert {
    padding: var(--cl-space-3) var(--cl-space-4);
    border-radius: var(--cl-radius);
    font-size: var(--cl-text-sm);
    font-weight: 500;
    margin-bottom: var(--cl-space-4);
}

.cl-alert-success {
    background: var(--cl-success-light);
    color: var(--cl-success);
    border: 1px solid var(--cl-success);
}

.cl-alert-danger {
    background: var(--cl-danger-light);
    color: var(--cl-danger);
    border: 1px solid var(--cl-danger);
}

.cl-alert-warning {
    background: var(--cl-warning-light);
    color: #9A7212;
    border: 1px solid var(--cl-warning);
}

.cl-alert-info {
    background: var(--cl-info-light);
    color: var(--cl-info);
    border: 1px solid var(--cl-info);
}


/* ═══════════════════════════════════════════════════════════════════════════
   DIVIDERS
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-divider {
    border: none;
    border-top: 1px solid var(--cl-concrete);
    margin: var(--cl-space-4) 0;
}


/* ═══════════════════════════════════════════════════════════════════════════
   SPINNERS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes cl-spin {
    to {
        transform: rotate(360deg);
    }
}

.cl-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--cl-concrete);
    border-top-color: var(--cl-stihl-orange);
    border-radius: 50%;
    animation: cl-spin 800ms linear infinite;
}

.cl-spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.cl-spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 4px;
}

.cl-spinner-md {
    width: 24px;
    height: 24px;
    border-width: 3px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   TOAST HOST
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-toast-host {
    position: fixed;
    top: var(--cl-space-4);
    right: var(--cl-space-4);
    z-index: var(--cl-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--cl-space-2);
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.cl-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--cl-space-3);
    padding: var(--cl-space-3) var(--cl-space-4);
    border-radius: var(--cl-radius-md);
    background: var(--cl-white);
    border: var(--cl-border);
    box-shadow: var(--cl-shadow-lg);
    font-size: var(--cl-text-sm);
    color: var(--cl-charcoal);
    pointer-events: auto;
}

.cl-toast-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.cl-toast-success .cl-toast-icon {
    color: var(--cl-success);
}

.cl-toast-danger .cl-toast-icon {
    color: var(--cl-danger);
}

.cl-toast-warning .cl-toast-icon {
    color: var(--cl-warning);
}

.cl-toast-default .cl-toast-icon {
    color: var(--cl-steel);
}

.cl-toast-info .cl-toast-icon {
    color: var(--cl-info);
}


/* ═══════════════════════════════════════════════════════════════════════════
   TOGGLE INPUT (Admin)
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-toggle-row {
    padding: var(--cl-space-2) 0;
    border-bottom: 1px solid var(--cl-concrete-light);
}

    .cl-toggle-row:last-child {
        border-bottom: none;
    }

.cl-toggle-input {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--cl-concrete);
    position: relative;
    cursor: pointer;
    transition: background var(--cl-duration-fast) var(--cl-ease-settle);
    flex-shrink: 0;
}

    .cl-toggle-input::after {
        content: '';
        position: absolute;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--cl-white);
        top: 2px;
        left: 2px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
        transition: transform var(--cl-duration-fast) var(--cl-ease-settle);
    }

    .cl-toggle-input:checked {
        background: var(--cl-stihl-orange);
    }

        .cl-toggle-input:checked::after {
            transform: translateX(18px);
        }


/* ═══════════════════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-pagination {
    display: flex;
    gap: var(--cl-space-2);
}

.cl-page-btn {
    padding: var(--cl-space-1) var(--cl-space-3);
    font-family: var(--cl-font-heading);
    font-size: var(--cl-text-xs);
    font-weight: 600;
    background: transparent;
    border: var(--cl-border);
    border-radius: var(--cl-radius);
    color: var(--cl-slate);
    cursor: pointer;
    transition: background var(--cl-duration-fast) var(--cl-ease-settle), color var(--cl-duration-fast) var(--cl-ease-settle);
}

    .cl-page-btn:hover:not(:disabled) {
        background: var(--cl-concrete-light);
        color: var(--cl-stihl-orange);
    }

    .cl-page-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }


/* ═══════════════════════════════════════════════════════════════════════════
   NAV LINKS
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--cl-space-3) var(--cl-space-3);
}

.cl-nav-section {
    margin-bottom: var(--cl-space-4);
}

.cl-nav-section-label {
    font-family: var(--cl-font-heading);
    font-size: var(--cl-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    padding: var(--cl-space-2) var(--cl-space-3);
}

.cl-nav-link {
    display: flex;
    align-items: center;
    gap: var(--cl-space-3);
    padding: var(--cl-space-2) var(--cl-space-3);
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: var(--cl-text-sm);
    font-weight: 500;
    border-radius: var(--cl-radius);
    transition: background var(--cl-duration-fast) var(--cl-ease-settle), color var(--cl-duration-fast) var(--cl-ease-settle);
    position: relative;
}

    .cl-nav-link:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--cl-white);
    }

    .cl-nav-link.active {
        background: rgba(243, 122, 31, 0.15);
        color: var(--cl-stihl-orange);
    }

        .cl-nav-link.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 4px;
            bottom: 4px;
            width: 3px;
            border-radius: 0 3px 3px 0;
            background: var(--cl-stihl-orange);
        }

.cl-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════════════════
   DIALOG / MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.cl-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--cl-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.cl-dialog {
    background: var(--cl-white);
    border-radius: var(--cl-radius-lg);
    box-shadow: var(--cl-shadow-lg);
    padding: var(--cl-space-6);
    max-width: 480px;
    width: 90%;
    z-index: calc(var(--cl-z-modal) + 1);
}

/* ═══════════════════════════════════════════════════════════════════════
   Add these to your global stylesheet (the one defining .cl-nav-link,
   .cl-topbar, etc). They style the moderation-queue badge in the sidebar
   nav and the notification bell in the topbar.
   ═══════════════════════════════════════════════════════════════════════ */

/* Count badge on the sidebar "Spot Queue" nav link */
.cl-nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--cl-stihl-orange);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-family: var(--cl-font-heading);
}

/* Topbar notification bell button */
.cl-topbar-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--cl-charcoal);
    cursor: pointer;
    transition: background 150ms ease;
}

    .cl-topbar-bell:hover {
        background: rgba(0, 0, 0, 0.06);
    }

.cl-topbar-bell-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--cl-stihl-orange);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-family: var(--cl-font-heading);
}
