@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-darker: #070a12;
    --glass-bg: rgba(17, 24, 39, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --accent: #22d3ee;
    --accent-glow: rgba(34, 211, 238, 0.15);
    
    --gold: #f59e0b;
    --silver: #94a3b8;
    --bronze: #b45309;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(34, 211, 238, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* Header & Banner */
.app-header {
    background: rgba(7, 10, 18, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.logo img {
    height: 36px;
    object-fit: contain;
}

.logo span {
    background: linear-gradient(135deg, #a5b4fc 0%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border: none;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn.primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    opacity: 0.95;
}

/* Page Layout */
.container {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 20px;
}

/* Hero Section */
.hero-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(13, 18, 30, 0.9) 100%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: var(--primary-glow);
    filter: blur(80px);
    border-radius: 50%;
    pointer-events: none;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 650px;
}

/* Round Tabs Navigation */
.tabs-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 4px;
    background: var(--bg-darker);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 1;
    min-width: 140px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-align: center;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Leaderboard Contents Wrapper */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Podium Section */
.podium-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 40px;
    padding: 20px 0 10px 0;
}

.podium-card {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.6) 0%, rgba(7, 10, 18, 0.8) 100%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 280px;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    transition: var(--transition);
    cursor: pointer;
}

.podium-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.15);
}

/* Specific heights and order for podium */
.podium-card.second {
    order: 1;
    height: 280px;
    justify-content: flex-end;
}

.podium-card.first {
    order: 2;
    height: 320px;
    justify-content: flex-end;
    border-color: rgba(245, 158, 11, 0.3);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, rgba(7, 10, 18, 0.85) 100%);
}

.podium-card.third {
    order: 3;
    height: 250px;
    justify-content: flex-end;
}

.podium-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    position: absolute;
    top: -18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.first .podium-badge {
    background: var(--gold);
    color: #000;
}

.second .podium-badge {
    background: var(--silver);
    color: #000;
}

.third .podium-badge {
    background: var(--bronze);
    color: #fff;
}

.podium-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.first .podium-avatar {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.podium-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.podium-school {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.podium-score {
    background: var(--bg-darker);
    border: 1px solid var(--glass-border);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
}

.first .podium-score {
    color: var(--gold);
}

/* Personal Standing Motivation Box */
.motivate-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(34, 211, 238, 0.05) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.motivate-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.motivate-text {
    font-size: 14px;
    color: var(--text-primary);
}

.motivate-text b {
    color: var(--accent);
}

/* Interactive Search/Find Widget */
.search-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.search-box-container {
    flex: 2;
    position: relative;
}

.search-box-container svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-field {
    width: 100%;
    background: var(--bg-darker);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 14px 16px 14px 44px;
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99,102,241,0.25);
}

.find-my-rank-box {
    flex: 1.5;
    display: flex;
    gap: 8px;
}

.find-my-rank-box .input-field {
    padding-left: 16px;
}

/* Grid & Table */
.table-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.table-responsive {
    max-height: 550px;
    overflow-y: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leaderboard-table th {
    background: var(--bg-darker);
    padding: 16px 24px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.leaderboard-table tr {
    cursor: pointer;
    transition: var(--transition);
}

.leaderboard-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.leaderboard-table tr.highlight-student td {
    background: rgba(34, 211, 238, 0.05);
    border-top: 1px solid rgba(34, 211, 238, 0.2);
    border-bottom: 1px solid rgba(34, 211, 238, 0.2);
}

.leaderboard-table tr.highlight-student td:first-child {
    border-left: 3px solid var(--accent);
}

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.rank-badge.rank-1 {
    background: var(--gold);
    color: #000;
}

.rank-badge.rank-2 {
    background: var(--silver);
    color: #000;
}

.rank-badge.rank-3 {
    background: var(--bronze);
    color: #fff;
}

.student-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
}

.student-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.student-school {
    font-size: 12px;
    color: var(--text-secondary);
}

.score-col {
    font-weight: 800;
    font-size: 15px;
    text-align: right;
    color: var(--accent);
}

.score-col.overall-pts {
    color: var(--text-primary);
}

.completed-col {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Modal Popup Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #0d1322;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.modal-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}

/* Scorecard Breakdown Matrix */
.matrix-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 12px;
}

.matrix-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.matrix-row {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding-bottom: 8px;
}

.matrix-round-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.matrix-round-pts {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 14px;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 10px;
    border-radius: 12px;
}

.matrix-papers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.paper-block {
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.paper-block-title {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.paper-block-marks {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.mark-cell span {
    color: var(--text-secondary);
}

.mark-cell b {
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive details */
@media(max-width: 768px) {
    .podium-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .podium-card {
        width: 100%;
        height: auto !important;
    }
    .podium-card.first, .podium-card.second, .podium-card.third {
        order: unset;
        justify-content: center;
        padding: 16px;
    }
    .podium-badge {
        position: relative;
        top: 0;
        margin-bottom: 8px;
    }
    .search-controls {
        flex-direction: column;
    }
    .hide-mobile {
        display: none;
    }
}
