/* ============================================================
   ScholarOne Design System
   Extracted from prototype codebase — single source of truth
   ============================================================
   
   USAGE:
     <link rel="stylesheet" href="design-system.css">
   
   This file contains ONLY reusable tokens and component classes.
   Shell layout (header, sidebar) lives in components/shell.css.
   Page-specific styles remain in each page's <style> block.
   ============================================================ */


/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */

:root {
    /* ---- Brand / Primary ---- */
    --primary:       #1966d2;
    --primary-dark:  #11508c;
    --primary-light: #e8f0fe;

    /* ---- Semantic ---- */
    --success:    #15803d;
    --success-bg: #f0fdf4;
    --warning:    #b45309;
    --warning-bg: #fffbeb;
    --error:      #b91c1c;
    --error-bg:   #fef2f2;
    --info:       #2563eb;
    --info-bg:    #eff6ff;

    /* ---- Gray Scale ---- */
    --gray-50:  #f8f9fa;
    --gray-100: #f0f1f3;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #1a1a2e;

    /* ---- Extended Palette (badges, article types) ---- */
    --purple:    #7c3aed;
    --purple-bg: #f3e8ff;
    --amber:     #b45309;
    --amber-bg:  #fef3c7;
    --blue-dark: #1d4ed8;
    --blue-bg:   #dbeafe;

    /* ---- Layout ---- */
    --sidebar-bg:     #1a1a1a;
    --header-height:  60px;
    --sidebar-width:  72px;

    /* ---- Shadows ---- */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg:  0 10px 40px rgba(0,0,0,0.15);
    --shadow-xl:  0 10px 40px rgba(0,0,0,0.3);

    /* ---- Radius ---- */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-pill: 9999px;

    /* ---- Transitions ---- */
    --transition-fast: 0.15s ease;
    --transition-med:  0.2s ease;
    --transition-slow: 0.25s ease;

    /* ---- Typography ---- */
    --font-sans:  'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:  'Roboto Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;

    /* ---- Z-Index Scale ---- */
    --z-base:    1;
    --z-flyout:  800;
    --z-overlay: 850;
    --z-sidebar: 900;
    --z-header:  1000;
    --z-tooltip: 1001;
    --z-modal:   1500;
    --z-toast:   2000;
}


/* ============================================================
   2. STATUS BADGES
   Used in: all-manuscripts, index (queue), decisions
   ============================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge .material-symbols-outlined { font-size: 14px; }

.status-badge.urgent  { background: var(--error-bg);   color: var(--error); }
.status-badge.warning { background: var(--warning-bg); color: var(--warning); }
.status-badge.info    { background: var(--info-bg);    color: var(--info); }
.status-badge.success { background: var(--success-bg); color: var(--success); }


/* ============================================================
   3. ARTICLE TYPE BADGES
   Used in: index (queue rows), manuscript-detail
   ============================================================ */

.article-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.article-type-badge.special-issue     { background: var(--purple-bg); color: var(--purple); }
.article-type-badge.clinical-trial    { background: var(--amber-bg);  color: var(--amber); }
.article-type-badge.review-article    { background: var(--blue-bg);   color: var(--blue-dark); }
.article-type-badge.original-research { background: var(--gray-100);  color: var(--gray-600); }


/* ============================================================
   4. MATCH / LOAD / ACCEPTANCE BADGES
   Used in: invite-reviewers (table + grid), AI chat
   ============================================================ */

.match-badge {
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
}

.match-badge.high   { background: var(--success-bg); color: var(--success); }
.match-badge.medium { background: var(--warning-bg); color: var(--warning); }
.match-badge.low    { background: var(--gray-100);   color: var(--gray-600); }

.load-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
}

.load-indicator.light  { background: var(--success-bg); color: var(--success); }
.load-indicator.medium { background: var(--warning-bg); color: var(--warning); }
.load-indicator.heavy  { background: var(--error-bg);   color: var(--error); }


/* ============================================================
   5. EDITORIAL BOARD BADGE
   Used in: invite-reviewers (table rows + grid cards)
   ============================================================ */

.editorial-board-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--blue-bg);
    color: var(--blue-dark);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.editorial-board-badge .material-symbols-outlined { font-size: 12px; }


/* ============================================================
   6. KEYWORD TAGS
   Used in: invite-reviewers (table rows, flyout, grid cards)
   ============================================================ */

.keyword-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--info-bg);
    color: var(--primary);
    border-radius: var(--radius-sm);
}

.flyout-keyword {
    font-size: 13px;
    padding: 6px 12px;
    background: var(--info-bg);
    color: var(--primary);
    border-radius: 6px;
}


/* ============================================================
   7. VALUE INDICATORS (turnaround, acceptance, last review)
   Used in: invite-reviewers table columns
   ============================================================ */

.turnaround-value        { font-size: 13px; color: var(--gray-600); }
.turnaround-value.fast   { color: var(--success); }
.turnaround-value.slow   { color: var(--error); }

.acceptance-value        { font-size: 13px; }
.acceptance-value.high   { color: var(--success); }
.acceptance-value.medium { color: var(--warning); }
.acceptance-value.low    { color: var(--error); }

.last-review-value        { font-size: 13px; color: var(--gray-600); }
.last-review-value.recent { color: var(--success); }
.last-review-value.stale  { color: var(--gray-400); }


/* ============================================================
   8. RECOMMENDATION BADGES
   Used in: decisions, manuscript-detail
   ============================================================ */

.recommendation-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.recommendation-badge.accept { background: var(--success-bg); color: var(--success); }
.recommendation-badge.minor  { background: var(--info-bg);    color: var(--info); }
.recommendation-badge.major  { background: var(--warning-bg); color: var(--warning); }
.recommendation-badge.reject { background: var(--error-bg);   color: var(--error); }
.recommendation-badge.split  { background: var(--gray-100);   color: var(--gray-600); }


/* ============================================================
   9. REVIEW DOTS (completion indicators)
   Used in: decisions (card summary)
   ============================================================ */

.review-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid;
}

.review-dot.completed { background: var(--success); border-color: var(--success); }
.review-dot.pending   { background: transparent;    border-color: var(--gray-300); }
.review-dot.overdue   { background: var(--error);   border-color: var(--error); }


/* ============================================================
   10. TIMELINE BADGES
   Used in: history page
   ============================================================ */

.timeline-badge.accept { background: var(--success-bg); color: var(--success); }
.timeline-badge.minor  { background: var(--info-bg);    color: var(--info); }
.timeline-badge.major  { background: var(--warning-bg); color: var(--warning); }
.timeline-badge.reject { background: var(--error-bg);   color: var(--error); }


/* ============================================================
   11. BUTTONS — Flyout Actions
   Used in: index flyout, invite-reviewers flyout, manuscript-detail flyouts
   ============================================================ */

.flyout-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-family: var(--font-sans);
}

.flyout-btn .material-symbols-outlined { font-size: 18px; }

.flyout-btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}
.flyout-btn-primary:hover { background: var(--primary-dark); }

.flyout-btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.flyout-btn-secondary:hover { background: var(--gray-50); }


/* ============================================================
   12. BUTTONS — General
   Used in: decisions, manuscript-detail
   ============================================================ */

.btn-primary {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    background: var(--primary);
    color: white;
    border: none;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }


/* ============================================================
   13. TOAST NOTIFICATION
   Used in: invite-reviewers
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
}

.toast {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--gray-900);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    min-width: 400px;
}

.toast.show { opacity: 1; visibility: visible; transform: translateY(0); }

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon .material-symbols-outlined { font-size: 22px; }
.toast-content { flex: 1; }
.toast-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.toast-message { font-size: 13px; color: var(--gray-300); }
.toast-actions { display: flex; gap: 8px; }

.toast-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-family: var(--font-sans);
}

.toast-btn-primary { background: white; color: var(--gray-900); }
.toast-btn-primary:hover { background: var(--gray-200); }
.toast-btn-secondary { background: transparent; color: var(--gray-300); }
.toast-btn-secondary:hover { color: white; }


/* ============================================================
   14. FLYOUT PANEL (right rail)
   Used in: index, invite-reviewers, manuscript-detail
   ============================================================ */

.flyout-overlay {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-med), visibility var(--transition-med);
    z-index: var(--z-flyout);
}

.flyout-overlay.active { opacity: 1; visibility: visible; }

.flyout-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 480px;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    z-index: var(--z-overlay);
    display: flex;
    flex-direction: column;
}

.flyout-panel.active { transform: translateX(0); }

.flyout-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.flyout-header-content { flex: 1; min-width: 0; }

.flyout-close-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.flyout-close-btn:hover { background: var(--gray-100); color: var(--gray-600); }

.flyout-body { flex: 1; overflow-y: auto; padding: 24px; }
.flyout-section { margin-bottom: 28px; }
.flyout-section:last-child { margin-bottom: 0; }

.flyout-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.flyout-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
}


/* ============================================================
   15. SEARCH BOX
   Used in: index, invite-reviewers, all-manuscripts
   ============================================================ */

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.search-box input {
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    font-family: var(--font-sans);
}

.search-box input::placeholder { color: var(--gray-400); }
.search-box .material-symbols-outlined { color: var(--gray-400); font-size: 20px; }


/* ============================================================
   16. PAGE FOOTER
   Used in: all pages except AI chat
   ============================================================ */

.page-footer {
    margin-top: 32px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--gray-500);
}

.page-footer a { color: var(--gray-500); text-decoration: none; }
.page-footer a:hover { color: var(--primary); }
.footer-links { display: flex; gap: 24px; }


/* ============================================================
   17. PERFORMANCE METRICS GRID
   Used in: invite-reviewers flyout
   ============================================================ */

.performance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.performance-item {
    text-align: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.performance-value { font-size: 24px; font-weight: 700; color: var(--gray-800); }
.performance-value.good    { color: var(--success); }
.performance-value.warning { color: var(--warning); }
.performance-value.poor    { color: var(--error); }
.performance-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }


/* ============================================================
   18. MATCH SCORE BAR (flyout detail)
   Used in: invite-reviewers flyout
   ============================================================ */

.match-score-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.match-score-large { font-size: 28px; font-weight: 700; color: var(--success); }
.match-score-label { font-size: 14px; color: var(--gray-600); }


/* ============================================================
   19. AI CHAT FAB
   Used in: invite-reviewers (links to AI chat variant)
   ============================================================ */

.ai-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 28px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06);
    transition: all var(--transition-med);
}

.ai-chat-fab:hover {
    transform: translateY(-2px);
    background: var(--primary-light);
    box-shadow: 0 6px 20px rgba(0,0,0,0.14), 0 3px 8px rgba(0,0,0,0.08);
}

.ai-chat-fab .material-symbols-outlined { font-size: 20px; }


/* ============================================================
   20. MANUSCRIPT ID (monospace)
   Used in: index, invite-reviewers, decisions, all-manuscripts
   ============================================================ */

.ms-id,
.card-ms-id {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}


/* ============================================================
   21. VIEW TOGGLE
   Used in: invite-reviewers, all-manuscripts
   ============================================================ */

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 4px;
}

.view-toggle-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.view-toggle-btn:hover { color: var(--gray-700); }

.view-toggle-btn.active {
    background: white;
    color: var(--gray-800);
    box-shadow: var(--shadow-sm);
}

.view-toggle-btn .material-symbols-outlined { font-size: 18px; }


/* ============================================================
   22. PAGINATION
   Used in: all-manuscripts
   ============================================================ */

.page-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.page-btn:hover { border-color: var(--gray-300); background: var(--gray-50); }

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}


/* ============================================================
   23. ACTIVE FILTER TAGS
   Used in: index, invite-reviewers
   ============================================================ */

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.active-filter-tag .remove-tag {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.active-filter-tag .remove-tag:hover { background: rgba(255,255,255,0.3); }
.active-filter-tag .remove-tag .material-symbols-outlined { font-size: 14px; }


/* ============================================================
   24. TABLE COLUMN TOOLTIPS
   Used in: invite-reviewers table headers
   ============================================================ */

.col-header-with-tooltip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.col-tooltip-icon {
    font-size: 16px !important;
    color: var(--gray-400);
    cursor: help;
    transition: color var(--transition-fast);
}

.col-tooltip-icon:hover { color: var(--gray-600); }

.col-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
    width: 220px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: var(--z-header);
    pointer-events: none;
}

.col-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--gray-800);
}

.col-header-with-tooltip:hover .col-tooltip { opacity: 1; visibility: visible; }


/* ============================================================
   25. SIDEBAR — GATEWAY (light / expanded)
   Matches live Gateway app layout. Use in prototypes that need
   to mirror the production UI rather than the compact sidebar.
   ============================================================ */

.gw-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    background: white;
    border-right: 1px solid var(--gray-200);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-top: 60px; /* clear header */
}

.gw-sidebar-section {
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-100);
}

.gw-sidebar-section:last-child { border-bottom: none; }

.gw-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    position: relative;
}

.gw-nav-item:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.gw-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.gw-nav-item .material-symbols-outlined {
    font-size: 22px;
    flex-shrink: 0;
}

/* Beta badge — small pill next to nav label */
.gw-beta-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-left: auto;
}


/* ============================================================
   26. TAB BAR — GATEWAY (underline style)
   Horizontal tab navigation with optional count badges.
   Matches live Gateway app tab pattern (Editor Center, etc.)
   ============================================================ */

.gw-tab-bar {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 4px;
}

.gw-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color var(--transition-fast);
    font-family: var(--font-sans);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* overlap the bar border */
}

.gw-tab:hover { color: var(--gray-700); }

.gw-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.gw-tab .material-symbols-outlined {
    font-size: 20px;
}

/* Count badge — appears after the tab label */
.gw-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* Color variants for count badges */
.gw-tab-count.urgent {
    background: var(--error);
    color: white;
}

.gw-tab-count.success {
    background: var(--success);
    color: white;
}

.gw-tab-count.info {
    background: var(--info);
    color: white;
}

.gw-tab-count.neutral {
    background: transparent;
    color: var(--gray-500);
    font-weight: 500;
}


/* ============================================================
   27. STATUS DOT INDICATOR
   Inline status display: colored dot + descriptive text.
   Matches live Gateway app's table STATUS column pattern.
   ============================================================ */

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.overdue { color: var(--error); }
.status-dot.overdue::before { background: var(--error); }

.status-dot.warning { color: var(--warning); }
.status-dot.warning::before { background: var(--warning); }

.status-dot.on-track { color: var(--success); }
.status-dot.on-track::before { background: var(--success); }

.status-dot.in-progress { color: var(--info); }
.status-dot.in-progress::before { background: var(--info); }

.status-dot.neutral { color: var(--gray-500); }
.status-dot.neutral::before { background: var(--gray-400); }


/* ============================================================
   28. FILTER PANEL — GATEWAY
   Collapsible left-side filter sidebar with grouped controls.
   Matches live Gateway app's "Show filters" panel pattern.
   ============================================================ */

.gw-filter-panel {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 20px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.gw-filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 8px;
}

.gw-filter-panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.gw-filter-group {
    padding: 12px 20px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.gw-filter-group:last-child { border-bottom: none; }

.gw-filter-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.gw-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
}

.gw-filter-option input[type="checkbox"],
.gw-filter-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin: 0;
}

.gw-filter-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--gray-400);
    font-weight: 500;
}

/* Filter toolbar (search + toggle) */
.gw-filter-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.gw-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    white-space: nowrap;
}

.gw-filter-toggle:hover { border-color: var(--primary); color: var(--primary); }

.gw-filter-toggle.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.gw-filter-toggle .material-symbols-outlined { font-size: 18px; }

.gw-search-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-700);
    background: white;
}

.gw-search-input .material-symbols-outlined {
    font-size: 20px;
    color: var(--gray-400);
}

.gw-search-input input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--gray-700);
    background: transparent;
}

.gw-search-input input::placeholder { color: var(--gray-400); }


/* ============================================================
   29. HERO BANNER — GATEWAY
   Full-width gradient banner with icon, title, and subtitle.
   Matches live Gateway app's page-level hero pattern.
   ============================================================ */

.gw-hero {
    background: linear-gradient(135deg, #1966d2 0%, #4a8ae6 60%, #7baaf0 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
}

.gw-hero-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gw-hero-icon .material-symbols-outlined {
    font-size: 28px;
    color: white;
}

.gw-hero-content { flex: 1; }

.gw-hero-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.gw-hero-title .count {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.85;
}

.gw-hero-subtitle {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
    margin: 0;
}


/* ============================================================
   30. PAGINATION — GATEWAY (items-per-page variant)
   Three-part pagination bar: summary | per-page dropdown | nav.
   Matches live Gateway app's table footer pattern.
   ============================================================ */

.gw-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--gray-500);
}

.gw-pagination-summary {
    font-weight: 400;
}

.gw-pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gw-per-page {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gw-per-page select {
    padding: 6px 28px 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--gray-700);
    background: white;
    cursor: pointer;
    appearance: auto;
}

.gw-page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gw-page-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.gw-page-nav-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.gw-page-nav-btn:disabled { color: var(--gray-300); cursor: default; }
.gw-page-nav-btn:disabled:hover { background: transparent; }

.gw-page-nav-btn .material-symbols-outlined { font-size: 20px; }

.gw-page-info {
    font-size: 14px;
    color: var(--gray-600);
    white-space: nowrap;
    padding: 0 4px;
}


/* ============================================================
   31. SORTABLE TABLE HEADERS — GATEWAY
   Uppercase column headers with sort-direction arrows.
   Matches live Gateway app's data-table header pattern.
   ============================================================ */

.gw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.gw-table thead { border-bottom: 2px solid var(--gray-200); }

.gw-th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    white-space: nowrap;
    background: var(--gray-50);
    user-select: none;
}

.gw-th.sortable {
    cursor: pointer;
    transition: color var(--transition-fast);
}

.gw-th.sortable:hover { color: var(--gray-700); }

.gw-th-sort {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1;
}

.gw-th-sort-arrow {
    font-size: 10px;
    line-height: 1;
    color: var(--gray-300);
    display: block;
}

.gw-th.sorted-asc .gw-th-sort-arrow:first-child,
.gw-th.sorted-desc .gw-th-sort-arrow:last-child {
    color: var(--primary);
}

.gw-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
    color: var(--gray-700);
}

.gw-table tbody tr:hover { background: var(--gray-50); }

.gw-table tbody tr:last-child td { border-bottom: none; }


/* ============================================================
   32. MODAL / DIALOG — GATEWAY
   Centered overlay dialog with backdrop, header, body, footer.
   Generic modal pattern for confirmations, forms, detail views.
   ============================================================ */

.gw-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gw-modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gw-modal.wide { max-width: 700px; }

.gw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.gw-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.gw-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.gw-modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.gw-modal-close .material-symbols-outlined { font-size: 22px; }

.gw-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
}

.gw-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--gray-200);
}


/* ============================================================
   33. KPI STAT CARD — GATEWAY (Analytics)
   Metric card with label, large value, trend indicator,
   comparison text, and colored progress bar at bottom.
   ============================================================ */

.gw-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.gw-kpi-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.gw-kpi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.gw-kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    line-height: 1.3;
}

.gw-kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.gw-kpi-trend.up { color: var(--success); }
.gw-kpi-trend.down { color: var(--error); }

.gw-kpi-trend .material-symbols-outlined { font-size: 16px; }

.gw-kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
    margin: 4px 0;
}

.gw-kpi-compare {
    font-size: 13px;
    color: var(--gray-500);
}

.gw-kpi-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--gray-100);
    margin-top: 12px;
    overflow: hidden;
}

.gw-kpi-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.gw-kpi-bar-fill.good { background: var(--success); }
.gw-kpi-bar-fill.warning { background: var(--warning); }
.gw-kpi-bar-fill.critical { background: var(--error); }


/* ============================================================
   34. HEALTH STATUS BADGE — GATEWAY (Analytics)
   Pill badge for health indicators: Critical, Warning, Good.
   Used alongside KPI section titles on the analytics dashboard.
   ============================================================ */

.gw-health-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.gw-health-badge.critical {
    background: var(--error);
    color: white;
}

.gw-health-badge.warning {
    background: var(--warning);
    color: white;
}

.gw-health-badge.good {
    background: var(--success);
    color: white;
}

/* Health card — wraps a title + badge + description */
.gw-health-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.gw-health-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.gw-health-card-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.gw-health-card p {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.5;
}


/* ============================================================
   35. EMPTY STATE — GATEWAY
   Centered placeholder for tables/pages with no data.
   Icon + title + description + optional action button.
   ============================================================ */

.gw-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    min-height: 240px;
}

.gw-empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.gw-empty-state-icon .material-symbols-outlined {
    font-size: 28px;
    color: var(--gray-400);
}

.gw-empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0 0 8px;
}

.gw-empty-state p {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0 0 20px;
    max-width: 360px;
    line-height: 1.5;
}


/* ============================================================
   36. LOADING STATE — GATEWAY
   Skeleton shimmer placeholders for content loading.
   Apply to any element to show an animated loading state.
   ============================================================ */

.gw-skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: gw-shimmer 1.5s infinite ease-in-out;
    border-radius: var(--radius-sm);
}

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

.gw-skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
}

.gw-skeleton-text:last-child { margin-bottom: 0; }

.gw-skeleton-heading {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
}

.gw-skeleton-circle {
    border-radius: 50%;
}

.gw-skeleton-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* Loading spinner */
.gw-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: gw-spin 0.8s linear infinite;
}

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

.gw-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    min-height: 200px;
}

.gw-loading-state p {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0;
}
