/* ============================================================
   style.css  –  KitsuLand Portal – Premium Dark UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #0a0c14;
    --bg-card: rgba(15, 18, 30, 0.75);
    --border: rgba(139, 92, 246, 0.25);
    --border-hover: rgba(139, 92, 246, 0.6);
    --accent-1: #8b5cf6;
    --accent-2: #6d28d9;
    --accent-light: #c4b5fd;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --error-bg: rgba(239, 68, 68, 0.12);
    --error-border: rgba(239, 68, 68, 0.4);
    --error-text: #fca5a5;
    --success-bg: rgba(34, 197, 94, 0.12);
    --success-border: rgba(34, 197, 94, 0.4);
    --success-text: #86efac;
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: rgba(139, 92, 246, 0.5);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ---- Animated gradient background ---- */
body {
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(109, 40, 217, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(139, 92, 246, 0.12) 0%, transparent 60%),
        var(--bg-dark);
    min-height: 100vh;
    background-attachment: fixed;
}

/* ---- Floating particles (pure CSS) ---- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 15% 25%, rgba(139, 92, 246, 0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 15%, rgba(139, 92, 246, 0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 85% 65%, rgba(109, 40, 217, 0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 75%, rgba(196, 181, 253, 0.3) 0%, transparent 100%),
        radial-gradient(2px 2px at 50% 45%, rgba(139, 92, 246, 0.2) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Layout: full-page centered ---- */
.page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

/* ---- Glassmorphism Card ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        var(--shadow-glow),
        0 2px 0 rgba(255, 255, 255, 0.04) inset,
        0 25px 50px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.5s ease both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Logo / Brand ---- */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ---- Alert messages ---- */
.alert {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

/* ---- Form ---- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-family: 'Inter', monospace;
    color: var(--text-primary);
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--input-focus);
}

/* ---- Checkbox row ---- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--input-border);
    background: var(--input-bg);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: border-color var(--transition), background var(--transition);
}

.checkbox-row input[type="checkbox"]:checked {
    background: var(--accent-1);
    border-color: var(--accent-1);
}

.checkbox-row input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1.5px;
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ---- Submit button ---- */
.btn-primary {
    width: 100%;
    padding: 0.8125rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(139, 92, 246, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
    opacity: 1;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- Loading spinner after submit ---- */
.btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ---- Footer hint ---- */
.card-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.card-footer a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--transition);
}

.card-footer a:hover {
    color: var(--accent-1);
}

/* ---- Divider ---- */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ---- Dashboard specific ---- */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(10, 12, 20, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.dashboard-brand {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-logout {
    padding: 0.4375rem 1rem;
    border: 1.5px solid var(--border-hover);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--accent-light);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-logout:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: var(--accent-1);
    color: var(--text-primary);
}

/* ---- Dashboard layout: sidebar + content ---- */
.dashboard-body {
    display: flex;
    min-height: calc(100vh - 57px);
    /* below sticky header */
}

/* ---- Sidebar ---- */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: rgba(10, 12, 20, 0.7);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    transition: width var(--transition), opacity var(--transition);
    position: sticky;
    top: 57px;
    height: calc(100vh - 57px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 90;
}

.sidebar.collapsed {
    width: 56px;
}

/* Section label */
.sidebar-section {
    padding: 0 1rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-section {
    opacity: 0;
    pointer-events: none;
}

/* Nav item */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.125rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border-radius: 0;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    border-left: 2.5px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
    border-left-color: var(--accent-1);
}

.sidebar-item.active {
    background: rgba(139, 92, 246, 0.14);
    color: var(--accent-light);
    border-left-color: var(--accent-1);
}

.sidebar-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-label {
    transition: opacity var(--transition);
    overflow: hidden;
}

.sidebar.collapsed .sidebar-label {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* Toggle button at bottom of sidebar */
.sidebar-toggle {
    margin-top: auto;
    padding: 0.75rem 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border);
    transition: color var(--transition);
    background: none;
    border-left: 2.5px solid transparent;
    border-right: none;
    border-bottom: none;
    font-family: 'Inter', sans-serif;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-toggle:hover {
    color: var(--text-primary);
}

.sidebar-toggle .toggle-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 1rem;
    transition: transform var(--transition);
}

.sidebar.collapsed .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-toggle .toggle-label {
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-toggle .toggle-label {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* Main content area beside sidebar */
.dashboard-content {
    flex: 1;
    min-width: 0;
    /* prevents flex overflow */
    padding: 2.5rem 2rem;
    max-width: 100%;
    overflow-y: auto;
}

.welcome-banner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-glow);
    animation: fadeInUp 0.45s ease both;
}

.welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-sub {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.badge-faction {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1rem;
    padding: 0.375rem 0.875rem;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent-light);
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-1);
    box-shadow: 0 0 6px var(--accent-1);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ============================================================
   DASHBOARD EXPANSION STYLES
   ============================================================ */

/* ---- Header actions row ---- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ---- Update Database button ---- */
.btn-update {
    padding: 0.4375rem 1rem;
    border: 1.5px solid var(--border-hover);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--accent-light);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-update:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: var(--accent-1);
    color: var(--text-primary);
}

/* ---- DB error / empty state ---- */
.db-error-banner {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    font-size: 0.875rem;
    line-height: 1.6;
}

.db-error-banner code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.8em;
}

.empty-state {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    animation: fadeInUp 0.5s ease both;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    filter: grayscale(0.4);
}

.empty-state p {
    font-size: 1rem;
    line-height: 1.6;
}

.empty-state strong {
    color: var(--accent-light);
}

/* ---- Widget grid ---- */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
    align-items: stretch;
    /* equal heights */
}

.widget-grid>.widget {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (max-width: 900px) {
    .widget-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 580px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-content {
        padding: 1.5rem 1rem;
    }
}

/* ---- Widget base ---- */
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.5s ease both;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.widget:hover {
    border-color: var(--accent-1);
    box-shadow: 0 4px 32px rgba(139, 92, 246, 0.2);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.widget-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

/* ---- Ranking badge ---- */
.rank-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.18);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: var(--accent-light);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ---- Donut chart ---- */
.donut-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1rem;
}

.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-total {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.donut-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- War legend ---- */
.war-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
}

.legend-item strong {
    font-size: 0.875rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-win .legend-dot {
    background: rgba(34, 197, 94, 0.85);
}

.legend-loss .legend-dot {
    background: rgba(239, 68, 68, 0.75);
}

.legend-win {
    color: #86efac;
}

.legend-loss {
    color: #fca5a5;
}

/* ---- Stat cards (chain + war) ---- */
.stat-primary {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-secondary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.stat-secondary:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
}

.no-data {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    margin-top: 1rem;
}

/* ---- Result badge ---- */
.result-badge {
    display: inline-block;
    padding: 0.375rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.result-win {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.result-loss {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.result-ongoing {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fde68a;
}

/* ---- Score row ---- */
.score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.score-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.our-side {
    align-items: flex-start;
}

.opp-side {
    align-items: flex-end;
}

.score-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.score-pts {
    font-size: 1.5rem;
    font-weight: 700;
}

.pts-win {
    color: #86efac;
}

.pts-loss {
    color: #fca5a5;
}

.score-vs {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* ============================================================
   MODAL – Update Database
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease both;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 500px;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow:
        var(--shadow-glow),
        0 2px 0 rgba(255, 255, 255, 0.05) inset,
        0 32px 64px rgba(0, 0, 0, 0.55);
    animation: fadeInUp 0.25s ease both;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.modal-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.modal-note strong {
    color: var(--accent-light);
}

/* ---- API call list ---- */
.call-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.call-list li {
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: 'Inter', monospace;
}

.call-list .log-loading {
    color: var(--text-muted);
    font-style: italic;
}

.call-list .log-error {
    color: var(--error-text);
}

/* ---- Modal action buttons ---- */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-cancel {
    padding: 0.5rem 1.25rem;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-proceed {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-proceed:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ---- Log pane (streaming terminal) ---- */
.log-pane {
    background: rgba(5, 6, 15, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    min-height: 160px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.75rem;
    scroll-behavior: smooth;
    box-shadow: inset 0 1px 0 rgba(139, 92, 246, 0.08);
}

/* Log line colours */
.log-line {
    color: var(--text-secondary);
}

.log-calling {
    color: #93c5fd;
}

/* blue  – in progress */
.log-ok {
    color: #86efac;
}

/* green – success     */
.log-info {
    color: #e2e8f0;
}

/* white – info        */
.log-error {
    color: #fca5a5;
}

/* red   – error       */
.log-done {
    color: #fde68a;
    font-weight: 600;
}

/* gold – done */

.hidden {
    display: none !important;
}

/* ============================================================
   WAR HISTORY TABLE
   ============================================================ */
.war-history-table {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-hover);
}

/* ---- Header row ---- */
.war-row-header {
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid var(--border-hover);
    padding: 0.6rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ---- Base row layout ---- */
.war-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto 70px 70px 1.5rem;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.war-row:last-child {
    border-bottom: none;
}

/* Clickable data rows */
.war-row-data:hover {
    background: rgba(139, 92, 246, 0.08);
    box-shadow: inset 3px 0 0 var(--accent-1);
}

/* Ongoing war highlight */
.war-row-ongoing {
    background: rgba(251, 191, 36, 0.04);
}

.war-row-ongoing:hover {
    background: rgba(251, 191, 36, 0.1);
    box-shadow: inset 3px 0 0 #fbbf24;
}

/* ---- Column sizing ---- */
.war-col-opponent {
    min-width: 0;
}

.war-col-score {
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.war-col-result {
    white-space: nowrap;
}

.war-col-date {
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.war-col-arrow {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-align: right;
    transition: transform var(--transition), color var(--transition);
}

.war-row-data:hover .war-col-arrow {
    transform: translateX(3px);
    color: var(--accent-light);
}

/* ---- Opponent cell ---- */
.war-vs {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.war-opp-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Score cell ---- */
.war-score {
    font-weight: 700;
    font-size: 0.9375rem;
}

.war-score-sep {
    color: var(--text-muted);
    margin: 0 0.35rem;
}

.score-our-win {
    color: #86efac;
}

.score-our-loss {
    color: #fca5a5;
}

.score-opp-win {
    color: #86efac;
}

.score-opp-loss {
    color: #fca5a5;
}

/* ---- Result badge ---- */
.war-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-win {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.badge-loss {
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.badge-ongoing {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fde68a;
    animation: pulse 2s infinite;
}

.badge-draw {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-muted);
}

/* ---- Utility ---- */
.text-accent {
    color: var(--accent-light);
    text-decoration: none;
}

.text-accent:hover {
    color: var(--accent-1);
    text-decoration: underline;
}

/* ============================================================
   WAR DETAIL PAGE
   ============================================================ */

/* ---- Breadcrumb ---- */
.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.detail-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(251, 191, 36, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fde68a;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    animation: pulse 2s infinite;
}

/* ---- Section wrapper ---- */
.detail-section {
    flex: 1;
    min-width: 0;
}

.detail-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.member-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

/* ---- Item rewards grid ---- */
.items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 0.5rem;
}

.item-reward-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.item-reward-qty {
    font-weight: 700;
    color: var(--accent-light);
    font-size: 0.8125rem;
}

.item-reward-name {
    color: var(--text-primary);
}

/* ---- Side-by-side table layout ---- */
.detail-tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
    align-items: start;
}

@media (max-width: 860px) {
    .detail-tables-row {
        grid-template-columns: 1fr;
    }
}

/* ---- Member table ---- */
.member-table {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-hover);
    display: flex;
    flex-direction: column;
}

.member-row {
    display: grid;
    grid-template-columns: 2rem 1fr auto auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background var(--transition);
}

.member-row:last-child {
    border-bottom: none;
}

.member-row-header {
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid var(--border-hover);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
}

.member-row:not(.member-row-header):hover {
    background: rgba(139, 92, 246, 0.06);
}

/* Inactive member: 0 attacks */
.member-row-inactive {
    opacity: 0.45;
}

/* ---- Member column sizing ---- */
.member-col-rank {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

.member-col-user {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-col-attacks {
    text-align: right;
    white-space: nowrap;
    color: var(--text-secondary);
}

.member-col-score {
    text-align: right;
    white-space: nowrap;
    font-weight: 600;
    min-width: 4rem;
}

.member-col-avg {
    text-align: right;
    white-space: nowrap;
    font-weight: 500;
    min-width: 4.5rem;
    color: var(--text-secondary);
}

/* ---- Member name link ---- */
.member-name-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
}

.member-name-link:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* ======================================================
   Chain History Page (chains.php)
   ====================================================== */

/* Chain row grid override */
.chain-row {
    grid-template-columns: 8rem 180px 1fr 8rem 7rem 6rem 1.5rem;
}

.chain-col-respect {
    text-align: right;
}

.chain-col-date {
    text-align: right;
    white-space: nowrap;
}

.chain-col-status {
    text-align: right;
}

/* Chain hit count – big, gold-accented */
.chain-number {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent-light);
}

.chain-hits-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Respect figure */
.chain-respect {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
}