/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.logo-text h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.tagline {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 40px 0;
}

/* Control Panel */
.control-panel {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.control-panel h2 {
    color: #444;
    margin-bottom: 20px;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

.spreadsheet-info {
    margin-top: 20px;
    padding: 15px;
    background: #f0f9ff;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
}

.spreadsheet-info i {
    color: #3b82f6;
    margin-right: 10px;
}

/* Leaderboard Section */
.leaderboard-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #444;
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-info .badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Rankings Summary */
.rankings-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.rank-card {
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.rank-card:hover {
    transform: translateY(-5px);
}

.rank-card.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: white;
}

.rank-card.silver {
    background: linear-gradient(135deg, #94a3b8 0%, #475569 100%);
    color: white;
}

.rank-card.bronze {
    background: linear-gradient(135deg, #f59e0b 0%, #92400e 100%);
    color: white;
}

.rank-medal {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.rank-info h3 {
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.rank-score {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 5px;
}

.rank-name {
    font-size: 16px;
    opacity: 0.9;
}

/* Leaderboard Table */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 30px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.leaderboard-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.leaderboard-table th {
    color: white;
    padding: 20px;
    text-align: left;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid #e5e7eb;
}

.leaderboard-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.leaderboard-table tbody tr:hover {
    background-color: #f0f9ff;
    transform: translateX(5px);
}

.leaderboard-table td {
    padding: 20px;
    font-size: 16px;
    color: #4b5563;
}

.leaderboard-table td:first-child {
    font-weight: 700;
    font-size: 18px;
    color: #1f2937;
}

.rank-1 td:first-child {
    color: #fbbf24;
    font-size: 24px;
}

.rank-2 td:first-child {
    color: #94a3b8;
    font-size: 22px;
}

.rank-3 td:first-child {
    color: #f59e0b;
    font-size: 20px;
}

.score-cell {
    font-weight: 700;
    font-size: 18px;
    color: #059669;
}

.notebook-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.notebook-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.notebook-btn.disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.notebook-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

/* Empty State */
.no-data td {
    padding: 60px 20px;
    text-align: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #6b7280;
}

.empty-state i {
    font-size: 48px;
    color: #9ca3af;
}

.empty-state h3 {
    font-size: 20px;
    color: #4b5563;
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 32px;
    color: #1f2937;
    margin-bottom: 5px;
    font-weight: 700;
}

.stat-card p {
    color: #6b7280;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 0;
    text-align: center;
    margin-top: 40px;
}

.footer p {
    color: #6b7280;
    margin-bottom: 10px;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    margin: 0 10px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #764ba2;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #ef4444;
}

.modal-icon {
    font-size: 64px;
    color: #f59e0b;
    margin-bottom: 20px;
}

.modal-content h3 {
    color: #1f2937;
    margin-bottom: 15px;
    font-size: 24px;
}

.modal-content p {
    color: #6b7280;
    margin-bottom: 25px;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo-container {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 8px;
        font-size: 14px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .modal-content {
        margin: 20% auto;
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .rankings-summary {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }
}