:root {
    --primary-color: #0d6efd;
    --secondary-bg: #f8f9fa;
    --deadline-color: #dc3545;
    /* Red for deadlines */
    --exam-color: #0d6efd;
    /* Blue for exams */
}

/* Fix modal z-index stacking: both modals need to appear above their backdrops */
/* Bootstrap's default modal backdrop z-index is 1050, modal is 1055 */
/* Stacking order: backdrop (1050) < calendarGridModal (1070) < collegeModal backdrop (1075) < collegeModal (1080) */

#calendarGridModal {
    z-index: 1070 !important;
}

#collegeModal {
    z-index: 1080 !important;
}

/* When collegeModal is visible, raise its backdrop above calendarGridModal */
#collegeModal.show~.modal-backdrop {
    z-index: 1075 !important;
}

body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero-section,
.bg-gradient {
    background: linear-gradient(135deg, #0056b3, #0d6efd);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-pills {
    background-color: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    /* Removed width: 100% to allow flex alignment with calendar buttons */
}

.nav-pills .nav-link {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border: 1px solid #e9ecef;
    margin: 0 5px;
    flex-grow: 1;
    transition: all 0.3s ease;
}

.nav-pills .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
    transform: translateY(-1px);
}



.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: visible;
    margin-bottom: 20px;
    position: relative;
}

.table thead {
    background-color: #212529;
    color: white;
}

.table th {
    padding: 15px;
    white-space: nowrap;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    padding: 15px;
    vertical-align: middle;
}

.college-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px dashed var(--primary-color);
}

.college-link:hover {
    color: #004085;
    border-bottom: 1px solid #004085;
}

.badge-mode-center {
    background-color: #ffc107;
    color: #000;
}

.badge-mode-home {
    background-color: #198754;
    color: white;
}

.badge-mode-offline {
    background-color: #dc3545;
    color: white;
}

.badge-mode-merit {
    background-color: #6610f2;
    color: white;
}

.badge-mode-online {
    background-color: #198754;
    color: white;
}

.badge-mode-paper {
    background-color: #dc3545;
    color: white;
}

.badge-nirf {
    background-color: #6610f2;
    color: white;
    font-size: 0.75rem;
    vertical-align: middle;
    margin-left: 5px;
}

.search-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto 30px auto;
}

.search-box {
    width: 100%;
    margin: 0;
    border-radius: 50px;
    padding: 12px 45px 12px 25px;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.3s;
}

.search-box:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

body.searching .nav-pills {
    display: none !important;
}

body.searching .tab-content .tab-pane {
    display: block !important;
    opacity: 1 !important;
    margin-bottom: 40px;
}

body.searching .category-header {
    display: block !important;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.category-header {
    display: none;
}

.tab-pane.active .category-header {
    display: block;
}

.footer-section {
    background-color: #212529;
    color: #adb5bd;
    padding: 60px 0 30px;
    margin-top: auto;
    border-top: 4px solid var(--primary-color);
}

.footer-section h5 {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.contact-link {
    color: #fff;
    /* Keeping for backward compat if used elsewhere, though mostly replaced */
    text-decoration: none;
    font-weight: bold;
}

.disclaimer-section {
    background-color: #e9ecef;
    padding: 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #495057;
    margin-top: 30px;
}

.mobile-scroll-hint {
    display: none;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 8px;
    text-align: right;
    animation: pulse-animation 2s infinite;
}

@media (max-width: 768px) {
    .mobile-scroll-hint {
        display: block;
    }

    .table-responsive {
        background:
            linear-gradient(to right, white 30%, rgba(255, 255, 255, 0)),
            linear-gradient(to right, rgba(255, 255, 255, 0), white 70%) 0 100%,
            radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)),
            radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)) 0 100%;
        background-repeat: no-repeat;
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-position: 0 0, 100% 0, 0 0, 100% 0;
        background-attachment: local, local, scroll, scroll;
    }

    /* Category tabs now scroll horizontally on mobile */
    .nav-pills {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 6px;
        padding: 6px 8px;
        width: 100%;
    }

    .nav-pills::-webkit-scrollbar {
        display: none;
    }

    .nav-pills .nav-item {
        flex-shrink: 0;
        margin: 0;
    }

    .nav-pills .nav-link {
        font-size: 0.8rem;
        padding: 8px 12px;
        white-space: nowrap;
        margin: 0;
    }

    .hero-section {
        padding: 2rem 0;
    }

    .display-5 {
        font-size: 2rem;
    }
}

@keyframes pulse-animation {
    0% {
        opacity: 0.6;
        transform: translateX(0);
    }

    50% {
        opacity: 1;
        transform: translateX(-5px);
    }

    100% {
        opacity: 0.6;
        transform: translateX(0);
    }
}

/* --- NEW FEATURE STYLES --- */



/* Favorite Row Highlighting */
.favorite-row {
    background-color: #fff8e1 !important;
    /* Gentle yellow tint */
}

.favorite-row:hover {
    background-color: #ffecb3 !important;
}

/* Favorite Button */
.fav-btn {
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.fav-btn:hover {
    transform: scale(1.2);
}



/* Filter Chips */
.filter-chip {
    transition: all 0.2s ease-in-out;
    border-width: 1px;
}

.filter-chip.active {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Ring utilities if not in bootstrap 5 */
.ring-2 {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* --- MOBILE STREAM DRAWER STYLES --- */

/* Hide mobile header on desktop, show stream selector normally */
.stream-header-mobile {
    display: none;
}

.stream-drawer {
    margin-bottom: 1rem;
}

.stream-drawer-content {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Filter scroll container - default desktop layout */
.filter-scroll-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-scroll-track {
    display: contents;
}

/* Mobile-specific styles */
@media (max-width: 768px) {

    /* Mobile Stream Header (collapsed) - HIDDEN now */
    .stream-header-mobile {
        display: none !important;
    }

    /* Stream Drawer (Always visible, horizontal scroll) */
    .stream-drawer {
        /* Reset drawer styles */
        max-height: none;
        opacity: 1;
        margin-bottom: 1rem;
        display: block;
        overflow: visible;
    }

    .stream-drawer.open {
        /* No change needed, but keep for safety/override */
        max-height: none;
        margin-bottom: 1rem;
    }

    .stream-drawer-content {
        display: flex;
        flex-wrap: nowrap;
        /* Force single line */
        overflow-x: auto;
        gap: 8px;
        padding: 5px 0;
        /* Minimized vertical padding */
        background: transparent;
        /* Remove card look */
        box-shadow: none;
        /* Remove shadow */
        border: none;
        margin-top: 0;
        grid-template-columns: none;
        /* Override grid */
        justify-content: flex-start;
        /* Fix "Engineering" visibility */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
    }

    .stream-drawer-content::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .stream-drawer-content .stream-btn {
        flex-shrink: 0;
        /* Prevent shrinking */
        font-size: 0.8rem;
        padding: 8px 16px;
        white-space: nowrap;
        min-height: auto;
        /* Reset min-height */
        border-radius: 20px;
        /* Pill shape */
        flex-direction: row;
        /* Horizontal icon + text */
        display: inline-flex;
        align-items: center;
        background-color: white;
        border: 1px solid #dee2e6;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .stream-drawer-content .stream-btn.active {
        background-color: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
        box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25);
    }

    .stream-drawer-content .stream-btn i {
        display: inline-block;
        font-size: 1rem;
        margin-bottom: 0;
        margin-right: 6px !important;
    }

    /* Horizontal Scroll Filter Chips - VISIBLE on mobile now */
    .filter-scroll-container {
        display: flex;
        /* Ensure flex context */
        flex-wrap: nowrap;
        /* Force single line */
        overflow-x: auto;
        /* Override default mobile hidden */
        margin-bottom: 10px;
        justify-content: flex-start;
        /* Align left */
    }

    .filter-scroll-container::before,
    .filter-scroll-container::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 15px;
        /* Decrease fade width */
        pointer-events: none;
        z-index: 1;
    }

    /* Adjust track for mobile */
    .filter-scroll-track {
        display: flex;
        flex-wrap: nowrap;
        padding: 4px 0;
        /* Remove horizontal padding used for fade effect trigger */
        gap: 8px;
    }

    .filter-scroll-track .filter-chip {
        flex-shrink: 0;
        /* Force no shrink/wrap */
        font-size: 0.75rem;
        padding: 6px 14px;
        white-space: nowrap;
        border-radius: 20px !important;
        /* Uniform shape with stream buttons */
    }


    /* nav-pills horizontal scroll styles moved to earlier @media block */
}

/* --- INLINE FILTER TOGGLE STYLES --- */
/* Completely hide the inline filter toggle on mobile since we have the top bar back */
.inline-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .inline-filter-wrapper {
        display: none !important;
        /* Hide the filter button inside the card */
    }
}

/* --- MOBILE CATEGORY DROPDOWN STYLES --- */

/* Hide mobile category header on desktop */
.category-header-mobile {
    display: none;
}

.category-drawer {
    display: none;
}

/* Mobile-specific category dropdown */
@media (max-width: 768px) {

    /* Hide original nav-pills on mobile */
    .nav-pills {
        display: none !important;
    }

    /* Show mobile category header - HIDDEN now */
    .category-header-mobile {
        display: none !important;
    }

    /* Category Drawer (Always visible, horizontal scroll) */
    .category-drawer {
        display: block;
        max-height: none;
        overflow: visible;
        opacity: 1;
        margin-bottom: 0.75rem;
    }

    .category-drawer.open {
        max-height: none;
    }

    .category-drawer-content {
        display: flex;
        flex-direction: row;
        /* Horizontal */
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding: 0;
        /* Minimal padding */
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        margin-top: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .category-drawer-content::-webkit-scrollbar {
        display: none;
    }

    .category-drawer-content .category-option {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        border-radius: 20px;
        /* Pill */
        border: 1px solid #e9ecef;
        background: white;
        font-size: 0.8rem;
        font-weight: 500;
        color: #495057;
        width: auto;
        /* Auto width */
        margin: 0;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .category-drawer-content .category-option.active {
        background: white;
        /* Keep white bg but colored border/text like tabs usually, or use primary? */
        /* Let's use primary for active state to match streams */
        background: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
        box-shadow: 0 3px 6px rgba(13, 110, 253, 0.2);
    }

    .category-drawer-content .category-option i {
        width: auto;
        text-align: center;
        font-size: 0.9rem;
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    .stream-drawer-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .stream-drawer-content .stream-btn {
        font-size: 0.7rem;
    }
}

/* --- NEWS SECTION STYLES --- */
#newsSection {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.news-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.news-card.important {
    border-left: 4px solid #dc3545;
}

.news-card-header {
    padding: 16px 16px 0 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.news-category-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-category-badge.deadline {
    background-color: #fee2e2;
    color: #dc2626;
}

.news-category-badge.registration {
    background-color: #dbeafe;
    color: #2563eb;
}

.news-category-badge.admit_card {
    background-color: #d1fae5;
    color: #059669;
}

.news-category-badge.result {
    background-color: #fef3c7;
    color: #d97706;
}

.news-category-badge.announcement {
    background-color: #e0e7ff;
    color: #4f46e5;
}

.news-category-badge.counselling {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.news-category-badge.exam_date {
    background-color: #cffafe;
    color: #0891b2;
}

.news-card-body {
    padding: 12px 16px;
    flex-grow: 1;
}

.news-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 8px;
    line-height: 1.4;
}

.news-card-summary {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
    margin-bottom: 0;
}

.news-card-footer {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.news-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #495057;
}

.news-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.news-source-badge.verified {
    background-color: #d1fae5;
    color: #059669;
}

.news-source-badge.verified i {
    color: #059669;
}

.news-date {
    font-size: 0.75rem;
    color: #6c757d;
}

.news-link {
    font-size: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.news-link:hover {
    text-decoration: underline;
}

.news-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.news-empty-state i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #newsSection {
        padding: 1rem;
    }

    .news-card-title {
        font-size: 0.9rem;
    }

    .news-card-summary {
        font-size: 0.8rem;
    }
}

/* --- NEWS ACCORDION STYLES --- */
.news-accordion {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.news-accordion-item {
    border: none;
    border-bottom: 1px solid #e9ecef;
}

.news-accordion-item:last-child {
    border-bottom: none;
}

.news-accordion-item.news-item-important {
    background-color: #fff5f5;
    border-left: 3px solid #dc3545;
}

.news-accordion-btn {
    padding: 14px 16px;
    gap: 12px;
    align-items: center;
    background-color: white;
    font-weight: 500;
}

.news-accordion-btn:not(.collapsed) {
    background-color: #f8f9fa;
    box-shadow: none;
}

.news-accordion-btn:focus {
    box-shadow: none;
    border-color: transparent;
}

.news-accordion-btn .news-category-badge {
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 0.75rem;
}

.news-accordion-btn .news-category-badge i {
    margin: 0;
}

.news-accordion-title {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.4;
    text-align: left;
}

.news-important-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    padding: 3px 8px;
    margin-left: auto;
    margin-right: 8px;
}

.news-accordion-body {
    padding: 16px 20px;
    background-color: #fafbfc;
}

.news-accordion-summary {
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.6;
    margin-bottom: 16px;
}

.news-accordion-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

/* Mobile adjustments for news accordion */
@media (max-width: 768px) {
    .news-accordion-btn {
        padding: 12px 14px;
        gap: 10px;
    }

    .news-accordion-title {
        font-size: 0.85rem;
    }

    .news-accordion-btn .news-category-badge {
        padding: 5px 8px;
        font-size: 0.7rem;
    }

    .news-accordion-summary {
        font-size: 0.85rem;
    }

    .news-accordion-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- NEWS EXAM GROUPING STYLES --- */
.news-exam-group {
    margin-bottom: 1.5rem;
}

.news-exam-group:last-child {
    margin-bottom: 0;
}

.news-exam-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0d6efd 100%);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 10px 10px 0 0;
    margin-top: 0;
}

.news-exam-header i {
    font-size: 0.9rem;
    opacity: 0.9;
}

.news-count-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Inline source and date in accordion header */
.news-meta-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.news-source-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #f0f4f8;
    color: #495057;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.news-source-inline.verified {
    background-color: #d1fae5;
    color: #059669;
}

.news-source-inline i {
    font-size: 0.65rem;
}

.news-date-inline {
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap;
}

/* Adjust accordion button for new layout */
.news-accordion-btn {
    flex-wrap: nowrap;
}

/* Mobile adjustments for grouped news */
@media (max-width: 768px) {
    .news-exam-header {
        font-size: 0.85rem;
        padding: 8px 12px;
        border-radius: 8px 8px 0 0;
    }

    .news-meta-inline {
        display: none;
        /* Hide inline meta on mobile, shown in expanded body */
    }

    .news-exam-group {
        margin-bottom: 1rem;
    }
}

/* --- CALENDAR GRID FEATURE STYLES --- */

/* Calendar Grid Buttons */
.calendar-grid-btn {
    background-color: #1a6b7c;
    color: white;
    border: 2px solid #1a6b7c;
    font-weight: 600;
    transition: all 0.3s ease;
}

.calendar-grid-btn:hover {
    background-color: #145a68;
    border-color: #145a68;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(26, 107, 124, 0.3);
}

.calendar-grid-btn.application-cal-btn {
    background-color: #1a6b7c;
    border-color: #1a6b7c;
}

.calendar-grid-btn.exam-cal-btn {
    background-color: #1a5276;
    border-color: #1a5276;
}

.calendar-grid-btn.exam-cal-btn:hover {
    background-color: #154360;
    border-color: #154360;
}

/* App Open Button - Green */
.calendar-grid-btn.app-open-btn {
    background-color: #28a745;
    border-color: #28a745;
}

.calendar-grid-btn.app-open-btn:hover {
    background-color: #218838;
    border-color: #218838;
}

/* Calendar Grid Modal */
.calendar-grid-modal-header {
    background: linear-gradient(135deg, #1a6b7c 0%, #1a5276 100%);
    border-bottom: none;
}

.calendar-grid-table-wrapper {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: auto;
}

.calendar-grid-thead {
    background-color: #1a6b7c;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.calendar-grid-thead th {
    background-color: #1a6b7c;
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    border: none;
    white-space: nowrap;
}

.calendar-grid-table td {
    padding: 12px 15px;
    vertical-align: middle;
}

.calendar-grid-table tbody tr:hover {
    background-color: #e8f4f8 !important;
}

/* Scrollbar styling for calendar grid */
.calendar-grid-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.calendar-grid-table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.calendar-grid-table-wrapper::-webkit-scrollbar-thumb {
    background: #1a6b7c;
    border-radius: 4px;
}

.calendar-grid-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #145a68;
}

/* Mobile responsiveness for calendar grid */
@media (max-width: 768px) {
    .calendar-grid-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .calendar-grid-table-wrapper {
        max-height: 50vh;
    }

    .calendar-grid-thead th,
    .calendar-grid-table td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}

/* Calendar Buttons Wrapper - next to level tabs */
.calendar-buttons-wrapper {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Calendar Navigation Controls */
.calendar-nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-nav-controls .btn-link {
    color: #1a6b7c;
    font-weight: 600;
    padding: 4px 8px;
}

.calendar-nav-controls .btn-link:hover {
    color: #145a68;
    text-decoration: underline !important;
}

/* Mobile responsiveness for tabs and calendar buttons */
@media (max-width: 768px) {
    .calendar-buttons-wrapper {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}

/* =============================================
   MODERN HEADER DESIGN SYSTEM
   ============================================= */

/* --- SITE HEADER --- */
.site-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0d6efd 50%, #3b82f6 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

/* Header is sticky but no padding needed as it's at the top */

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.02);
    color: #fff;
}

.brand-logo i {
    font-size: 1.8rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e3a5f;
    padding: 6px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.nav-badge i {
    color: #10b981;
}

.main-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 50px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.main-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-2px);
}

.main-nav .nav-link.active {
    background: #fff;
    color: #0d6efd;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Mobile Nav Drawer */
.mobile-nav-drawer {
    display: none;
    background: linear-gradient(135deg, #1e3a5f, #0d6efd);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-nav-drawer.open {
    display: block;
    max-height: 200px;
    padding: 1rem;
}

.mobile-nav-link {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
    }

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

    .mobile-nav-drawer {
        display: none;
    }

    .mobile-nav-drawer.open {
        display: block;
    }
}

/* --- HERO SECTION --- */
.hero-section {
    background: linear-gradient(135deg, #0056b3 0%, #0d6efd 50%, #3b82f6 100%);
    color: white;
    padding: 1.5rem 0 1rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
    font-weight: 400;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e3a5f;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero-badge i {
    color: #10b981;
}

@media (max-width: 768px) {
    .site-header {
        padding: 0.25rem 0;
        /* Ultra compact header */
    }

    .brand-logo {
        font-size: 1.25rem;
    }

    .brand-logo i {
        font-size: 1.4rem;
        padding: 6px;
    }

    .hero-section {
        padding: 0.25rem 0 0.1rem;
        /* Ultra compact hero */
        min-height: auto;
    }

    .hero-title {
        font-size: 1.15rem;
        margin-bottom: 0.1rem;
    }

    .hero-subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .hero-badge {
        display: none;
        /* Hide badge to save vertical space */
    }
}

/* --- SEARCH SECTION --- */
.search-section {
    margin: -30px auto 25px;
    max-width: 600px;
    position: relative;
    z-index: 10;
}

.search-wrapper {
    position: relative;
    background: #fff;
    border-radius: 50px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 1rem;
}

.search-input {
    width: 100%;
    padding: 16px 50px 16px 50px;
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: transparent;
}

.search-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

.clear-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.clear-search-btn:hover {
    color: #dc3545;
    background: #fee2e2;
}

.search-help-text {
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .search-section {
        margin: -15px 15px 15px;
        /* Tighter margin */
    }

    .search-input {
        padding: 10px 40px;
        font-size: 0.9rem;
        height: 44px;
        /* Explicit smaller height */
    }

    .search-icon {
        left: 15px;
        font-size: 0.9rem;
    }
}

/* --- STREAM SELECTOR --- */
.stream-selector {
    margin-bottom: 20px;
}

.stream-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.stream-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    background: #fff;
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stream-pill:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.15);
}

.stream-pill.active {
    background: linear-gradient(135deg, #0d6efd, #3b82f6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.35);
}

.stream-pill i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .stream-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 5px 0;
        gap: 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .stream-pills::-webkit-scrollbar {
        display: none;
    }

    .stream-pill {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

/* --- FILTER BAR --- */
.filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    background: #fff;
    color: #4b5563;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-chip:hover {
    transform: translateY(-2px);
}

.filter-chip.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.filter-chip.filter-success:hover,
.filter-chip.filter-success.active {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.filter-chip.filter-danger:hover,
.filter-chip.filter-danger.active {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.filter-chip.filter-info:hover,
.filter-chip.filter-info.active {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}

.filter-chip.filter-warning:hover,
.filter-chip.filter-warning.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

.filter-chip i {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 10px;
        gap: 8px;
        scrollbar-width: none;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-chip {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* --- CATEGORY SELECTOR --- */
.category-drawer {
    margin-bottom: 20px;
}

.category-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.category-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-option:hover {
    border-color: #0d6efd;
    color: #0d6efd;
}

.category-option.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
    box-shadow: 0 3px 10px rgba(13, 110, 253, 0.25);
}

@media (max-width: 768px) {
    .category-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 5px 0;
        scrollbar-width: none;
    }

    .category-pills::-webkit-scrollbar {
        display: none;
    }

    .category-option {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 20px;
    }
}

/* Mobile Nav Toggle Function */
@media (max-width: 768px) {
    .nav-pills {
        display: none !important;
    }
}

/* --- NEW FEATURES STYLES (Phase 1) --- */

/* Calendar Icon */
/* Calendar Icon - REVERTED */

/* Share Button */
.share-btn {
    font-size: 0.9rem;
    opacity: 0.7;
    transition: all 0.2s;
}

.share-btn:hover {
    opacity: 1;
    color: #0d6efd !important;
    transform: scale(1.1);
}

/* Blink Animation for Urgency */
.blink-soft {
    animation: blink-animation 2s infinite;
}

@keyframes blink-animation {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Highlight Exam Row (Deep Link) */
.highlight-exam {
    background-color: #fff3cd !important;
    transition: background-color 0.5s ease;
    border: 2px solid #ffc107;
}