/* ─── Sports Academy ERP — Athletic Editorial Theme ───
     Primary:   #FEFAE0 (cream background)
     Secondary: #E9EDC9 (light sage)
     Accent:    #CCD5AE (medium sage)
     Fonts:     Oswald (display) + DM Sans (body)
   ───────────────────────────────────────────────── */

:root {
    --primary: #FEFAE0;
    --secondary: #E9EDC9;
    --accent: #CCD5AE;
    --accent-dark: #B5C49A;
    --text-dark: #2C3E50;
    --text-muted: #6C757D;
    --white: #FFFFFF;
    --border: #D4D8C8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    /* Override Bootstrap defaults */
    --bs-primary: var(--accent-dark);
    --bs-primary-rgb: 181, 196, 154;
    --bs-primary-bg-subtle: var(--secondary);
    --bs-primary-border-subtle: var(--accent);
}

/* ─── Base ─── */
body {
    background-color: var(--primary);
    color: var(--text-dark);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.02em;
}

/* ─── Sidebar ─── */
.sidebar {
    height: 100vh;
    background: linear-gradient(180deg, var(--accent) 0%, #BECFA0 100%);
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Flex layout so brand stays top, nav scrolls, footer stays bottom */
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    flex-shrink: 0;
}

/* Scrollable nav area — fills remaining space between brand and footer */
.sidebar-nav-wrap {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.sidebar-nav-wrap::-webkit-scrollbar { width: 4px; }
.sidebar-nav-wrap::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* Footer (ads + logout) — pinned to bottom */
.sidebar-footer {
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    text-align: center;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    background: linear-gradient(180deg, var(--secondary) 0%, rgba(233,237,201,0.5) 100%);
}

.sidebar-logo {
    max-height: 40px;
    max-width: 140px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.5rem;
}

.sidebar-brand h5 {
    color: var(--text-dark);
    font-weight: 700;
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    word-break: break-word;
}

/* Nav links */
.sidebar .nav-link {
    color: var(--text-dark);
    padding: 0.7rem 1.25rem;
    border-radius: 0;
    margin: 0.1rem 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    position: relative;
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 0.6rem;
    font-size: 1rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.35);
    color: var(--text-dark);
}

.sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.4);
    color: var(--text-dark);
    font-weight: 600;
}

.sidebar .nav-link[data-bs-toggle="collapse"] {
    cursor: pointer;
}

.sidebar .nav-link[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.7rem;
    margin-left: auto;
}

.sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Submenu items — tree lines */
.sidebar .collapse .nav-link {
    padding-left: 3rem !important;
    font-size: 0.85rem;
    font-weight: 400;
    border-left: 2px solid transparent;
    border-radius: 0;
    margin: 0 0 0 0.5rem;
    position: relative;
}

.sidebar .collapse .nav-link::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0,0,0,0.08);
}

.sidebar .collapse .nav-link:last-child::before {
    height: 50%;
}

.sidebar .collapse .nav-link:hover,
.sidebar .collapse .nav-link.active {
    border-left-color: var(--text-dark);
    background-color: rgba(255,255,255,0.2);
}

.sidebar .collapse .nav-link i {
    font-size: 0.8rem;
    width: 20px;
}

/* Active indicator — sliding stripe */
.sidebar .nav-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--text-dark);
    border-radius: 0 3px 3px 0;
}

/* ─── Main Content ─── */
.main-content {
    margin-left: 250px;
    min-height: 100vh;
    padding: 0;
}

/* ─── Top Navbar ─── */
.top-navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(212,216,200,0.5);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* ─── Cards — Glass morphism ─── */
.card {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(212,216,200,0.5);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(212,216,200,0.4);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* ─── Stat Cards — Hero Layout ─── */
.stat-card {
    position: relative;
    overflow: hidden;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(204,213,174,0.2);
    color: var(--text-dark);
}

.stat-card .stat-number {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text-dark);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card .stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-card .stat-trend.up { color: #2d8a4e; }
.stat-card .stat-trend.down { color: #d1453b; }

/* Hero stat — spans 2 cols */
.stat-hero {
    background: linear-gradient(135deg, rgba(204,213,174,0.3) 0%, rgba(233,237,201,0.5) 100%);
    border: 1px solid rgba(204,213,174,0.4);
}

.stat-hero .stat-number {
    font-size: 3rem;
}

/* Decorative gradient blob on hero card */
.stat-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(204,213,174,0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* ─── 3D Geometric Element ─── */
.geo-ring {
    position: relative;
    width: 80px;
    height: 80px;
    perspective: 600px;
}

.geo-ring-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: geoSpin 8s linear infinite;
}

.geo-ring-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(44,62,80,0.15);
    border-radius: 50%;
}

.geo-ring-circle:nth-child(1) { transform: rotateX(60deg) rotateZ(0deg); }
.geo-ring-circle:nth-child(2) { transform: rotateX(60deg) rotateZ(120deg); }
.geo-ring-circle:nth-child(3) { transform: rotateX(60deg) rotateZ(240deg); }

@keyframes geoSpin {
    0%   { transform: rotateX(70deg) rotateZ(0deg); }
    100% { transform: rotateX(70deg) rotateZ(360deg); }
}

/* ─── Buttons ─── */
.btn {
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.97);
}

/* Replace Bootstrap blue buttons with theme colors */
.btn-primary,
.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
    background-color: var(--accent-dark) !important;
    border-color: var(--accent-dark) !important;
    color: #fff !important;
}

.btn-primary:hover {
    background-color: #A8BA90 !important;
    border-color: #A8BA90 !important;
}

.btn-outline-primary {
    border-color: var(--accent-dark) !important;
    color: var(--text-dark) !important;
}

.btn-success {
    background-color: #7BAF7A !important;
    border-color: #7BAF7A !important;
}

.btn-success:hover {
    background-color: #6A9E69 !important;
    border-color: #6A9E69 !important;
}

.btn-accent {
    background-color: var(--accent);
    border-color: var(--accent-dark);
    color: var(--text-dark);
}

.btn-accent:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
    color: var(--text-dark);
}

.btn-outline-accent {
    border-color: var(--accent);
    color: var(--text-dark);
}

.btn-outline-accent:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--text-dark);
}

/* ─── Tables ─── */
.table {
    background-color: transparent;
    margin-bottom: 0;
}

.table thead th {
    background-color: rgba(233,237,201,0.4);
    border-bottom: 2px solid var(--accent);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem;
}

.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(212,216,200,0.3);
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(204,213,174,0.1);
}

.academy-row td:first-child {
    border-left: 2px solid transparent;
    transition: border-color 0.2s ease;
}
.academy-row:hover td:first-child {
    border-left-color: var(--accent);
}

.trend-bar-revenue {
    background: var(--accent);
    transition: height 0.4s ease;
    min-height: 4px;
}
.trend-bar-expense {
    background: #dc3545;
    opacity: 0.6;
    transition: height 0.4s ease;
    min-height: 2px;
}
.trend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    vertical-align: middle;
}

/* ─── Forms ─── */
.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: 0.625rem;
    padding: 0.65rem 0.9rem;
    font-size: 0.925rem;
    background-color: var(--white);
    color: var(--text-dark);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--accent);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 3px rgba(204, 213, 174, 0.35);
    background-color: #fefefa;
}

.form-control::placeholder {
    color: #a3a89a;
    font-weight: 400;
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.form-text {
    font-size: 0.78rem;
    color: #8a9480;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ─── Badges ─── */
.badge {
    font-weight: 500;
    letter-spacing: 0.03em;
    padding: 0.35em 0.7em;
}

.badge-accent {
    background-color: var(--accent);
    color: var(--text-dark);
}

/* ─── Notification Badge ─── */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.6rem;
    padding: 0.2em 0.45em;
    border-radius: 50%;
    background-color: #dc3545;
    color: white;
}

/* ─── Welcome Card ─── */
.welcome-card {
    position: relative;
    overflow: hidden;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
}

.welcome-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* ─── Auth Pages ─── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    position: relative;
    overflow: hidden;
}

/* Decorative rings on auth page */
.auth-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border: 1px solid rgba(204,213,174,0.2);
    border-radius: 50%;
    top: -200px;
    right: -200px;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border: 1px solid rgba(204,213,174,0.15);
    border-radius: 50%;
    bottom: -100px;
    left: -100px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

/* ─── Avatar Circle ─── */
.avatar-circle {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ─── List Group ─── */
.list-group-item {
    border-color: rgba(212,216,200,0.3);
    transition: background-color 0.15s ease;
}

.list-group-item:first-child {
    border-top: none;
}

/* ─── Page Load Animations ─── */
.animate-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }
.animate-in-delay-5 { animation-delay: 0.5s; }

@keyframes fadeSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Sidebar Sliding Stripe Animation ─── */
@keyframes stripeGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar .nav-link.active::after {
    animation: stripeGlow 2s ease-in-out infinite;
}

/* ─── Quick Actions ─── */
.quick-actions .btn {
    border-radius: 2rem;
    padding: 0.4rem 1.1rem;
    font-size: 0.8rem;
}

.quick-actions .btn i {
    margin-right: 0.3rem;
}

/* ─── Branding Section ─── */
.branding-section {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(212,216,200,0.4);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block !important;
    }

    .stat-card .stat-number {
        font-size: 1.6rem;
    }
    .stat-hero .stat-number {
        font-size: 2.2rem;
    }
}
