/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content i {
    font-size: 3em;
    margin-bottom: 20px;
    color: #ffeb3b;
}

.loading-content h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

.loading-content p {
    font-size: 1.1em;
    opacity: 0.8;
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    backdrop-filter: blur(10px);
}

.login-header h1 {
    color: #4a5568;
    font-size: 2em;
    margin-bottom: 10px;
}

.login-header h1 i {
    color: #9146ff;
    margin-right: 10px;
}

.login-header p {
    color: #718096;
    margin-bottom: 30px;
    line-height: 1.5;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #9146ff;
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.login-btn:hover {
    background: #772ce8;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(145, 70, 255, 0.4);
}

.login-btn i {
    font-size: 1.3em;
}

.login-info {
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.login-info p {
    color: #4a5568;
    font-size: 0.9em;
    margin: 0;
}

.login-info i {
    color: #667eea;
    margin-right: 8px;
}

/* Dashboard Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    color: #4a5568;
    font-size: 1.8em;
}

.header-content h1 i {
    color: #9146ff;
    margin-right: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #9146ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2em;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.username {
    font-weight: 600;
    color: #2d3748;
}

.logout-btn {
    color: #718096;
    font-size: 0.9em;
    cursor: pointer;
    transition: color 0.3s ease;
}

.logout-btn:hover {
    color: #e53e3e;
}

/* Navigation */
.dashboard-nav {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: #9146ff;
    color: white;
}

.nav-btn i {
    font-size: 1.1em;
}

/* Content */
.dashboard-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Stats Tab */
.stats-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.stats-container h2 {
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 1.5em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
}

.stat-card:not(.primary) .stat-icon {
    background: #f7fafc;
    color: #667eea;
}

.stat-card.primary .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-content h3 {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-content p {
    opacity: 0.8;
    font-size: 0.9em;
}

.stats-info {
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.stats-info p {
    color: #4a5568;
    margin: 0;
    font-size: 0.9em;
}

.stats-info i {
    color: #667eea;
    margin-right: 8px;
}

/* Leaderboard Tab */
.leaderboard-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.leaderboard-container h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.last-updated {
    color: #718096;
    font-size: 0.9em;
}

.refresh-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #5a67d8;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

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

.leaderboard-item.rank-1 {
    border-left: 4px solid #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
}

.leaderboard-item.rank-2 {
    border-left: 4px solid #c0c0c0;
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), rgba(169, 169, 169, 0.1));
}

.leaderboard-item.rank-3 {
    border-left: 4px solid #cd7f32;
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), rgba(184, 115, 51, 0.1));
}

.rank {
    font-size: 1.5em;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    color: #667eea;
}

.rank-1 .rank::after { content: '👑'; margin-left: 5px; }
.rank-2 .rank::after { content: '🥈'; margin-left: 5px; }
.rank-3 .rank::after { content: '🥉'; margin-left: 5px; }

.user-info {
    flex: 1;
}

.user-info .username {
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 2px;
}

.user-info .display-name {
    color: #718096;
    font-size: 0.9em;
}

.points {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

/* Winners Tab */
.winners-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.winners-container h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.winner-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.winner-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.winner-rank.rank-1 { background: #ffd700; }
.winner-rank.rank-2 { background: #c0c0c0; }
.winner-rank.rank-3 { background: #cd7f32; }

.winner-info {
    flex: 1;
}

.winner-month {
    color: #718096;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.winner-name {
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 2px;
}

.winner-points {
    color: #667eea;
    font-weight: 600;
}

/* Admin Tab */
.admin-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.admin-container h2 {
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 1.5em;
}

.admin-sections {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.admin-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.admin-section h3 {
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-section h3 i {
    color: #667eea;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 500;
    color: #4a5568;
}

.form-group input {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.9em;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-warning {
    background: #ed8936;
    color: white;
}

.btn-warning:hover {
    background: #dd6b20;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.month-end-info {
    margin-bottom: 20px;
}

.month-end-info p {
    color: #4a5568;
    margin-bottom: 15px;
}

.user-select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 10px;
}

.user-select-item input[type="checkbox"] {
    margin: 0;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

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

.toast.success {
    border-left: 4px solid #48bb78;
}

.toast.error {
    border-left: 4px solid #f56565;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.2em;
}

.toast.success .toast-icon {
    color: #48bb78;
}

.toast.error .toast-icon {
    color: #f56565;
}

.toast-message {
    color: #2d3748;
    font-weight: 500;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.loading i {
    font-size: 2em;
    margin-bottom: 10px;
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .dashboard-nav {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .leaderboard-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .admin-form {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .login-container {
        margin: 50px 20px;
        padding: 30px 20px;
    }
    
    .dashboard-content {
        padding: 10px;
    }
    
    .stats-container,
    .leaderboard-container,
    .winners-container,
    .admin-container {
        padding: 20px;
    }
}
