/* =====================================================
   BowlingScore - Custom Styles
   Modern dark theme bowling score management
   ===================================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bowling-orange: #ff6b35;
    --bowling-blue: #004e89;
    --bowling-green: #00b894;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition-speed: 0.3s;
}

/* ---- Typography ---- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f1117;
    color: #e1e5ee;
    overflow-x: hidden;
}

/* =====================================================
   LIGHT THEME OVERRIDES
   ===================================================== */
[data-bs-theme="light"] {
    --glass-bg: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] body,
html[data-bs-theme="light"] body {
    background-color: #f0f2f5;
    color: #1a1a2e;
}

[data-bs-theme="light"] .sidebar {
    background: #ffffff;
    border-right-color: rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .sidebar-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .sidebar-brand {
    color: #1a1a2e;
}

[data-bs-theme="light"] .sidebar-nav .nav-link {
    color: #5a6070;
}

[data-bs-theme="light"] .sidebar-nav .nav-link:hover {
    color: #1a1a2e;
    background: rgba(102, 126, 234, 0.06);
}

[data-bs-theme="light"] .sidebar-nav .nav-link.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

[data-bs-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .topbar-title {
    color: #1a1a2e;
}

[data-bs-theme="light"] .topbar-user {
    color: #1a1a2e;
}

[data-bs-theme="light"] .card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-bs-theme="light"] .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="light"] .card-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-bs-theme="light"] .table {
    color: #1a1a2e;
}

[data-bs-theme="light"] .table thead th {
    background: rgba(102, 126, 234, 0.05);
    border-color: rgba(0, 0, 0, 0.06);
    color: #5a6070;
}

[data-bs-theme="light"] .table tbody td {
    border-color: rgba(0, 0, 0, 0.06);
}

[data-bs-theme="light"] .table-hover tbody tr:hover {
    background: rgba(102, 126, 234, 0.03);
}

[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1a1a2e;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    background: #ffffff;
    color: #1a1a2e;
}

[data-bs-theme="light"] .form-label {
    color: #5a6070;
}

[data-bs-theme="light"] .footer {
    border-top-color: rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.5);
}

[data-bs-theme="light"] .auth-page {
    background: #f0f2f5;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(118, 75, 162, 0.08) 0%, transparent 50%);
}

[data-bs-theme="light"] .auth-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="light"] .highlight-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="light"] .dataTables_wrapper .dataTables_length select {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1a1a2e;
}

[data-bs-theme="light"] .dataTables_wrapper .dataTables_info,
[data-bs-theme="light"] .dataTables_wrapper .dataTables_length label,
[data-bs-theme="light"] .dataTables_wrapper .dataTables_filter label {
    color: #5a6070;
}

[data-bs-theme="light"] .btn-outline-light {
    color: #5a6070;
    border-color: #c5cad3;
    background: transparent;
}

[data-bs-theme="light"] .btn-outline-light:hover {
    color: #1a1a2e;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.06);
}

[data-bs-theme="light"] .btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

[data-bs-theme="light"] .breadcrumb-item a {
    color: #667eea;
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #8892a4;
}

.theme-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-color: #667eea;
}

[data-bs-theme="light"] .theme-toggle {
    color: #5a6070;
    border-color: #d1d5db;
}

[data-bs-theme="light"] .theme-toggle:hover {
    color: #667eea;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.06);
}

/* ---- Auth Page ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1117;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 1rem;
}

.auth-card {
    background: rgba(30, 33, 43, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.auth-logo i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- App Layout ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: rgba(18, 20, 28, 0.98);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    height: var(--topbar-height);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
}

.sidebar-brand i {
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.sidebar-nav .nav-header {
    padding: 1rem 1.25rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: #8892a4;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: #e1e5ee;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-toggle {
    color: #8892a4;
    text-decoration: none;
    padding: 0;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: margin-left var(--transition-speed) ease;
}

/* ---- Topbar ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: var(--topbar-height);
    background: rgba(18, 20, 28, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.topbar-title {
    color: #e1e5ee;
}

.topbar-toggle {
    color: #8892a4;
    text-decoration: none;
    padding: 0;
}

.topbar-user {
    color: #e1e5ee;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
}

.user-avatar i {
    font-size: 1.5rem;
}

/* ---- Cards ---- */
.card {
    background: rgba(30, 33, 43, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.25);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}

/* ---- Stat Cards ---- */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2.5rem;
    opacity: 0.15;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8892a4;
    margin-top: 0.25rem;
}

.stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.stat-card .stat-change.positive {
    color: var(--bowling-green);
}

.stat-card .stat-change.negative {
    color: #e74c3c;
}

/* ---- Score specific ---- */
.score-200 {
    color: var(--bowling-green);
    font-weight: 700;
}

.score-250 {
    color: var(--bowling-orange);
    font-weight: 700;
}

.score-300 {
    color: #ffd700;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* ---- Tables ---- */
.table {
    color: #e1e5ee;
}

.table thead th {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--glass-border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8892a4;
}

.table tbody td {
    border-color: var(--glass-border);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: rgba(30, 33, 43, 0.8);
    border: 1px solid var(--glass-border);
    color: #e1e5ee;
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: #8892a4;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #8892a4 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: rgba(102, 126, 234, 0.2) !important;
    border-color: #667eea !important;
    color: #667eea !important;
}

/* ---- Badges ---- */
.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ---- Buttons ---- */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    font-weight: 500;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4295 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s ease;
}

.btn-glow:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

/* ---- Forms ---- */
.form-control,
.form-select {
    background: rgba(30, 33, 43, 0.8);
    border: 1px solid var(--glass-border);
    color: #e1e5ee;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    background: rgba(30, 33, 43, 0.95);
    border-color: #667eea;
    color: #e1e5ee;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #8892a4;
}

/* ---- Highlights / Achievement Cards ---- */
.highlight-card {
    background: rgba(30, 33, 43, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.highlight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.highlight-card.perfect-game {
    border-color: rgba(255, 215, 0, 0.3);
    background: rgba(255, 215, 0, 0.05);
}

.highlight-card .highlight-score {
    font-size: 2.5rem;
    font-weight: 800;
}

/* ---- Animated Counter ---- */
.counter-animate {
    transition: all 0.5s ease;
}

/* ---- Chart containers ---- */
.chart-container {
    position: relative;
    padding: 1rem;
}

/* ---- CSV Import Wizard ---- */
.import-wizard .step {
    display: none;
}

.import-wizard .step.active {
    display: block;
}

.import-steps {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.import-steps .step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
    position: relative;
}

.import-steps .step-indicator.active {
    color: #667eea;
}

.import-steps .step-indicator.completed {
    color: var(--bowling-green);
}

.import-steps .step-indicator .step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(108, 117, 125, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.import-steps .step-indicator.active .step-number {
    background: var(--primary-gradient);
    color: #fff;
}

.import-steps .step-indicator.completed .step-number {
    background: var(--bowling-green);
    color: #fff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---- Page Content (scrollable between topbar and footer) ---- */
.main-content > main {
    flex: 1;
    overflow-y: auto;
}

/* ---- Footer ---- */
.footer {
    border-top: 1px solid var(--glass-border);
    background: rgba(18, 20, 28, 0.5);
    position: sticky;
    bottom: 0;
    z-index: 1040;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ---- Nearest match day highlight ---- */
.table tbody tr.next-matchday > td {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.25);
}

[data-bs-theme="light"] .table tbody tr.next-matchday > td {
    background: rgba(102, 126, 234, 0.10);
    border-color: rgba(102, 126, 234, 0.15);
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 1.5rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}
