/* =======================================================
   Cipher Advisor — Base Design System
   Aligned with Bastly/PSIRT Design Language (March 2026)
   ======================================================= */

/* ── Google Fonts: JetBrains Mono for technical content ── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── Core Design Tokens ── */
:root {
    /* Layers & Backgrounds (Bastly Dark) */
    --bg-app: #0a0a0f;
    --bg-card: #141419;
    --bg-card-elevated: #1a1a24;
    --bg-hover: #1f1f2e;
    --bg-input: #0f0f14;
    --bg-glass: rgba(20, 20, 25, 0.6);
    --bg-body: #0e0e14;

    /* Text Hierarchy */
    --text-primary: #f8f9fa;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-muted: #4b5563;

    /* Semantic Colors */
    --text-success: #10b981;
    --text-warning: #f59e0b;
    --text-danger: #ef4444;
    --text-info: #06b6d4;

    /* Accent Palette */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-cyan: #06b6d4;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-accent: rgba(99, 102, 241, 0.3);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-info: linear-gradient(135deg, #06b6d4, #0891b2);
    --gradient-card: linear-gradient(135deg, rgba(20, 20, 25, 0.8), rgba(26, 26, 36, 0.6));
    --gradient-cyber: linear-gradient(135deg, #6366f1, #8b5cf6);

    /* Shadow Glows */
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --shadow-glow-success: 0 0 20px rgba(16, 185, 129, 0.15);
    --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.15);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* UI Tokens */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    --transition-base: all 0.2s ease;
    --transition-smooth: all 0.25s cubic-bezier(.4, 0, .2, 1);
    --gap-sm: 0.5rem;
    --gap-md: 1rem;
    --gap-lg: 1.5rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
}

/* ── Global Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ── Card System ── */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--gap-lg);
    transition: var(--transition-smooth);
}
.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

/* ── Button System ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    box-shadow: var(--shadow-glow-danger);
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
    border-color: rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow-success);
}

/* ── Input System ── */
.input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-base);
}
.input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.input::placeholder {
    color: var(--text-muted);
}

/* ── Badge System ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.badge-primary { background: rgba(99, 102, 241, 0.1); color: #818cf8; }
.badge-success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-info { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }
.badge-violet { background: rgba(139, 92, 246, 0.1); color: #a78bfa; }

/* ── Semantic Status Colors (Low-Saturation) ── */
.status-recommended { background: rgba(16, 185, 129, 0.08); color: #10b981; }
.status-acceptable { background: rgba(59, 130, 246, 0.08); color: #3b82f6; }
.status-deprecated { background: rgba(245, 158, 11, 0.08); color: #f59e0b; }
.status-retired { background: rgba(239, 68, 68, 0.08); color: #ef4444; }
.status-future { background: rgba(139, 92, 246, 0.08); color: #a78bfa; }
.status-legacy { background: rgba(100, 116, 139, 0.08); color: #94a3b8; }

/* ── Page Header Pattern ── */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.page-header p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* ── Metric Card Pattern ── */
.metric-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--metric-color, var(--accent-primary)), transparent);
    opacity: .7;
}
.metric-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
.metric-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.metric-value {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: -1px;
}
.metric-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Chart Card Pattern ── */
.chart-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition-smooth);
}
.chart-card:hover {
    border-color: var(--border-accent);
}
.chart-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

/* ── Filter Pills Pattern ── */
.filter-pills {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    transition: var(--transition-base);
}
.filter-pill:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.filter-pill.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
}

/* ── Modal Overlay ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-card {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 90%;
    box-shadow: var(--shadow-elevated);
}
.modal-card h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ── Form Groups ── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    box-sizing: border-box;
    transition: var(--transition-base);
}
.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
textarea.form-input { min-height: 100px; resize: vertical; }

/* ── Table System ── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}
.data-table tr:hover td {
    background: rgba(99, 102, 241, 0.03);
    color: var(--text-primary);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Glassmorphism Row Pattern ── */
.glass-bar {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

/* ── Mono Code Styling ── */
.mono { font-family: var(--font-mono); }
code, .code-text {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(99, 102, 241, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: #818cf8;
}

/* ── Scrollbar Styling ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ── Card Entrance Animation ── */
@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Utility Classes ── */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--text-success); }
.text-warning { color: var(--text-warning); }
.text-danger { color: var(--text-danger); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }

/* ── Standalone Theme Toggle Button ── */
#themeStandaloneBtn {
    background: var(--bg-hover, rgba(255,255,255,.04));
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    margin-left: auto;
}
#themeStandaloneBtn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

/* ── Card Stagger Animations ── */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ── Link Hover ── */
a[href]:hover { color: #818cf8; }

/* ── Section Divider ── */
.section-divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

/* ── Metric Icon Glow ── */
.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 16px;
    transition: var(--transition-smooth);
}
.metric-card:hover .metric-icon {
    transform: scale(1.1);
}

/* ── Loading Shimmer ── */
.shimmer {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        var(--bg-hover) 50%,
        var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmerMove 1.5s ease-in-out infinite;
}
@keyframes shimmerMove {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Tooltip ── */
[data-tip] {
    position: relative;
}
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card-elevated);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: var(--shadow-elevated);
    border: 1px solid var(--border-color);
    z-index: 100;
    pointer-events: none;
    animation: fadeIn .15s ease-out;
}

/* ── Focus Ring ── */
:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}

/* ── Text Selection ── */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: inherit;
}
