:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --bg-color: #F8FAFC;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --header-bg: rgba(255, 255, 255, 0.9);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #6366F1;
        --primary-hover: #818CF8;
        --bg-color: #0F172A;
        --card-bg: rgba(30, 41, 59, 0.7);
        --text-main: #F1F5F9;
        --text-muted: #94A3B8;
        --border: #334155;
        --header-bg: rgba(15, 23, 42, 0.9);
    }
}

:root[data-theme="dark"] {
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --bg-color: #0F172A;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border: #334155;
    --header-bg: rgba(15, 23, 42, 0.9);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;

    /* Subtle grain/mesh background */
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-fluid {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-main);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.025em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.23);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Header */
.main-header {
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    text-decoration: none;
    margin-right: 4.5rem;
    /* Large space for better balance */
}

.logo-wrapper {
    display: inline-flex;
    flex-direction: column;
    line-height: 0.9;
}

.logo-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
}

.logo-top i {
    color: var(--primary);
    font-size: 1.6rem;
    width: 1.8rem;
    text-align: center;
}

.logo-bottom {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    margin-top: -1px;
    /* Slightly closer for tighter look */
    padding-left: 0;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.logo-bottom span {
    display: inline-block;
}

.sub-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    backdrop-filter: blur(10px);
    z-index: 99;
}

.top-nav-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.4rem;
    /* Reduced from 0.5rem */
}

.top-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.1rem;
    /* Reduced padding from 0.4rem */
    text-decoration: none;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    text-align: center;
    gap: 0.4rem;
}

.top-card .card-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.top-card .card-label {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.top-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.top-card:hover .card-icon {
    color: var(--primary);
}

.top-card.active {
    background: var(--primary);
    border-color: var(--primary);
}

.top-card.active .card-icon,
.top-card.active .card-label {
    color: white;
}

/* Sub-header Responsive */
@media (max-width: 1200px) {
    .top-nav-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 600px) {
    .top-nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sub-header {
        position: static;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-box {
    position: relative;
}

.search-box input {
    background: var(--bg-color);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 2rem;
    color: var(--text-main);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
    width: 200px;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}

/* Layout */
.main-content {
    flex: 1;
    padding: 3rem 1.5rem;
    /* Added 1.5rem horizontal padding */
}

/* Cards (Glassmorphism) */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

/* Feature Cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.feature-card {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    height: 100%;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.04);
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), #818CF8);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.4);
}

.feature-card h3 {
    margin: 0.5rem 0 0.25rem;
    font-size: 1.25rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    flex: 1;
}

.feature-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary);
    margin-top: 1rem;
}

.feature-link i {
    transition: transform 0.2s;
}

.feature-card:hover .feature-link i {
    transform: translateX(4px);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0 5rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Hero Search */
.hero-search {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.hero-search input {
    width: 100%;
    padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    font-size: 1.125rem;
    border: 1px solid var(--border);
    border-radius: 3rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    color: var(--text-main);
    box-shadow: var(--shadow-lg);
    outline: none;
    transition: all 0.3s;
}

.hero-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15), var(--shadow-lg);
}

.hero-search i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* Filters */
.filters-bar {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.filter-group select,
.filter-group input[type="text"] {
    background: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.filter-group select {
    padding-right: 2rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1em;
    cursor: pointer;
}

.filter-group input[type="text"] {
    min-width: 220px;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background-color: white;
}

[data-theme="dark"] .filter-group select:focus,
[data-theme="dark"] .filter-group input[type="text"]:focus {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Input with Icon inside filter group */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: color 0.2s;
}

.input-icon-wrapper input,
.input-icon-wrapper select {
    padding-left: 2.25rem !important;
}

.input-icon-wrapper:focus-within i {
    color: var(--primary);
}

/* Tables */
.table-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.table-responsive {
    overflow-x: auto;
    position: relative;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

th {
    background: var(--bg-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    background: inherit;
}

/* Keep sticky columns as they are essential for mobile usability on wide tables */
.table-sticky-cols th:first-child,
.table-sticky-cols td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--bg-color);
}

.table-sticky-cols th:nth-child(2),
.table-sticky-cols td:nth-child(2) {
    position: sticky;
    left: 4.5rem;
    z-index: 5;
    background: var(--bg-color);
    border-right: 1px solid var(--border);
}

.table-sticky-cols th:first-child,
.table-sticky-cols th:nth-child(2) {
    z-index: 10;
}

tbody tr:hover {
    background: rgba(79, 70, 229, 0.03);
}

.badge-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.875rem;
}

.badge-grade.low {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.badge-grade.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
}

.rank-1 {
    background: #FEF08A;
    border-color: #EAB308;
    color: #854D0E;
}

.rank-2 {
    background: #E2E8F0;
    border-color: #CBD5E1;
    color: #475569;
}

.rank-3 {
    background: #FFEDD5;
    border-color: #FDBA74;
    color: #9A3412;
}

/* School Detail */
.school-header {
    margin-bottom: 3rem;
}

.school-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.school-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Contact Cards */
.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.contact-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.08);
}

.contact-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.contact-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.contact-card-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
}

.contact-card-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .contact-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* Footer */
.main-footer {
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    padding: 4rem 0 0;
    margin-top: auto;
}

.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-desc {
    color: var(--text-muted);
    margin-top: 1rem;
    max-width: 300px;
}

.footer-col h4 {
    margin-bottom: 1.5rem;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-col a {
    color: var(--text-muted);
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 2rem;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    color: var(--text-main);
    background: var(--card-bg);
    font-weight: 500;
}

.page-link:hover,
.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Loading & Skeleton */
.loading-overlay-container {
    position: relative;
    min-height: 400px;
}

.skeleton-blur {
    filter: blur(8px);
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.loading-overlay {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    padding: 2rem 4rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    text-align: center;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-overlay i {
    font-size: 2.5rem;
    color: var(--primary);
}

.loading-overlay p {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

/* Comments Section */
.comments-section {
    margin-top: 4rem;
}

.comment-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.comment-card:last-child {
    border-bottom: none;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.comment-content h5 {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-date {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    color: var(--text-main);
}

.comment-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-main);
    resize: vertical;
    min-height: 100px;
    margin-bottom: 1rem;
    font-family: inherit;
    outline: none;
}

.comment-form textarea:focus {
    border-color: var(--primary);
}

/* Responsive fixes for large menu */
@media (max-width: 1200px) {

    .main-nav,
    .search-box,
    .auth-buttons span {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .header-actions {
        gap: 1.25rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Stats grid responsive — nu ocupa toata latimea */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Social & Conversion */
.social-share-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s;
    color: white !important;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.share-fb {
    background: #1877F2;
}

.share-wa {
    background: #25D366;
}

.share-ms {
    background: #0084FF;
}

.share-link {
    background: var(--text-muted);
}

.share-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: var(--shadow-md);
}

.conversion-banner {
    background: linear-gradient(135deg, var(--primary), #818CF8);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
}

.conversion-banner h3 {
    color: white !important;
    margin-bottom: 0.25rem;
    border-bottom: none;
}

.conversion-banner p {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.95rem;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .conversion-banner {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
}