/* the_data.css - Times Higher Education 2025 rankings layout - Light Theme */

/* Page container constraints specific to THE rankings page */
main.container {
    width: 90%;
    max-width: 1000px;
    /* Restrict width so list items don't stretch too wide */
    margin: 0 auto;
    padding: 24px 0 40px 0;
    /* Match rankings.html top padding */
    box-sizing: border-box;
}

/* Dashboard Page Header - Centered & Premium */
.the-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 32px;
    width: 100%;
}

.the-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #4f46e5;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Outfit', sans-serif;
}

.the-title {
    font-size: clamp(3rem, 8vw, 3.8rem);
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1.15;
    background: linear-gradient(135deg, #0f172a 40%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.the-subtitle {
    font-size: 1.25rem;
    color: #475569;
    margin: 0 auto;
    max-width: 60ch;
    line-height: 1.6;
    font-weight: 400;
}

.rankings-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

/* Control and Filter Bar - Centered & Larger */
.the-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 22px 30px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

.the-search-box {
    position: relative;
    width: 100%;
}

.the-search-box input {
    width: 100%;
    padding: 18px 28px 18px 60px;
    font-size: 18px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    box-sizing: border-box;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.the-search-box input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.search-icon-inside {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 1.4rem;
    margin-right: 12px;
}

.the-controls-right {
    display: flex;
    gap: 16px;
    width: 100%;
}

.the-controls-right select,
.the-controls-right .custom-dropdown {
    flex: 1;
    min-width: 0;
}

.the-controls-right select,
.the-controls-right .custom-dropdown-btn {
    padding: 18px 28px;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    background-color: #ffffff;
    color: #334155;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.the-controls-right select:hover,
.the-controls-right .custom-dropdown-btn:hover {
    background-color: #f8fafc;
    border-color: rgba(99, 102, 241, 0.4);
}

.the-controls-right select:focus,
.the-controls-right .custom-dropdown.open .custom-dropdown-btn {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background-color: #ffffff;
}

/* University Cards Overhauled */
.university-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    gap: 20px;
    width: 100%;
}

.university-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.1);
}

/* Card Header */
.university-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 0 16px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    box-sizing: border-box;
    background: transparent;
    border-radius: 0;
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.rank-badge {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.name-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.university-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.details-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
    white-space: nowrap;
    flex-shrink: 0;
}

.details-btn i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.details-btn:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.25);
}

.details-btn:hover i {
    transform: translateX(3px);
}

.details-btn:active {
    transform: translateY(0);
}

/* Card Body with Grid Metrics */
.university-card .card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    border-radius: 0;
    border: none;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
    transition: all 0.2s ease;
}

.metric-card:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.metric-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    font-size: 1rem;
}

/* Color Coding for Metric Cards */
.metric-card.students {
    border-left: 3px solid #3b82f6;
}

.metric-card.students .metric-icon-wrapper {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
}

.metric-card.teaching {
    border-left: 3px solid #6366f1;
}

.metric-card.teaching .metric-icon-wrapper {
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
}

.metric-card.research {
    border-left: 3px solid #10b981;
}

.metric-card.research .metric-icon-wrapper {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

.metric-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
}

.metric-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Sidebar Chart and Style Upgrades */
.chart-container-wrapper {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 14px;
    padding: 10px;
    margin: 20px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
    height: 220px;
    width: 100%;
    box-sizing: border-box;
}

/* Sidebar Info List */
.sidebar-info-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding-top: 20px;
}

.sidebar-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.sidebar-info-row span.label {
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
}

.sidebar-info-row span.value {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
}

/* Responsive Overrides */
@media (max-width: 992px) {
    .university-card .card-body {
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .university-card {
        padding: 20px;
        gap: 16px;
    }

    .university-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 12px;
    }

    .card-header-left {
        width: 100%;
    }

    .details-btn {
        width: 100%;
        text-align: center;
    }

    .university-card .card-body {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sidebar-container {
        width: 100%;
        right: auto;
        height: auto;
        max-height: 70vh;
        bottom: -100%;
        top: auto;
        transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        border-top: 1px solid rgba(148, 163, 184, 0.18);
        border-left: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .sidebar-container.open {
        bottom: 0;
    }
}

@media (max-width: 850px) {
    .the-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .the-search-box {
        flex: none;
        width: 100%;
        max-width: none;
    }

    .the-controls-right {
        width: 100%;
        flex-wrap: nowrap;
        gap: 12px;
    }

    .the-controls-right select,
    .the-controls-right .custom-dropdown {
        flex: 1;
        width: 50%;
        min-width: 0;
    }
}

@media (max-width: 500px) {
    .the-controls-right {
        flex-direction: column;
        gap: 10px;
    }

    .the-controls-right select,
    .the-controls-right .custom-dropdown {
        width: 100%;
        min-width: 100%;
    }
}

/* Dynamic height scaling to prevent overflow on small screens / zoom (Home page logic) */
@media (max-height: 850px) {
    main.container {
        padding: 24px 0 20px 0;
    }

    .the-header {
        margin-bottom: 20px;
        gap: 8px;
    }

    .the-title {
        font-size: 2.9rem;
    }

    .the-subtitle {
        font-size: 1.1rem;
    }

    .the-header-badge {
        padding: 6px 14px;
        font-size: 0.78rem;
    }

    .the-filter-bar {
        padding: 16px 24px;
        margin-bottom: 15px;
        border-radius: 14px;
    }

    .the-search-box input {
        padding: 15px 22px 15px 54px;
        font-size: 16px;
    }

    .search-icon-inside {
        left: 18px;
        font-size: 1.25rem;
    }

    .the-controls-right select,
    .the-controls-right .custom-dropdown {
        min-width: 160px;
    }

    .the-controls-right select,
    .the-controls-right .custom-dropdown-btn {
        padding: 15px 22px;
        font-size: 16px;
    }

    .rankings-list-container {
        gap: 12px;
    }

    .university-card {
        padding: 18px;
        gap: 14px;
        border-radius: 16px;
    }

    .university-card .card-header {
        padding-bottom: 10px;
    }

    .rank-badge {
        padding: 5px 12px;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .university-name {
        font-size: 1.3rem;
    }

    .metric-card {
        padding: 10px 14px;
        gap: 10px;
        border-radius: 10px;
    }

    .metric-icon-wrapper {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    .metric-value {
        font-size: 0.95rem;
    }

    .metric-label {
        font-size: 0.65rem;
    }

    .details-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        border-radius: 20px;
    }

    .chart-container-wrapper {
        height: 180px;
        margin: 12px 0;
        padding: 8px;
    }
}

@media (max-height: 700px) {
    main.container {
        padding: 24px 0 15px 0;
    }

    .the-header {
        margin-bottom: 14px;
        gap: 6px;
    }

    .the-title {
        font-size: 2.4rem;
    }

    .the-subtitle {
        font-size: 0.98rem;
    }

    .the-header-badge {
        padding: 4px 12px;
        font-size: 0.72rem;
    }

    .the-filter-bar {
        padding: 12px 18px;
        margin-bottom: 10px;
        border-radius: 12px;
        gap: 12px;
    }

    .the-search-box input {
        padding: 12px 16px 12px 46px;
        font-size: 15px;
    }

    .search-icon-inside {
        left: 14px;
        font-size: 1.15rem;
    }

    .the-controls-right select,
    .the-controls-right .custom-dropdown {
        min-width: 140px;
    }

    .the-controls-right select,
    .the-controls-right .custom-dropdown-btn {
        padding: 12px 16px;
        font-size: 15px;
    }

    .rankings-list-container {
        gap: 8px;
    }

    .university-card {
        padding: 12px 14px;
        gap: 10px;
        border-radius: 12px;
    }

    .university-card .card-header {
        padding-bottom: 8px;
    }

    .rank-badge {
        padding: 4px 10px;
        font-size: 0.75rem;
        border-radius: 6px;
    }

    .university-name {
        font-size: 1.2rem;
    }

    .metric-card {
        padding: 8px 10px;
        gap: 8px;
        border-radius: 8px;
    }

    .metric-icon-wrapper {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        font-size: 0.8rem;
    }

    .metric-value {
        font-size: 0.85rem;
    }

    .metric-label {
        font-size: 0.6rem;
    }

    .details-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        border-radius: 15px;
    }

    .chart-container-wrapper {
        height: 140px;
        margin: 8px 0;
        padding: 6px;
    }
}

/* Sidebar Tabs & Historical Controls */
.sidebar-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.sidebar-tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    font-weight: 600;
}

.sidebar-tab-btn:hover {
    color: #4f46e5;
}

.tab-content {
    display: none;
}

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

.history-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.history-controls label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.history-controls select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    color: #0f172a;
    background-color: #ffffff;
    cursor: pointer;
}

.history-controls .custom-dropdown-btn {
    padding: 10px 14px;
    font-size: 0.88rem;
    border-radius: 8px;
    font-weight: 600;
}

.history-controls .custom-dropdown-item {
    padding: 8px 14px;
    font-size: 0.82rem;
}