:root {
    --primary-purple: #6B46C1;
    --dark-purple: #553C9A;
    --light-purple: #8B5CF6;
    --pink-accent: #EC4899;
    --yellow-accent: #F59E0B;
    --green-accent: #10B981;
    --blue-accent: #3B82F6;
    --bg-light: #F5F7FA;
    --card-white: #FFFFFF;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary-purple: #7C3AED;
    --dark-purple: #6B46C1;
    --light-purple: #A78BFA;
    --bg-light: #1F2937;
    --card-white: #374151;
    --text-dark: #F9FAFB;
    --text-muted: #D1D5DB;
    --border-color: #4B5563;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Page Load Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content {
    animation: fadeIn 0.6s ease-out;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-purple) 0%, var(--dark-purple) 100%);
    color: white;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-logo {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.sidebar-logo i {
    font-size: 2rem;
    color: white;
}

.sidebar-logo h4 {
    color: white;
    font-weight: 600;
    margin: 0;
    font-size: 1.25rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0 1rem;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease;
}

.sidebar-menu a:hover::before,
.sidebar-menu a.active::before {
    width: 100%;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
}

.sidebar-menu a i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Top Header */
.top-header {
    background: var(--card-white);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.header-left h5 {
    color: var(--text-dark);
    font-weight: 600;
    margin: 0;
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-light);
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.header-icon:hover {
    background: var(--primary-purple);
    color: white;
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--pink-accent);
    border-radius: 50%;
    border: 2px solid var(--card-white);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.profile-dropdown img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-purple);
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-dropdown img:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(107, 70, 193, 0.2);
}

/* Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--stat-color, var(--primary-purple));
    transition: width 0.3s ease;
}

.stat-card:hover::before {
    width: 100%;
    opacity: 0.1;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.stat-card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.stat-info h6 {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info h3 {
    color: var(--text-dark);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card.pink .stat-icon { background: rgba(236, 72, 153, 0.1); color: var(--pink-accent); }
.stat-card.purple .stat-icon { background: rgba(107, 70, 193, 0.1); color: var(--primary-purple); }
.stat-card.yellow .stat-icon { background: rgba(245, 158, 11, 0.1); color: var(--yellow-accent); }
.stat-card.green .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--green-accent); }
.stat-card.blue .stat-icon { background: rgba(59, 130, 246, 0.1); color: var(--blue-accent); }

/* Cards */
.card {
    background: var(--card-white);
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    border-radius: 1rem 1rem 0 0;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--text-dark);
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary-purple);
    color: white;
}

.btn-primary:hover {
    background: var(--dark-purple);
}

/* Forms */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--card-white);
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
    outline: none;
}

/* Tables */
.table {
    color: var(--text-dark);
}

.table thead {
    background: var(--bg-light);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-light);
    transform: scale(1.01);
}

/* Calendar Widget */
.calendar-widget {
    background: var(--card-white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav {
    background: var(--bg-light);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-nav:hover {
    background: var(--primary-purple);
    color: white;
    transform: scale(1.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.calendar-day:hover {
    background: var(--bg-light);
    transform: scale(1.1);
}

.calendar-day.other-month {
    color: var(--text-muted);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--primary-purple);
    color: white;
    font-weight: 600;
}

.calendar-day.highlight {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green-accent);
}

/* Performance Chart */
.performance-chart {
    min-height: 300px;
}

/* Top Scorer Cards */
.top-scorer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.scorer-card {
    background: var(--card-white);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.scorer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--scorer-color, var(--green-accent));
}

.scorer-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.scorer-card.first { --scorer-color: var(--green-accent); }
.scorer-card.second { --scorer-color: var(--primary-purple); }
.scorer-card.third { --scorer-color: var(--yellow-accent); }

.scorer-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
    border: 3px solid var(--scorer-color, var(--green-accent));
    transition: all 0.3s ease;
}

.scorer-card:hover .scorer-avatar {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(107, 70, 193, 0.2);
}

.scorer-rank {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--scorer-color, var(--green-accent));
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* News/Updates Section */
.news-item {
    padding: 1rem;
    border-left: 3px solid var(--primary-purple);
    margin-bottom: 1rem;
    background: var(--bg-light);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.news-item:hover {
    background: var(--card-white);
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.news-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.news-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.news-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Number Counting Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-animate {
    animation: countUp 0.6s ease-out;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(107, 70, 193, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-purple);
    animation: spin 1s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .top-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        margin: 1rem 0 0 0;
    }
    
    .header-left h5 {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .top-scorer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .calendar-grid {
        gap: 0.25rem;
    }
    
    .calendar-day {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .stat-card-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 1rem !important;
    }
    
    .top-header {
        padding: 0.75rem;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    .header-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .search-box input {
        padding: 0.5rem 0.75rem 0.5rem 2.5rem;
        font-size: 0.875rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Touch-friendly animations for mobile */
@media (hover: none) and (pointer: coarse) {
    .stat-card:hover,
    .card:hover,
    .btn:hover {
        transform: none;
    }
    
    .stat-card:active,
    .card:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.95);
    }
}

/* Scroll Animations */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Alerts */
.alert {
    border-radius: 0.75rem;
    border: none;
    box-shadow: var(--shadow-sm);
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Pagination */
.pagination {
    gap: 0.5rem;
}

.page-link {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.page-link:hover {
    background: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
}

/* Modal animations */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

/* Smooth Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
