:root {
    /* Color Palette */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --accent-color: #14b8a6;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    --gradient-accent: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(20, 184, 166, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 20s ease infinite;
}

@keyframes backgroundShift {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-content p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
.header {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.6s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.header-stats {
    display: flex;
    gap: 16px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Section */
.search-section {
    animation: slideUp 0.6s ease 0.2s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all var(--transition-normal);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.clear-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.clear-btn svg {
    width: 18px;
    height: 18px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-label svg {
    width: 16px;
    height: 16px;
}

.filter-group select {
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.refresh-btn {
    padding: 14px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn svg {
    width: 18px;
    height: 18px;
    animation: none;
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

/* Metro UI Tiles Section */
.tiles-section {
    animation: slideUp 0.6s ease 0.2s both;
    margin-bottom: 24px;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-muted);
    font-size: 16px;
}

.tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 8px;
}

.class-tile {
    aspect-ratio: 1;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: tileAppear 0.5s ease both;
}

@keyframes tileAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Gradient backgrounds for tiles */
.class-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 0;
}

.class-tile:nth-child(6n+1)::before {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
}

.class-tile:nth-child(6n+2)::before {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(244, 63, 94, 0.2) 100%);
}

.class-tile:nth-child(6n+3)::before {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%);
}

.class-tile:nth-child(6n+4)::before {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(251, 146, 60, 0.2) 100%);
}

.class-tile:nth-child(6n+5)::before {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
}

.class-tile:nth-child(6n+6)::before {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%);
}

.class-tile:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.class-tile:hover::before {
    opacity: 1;
}

.class-tile:active {
    transform: translateY(-4px) scale(1.01);
}

.tile-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.tile-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tile-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.tile-class-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.tile-student-count {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tile-student-count svg {
    width: 16px;
    height: 16px;
}

.tile-count-number {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

/* Class Header (Table View) */
.class-header {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    animation: slideDown 0.6s ease;
}

.back-btn {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-normal);
}

.back-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateX(-4px);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.selected-class-name {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}


/* Table Section */
.table-section {
    animation: slideUp 0.6s ease 0.4s both;
}

.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

thead tr {
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

tbody tr:hover {
    background: var(--bg-secondary);
    transform: scale(1.01);
}

td {
    padding: 16px;
    color: var(--text-primary);
    font-size: 14px;
}

td:first-child {
    font-weight: 600;
    color: var(--text-muted);
}

td:nth-child(2) {
    font-family: 'Courier New', monospace;
    color: var(--primary-light);
}

td:nth-child(3) {
    font-weight: 500;
}

td:nth-child(4) {
    color: var(--accent-color);
    font-weight: 500;
}

td:nth-child(5) {
    font-weight: 500;
}

/* Gender Badge */
td:nth-child(5)::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

tr[data-gender="L"] td:nth-child(5)::before {
    background: #3b82f6;
}

tr[data-gender="P"] td:nth-child(5)::before {
    background: #ec4899;
}

/* Empty State */
.empty-state,
.error-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state svg,
.error-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3,
.error-state h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p,
.error-state p {
    color: var(--text-muted);
    font-size: 14px;
}

.retry-btn {
    margin-top: 24px;
    padding: 12px 32px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Footer */
.footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-muted);
    font-size: 14px;
    animation: fadeIn 0.6s ease 0.6s both;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .header {
        padding: 24px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 24px;
    }

    .header-stats {
        width: 100%;
        justify-content: space-between;
    }

    .stat-card {
        flex: 1;
        min-width: auto;
    }

    .search-container {
        padding: 16px;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-group {
        width: 100%;
    }

    .refresh-btn {
        width: 100%;
        justify-content: center;
    }

    .table-container {
        padding: 16px;
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    th,
    td {
        padding: 12px 8px;
        font-size: 13px;
    }

    /* Tiles responsive */
    .tiles-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .class-tile {
        aspect-ratio: auto;
        min-height: 140px;
    }

    .section-header h2 {
        font-size: 24px;
    }

    .class-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .back-btn {
        width: 100%;
        justify-content: center;
    }

    .selected-class-name {
        font-size: 20px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}