/* Modern UI Variables */
:root {
    --glass-bg-light: rgba(255, 255, 255, 0.7);
    --glass-border-light: rgba(255, 255, 255, 0.5);
    --glass-shadow-light: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    
    --glass-bg-dark: rgba(20, 20, 22, 0.7);
    --glass-border-dark: rgba(255, 255, 255, 0.08);
    --glass-shadow-dark: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    --primary-gradient: linear-gradient(135deg, #3772ff 0%, #9757D7 100%);
    --secondary-gradient: linear-gradient(135deg, #45B26B 0%, #3772ff 100%);
    
    --font-heading: 'DM Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Background Mesh Gradient - Light Mode */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 50%, rgba(55, 114, 255, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(151, 87, 215, 0.08), transparent 25%);
    z-index: -1;
    pointer-events: none;
}

/* Background Mesh Gradient - Dark Mode */
.is_dark::before {
    background: 
        radial-gradient(circle at 15% 50%, rgba(55, 114, 255, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(151, 87, 215, 0.05), transparent 25%);
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border-light);
    box-shadow: var(--glass-shadow-light);
    border-radius: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.is_dark .glass-card {
    background: var(--glass-bg-dark);
    border: 1px solid var(--glass-border-dark);
    box-shadow: var(--glass-shadow-dark);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

.is_dark .glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Modern Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

body {
    font-family: var(--font-body);
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-large {
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.2;
    overflow-wrap: break-word; /* Prevent overflow */
    word-break: break-word;
}

/* Responsive Institution Name */
.glass-card h6:not(.text-secondary):not(.fs-12) {
    font-size: clamp(0.9rem, 2.5vw, 1.25rem);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modern Table */
.modern-table {
    border-collapse: separate;
    border-spacing: 0 8px;
    width: 100%;
}

.modern-table thead th {
    border: none;
    padding: 16px 24px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: transparent;
}

.is_dark .modern-table thead th {
    color: rgba(255, 255, 255, 0.7);
}

.modern-table tbody tr {
    background: var(--glass-bg-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 12px;
}

.modern-table tbody tr td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.modern-table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.is_dark .modern-table tbody tr {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.modern-table tbody tr:hover {
    transform: scale(1.005);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    z-index: 1;
    position: relative;
}

.is_dark .modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

.modern-table td {
    padding: 16px 24px;
    vertical-align: middle;
    border: none;
    font-size: 0.95rem;
    color: var(--text);
}

.is_dark .modern-table td {
    color: rgba(255, 255, 255, 0.9);
}

/* Sortable Headers */
.modern-table thead th[data-sort] {
    cursor: pointer;
    position: relative;
    padding-right: 30px; /* Space for arrow */
}

.modern-table thead th[data-sort]::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; 
    height: 0; 
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.2); /* Defalt Down Arrow */
    opacity: 0.3;
    transition: opacity 0.2s;
}

.is_dark .modern-table thead th[data-sort]::after {
    border-top-color: rgba(255, 255, 255, 0.3);
}

.modern-table thead th[data-sort]:hover::after {
    opacity: 0.7;
}

.modern-table thead th[data-sort].sort-asc::after {
    border-top: none;
    border-bottom: 5px solid var(--primary-color, #3772ff); /* Up Arrow */
    opacity: 1;
}

.modern-table thead th[data-sort].sort-desc::after {
    border-top: 5px solid var(--primary-color, #3772ff); /* Down Arrow */
    border-bottom: none;
    opacity: 1;
}

.institution-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Modern Buttons */
.btn-modern {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(55, 114, 255, 0.3);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(55, 114, 255, 0.4);
    color: white;
}

/* Header Improvements */
.header {
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.is_dark .header {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Mobile Responsiveness Improvements */
@media (max-width: 768px) {
    /* Hide Header */
    .modern-table thead {
        display: none !important;
    }

    /* Hide Star Column (1st) and Date Column (5th) */
    .modern-table td:first-child,
    .modern-table td:nth-child(5) {
        display: none !important;
    }

    /* Row as Flex Column Container */
    .modern-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        margin-bottom: 16px;
        position: relative !important;
        background: var(--glass-bg-light);
        border: 1px solid var(--glass-border-light);
        border-radius: 16px;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }

    .is_dark .modern-table tbody tr {
        background: var(--glass-bg-dark);
        border-color: var(--glass-border-dark);
    }
    
    /* Cells as Flex Items */
    .modern-table td {
        display: flex !important;
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none !important; /* Remove borders to prevent double lines */
        border-bottom: 1px solid rgba(0,0,0,0.05) !important;
        text-align: right;
        height: auto !important;
        min-height: unset !important;
    }

    .is_dark .modern-table td {
        border-bottom-color: rgba(255,255,255,0.05) !important;
    }

    /* Last child (Actions) - Centered Button */
    .modern-table td:last-child {
        border-bottom: none !important;
        justify-content: center;
        padding-top: 16px;
        padding-bottom: 0;
        margin-top: 8px;
    }

    /* Labels via data-label */
    .modern-table td:not(:last-child)::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--text);
        margin-right: auto;
        text-align: left;
        opacity: 0.7;
    }

    /* Institution Name (2nd column) - Prominent Header */
    .modern-table td:nth-child(2) {
        font-size: 1.1rem;
        font-weight: 700;
        padding-bottom: 12px;
        border-bottom: 2px solid rgba(0,0,0,0.05) !important;
        margin-bottom: 8px;
        color: var(--onsurface) !important;
    }

    .is_dark .modern-table td:nth-child(2) {
        border-bottom-color: rgba(255,255,255,0.05) !important;
        color: #fff !important;
    }


    .modern-table td:nth-child(2)::before {
        display: none; /* Hide label */
    }
}
