/* ==========================================================================
   TABLETS & MEDIUM SCREENS (<= 992px)
   ========================================================================== */
@media (max-width: 992px) {
    .navbar-brand {
        gap: 0.6rem;
    }

    .navbar-logo {
        height: 34px;
    }

    .brand-text {
        font-size: 1.15rem;
        white-space: nowrap;
    }

    .navbar-nav {
        position: fixed;
        top: 78px;
        left: 0;
        width: 100%;
        height: calc(100vh - 78px);
        background: rgba(8, 28, 21, 0.98);
        backdrop-filter: blur(28px);
        -webkit-backdrop-filter: blur(28px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 3rem 1.5rem;
        gap: 2rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        border-bottom: 1px solid var(--border-glass-gold);
    }

    [data-theme="light"] .navbar-nav {
        background: rgba(248, 250, 249, 0.98);
    }

    .navbar-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-hamburger.active span:nth-child(1) {
        transform: translateY(8.5px) rotate(45deg);
    }

    .nav-hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-hamburger.active span:nth-child(3) {
        transform: translateY(-8.5px) rotate(-45deg);
    }

    /* On tablet (<= 992px): Align navAuthActions properly */
    #navAuthActions {
        display: flex;
        align-items: center;
    }

    /* Hide separate desktop buttons, show single user icon button */
    .nav-auth-desktop {
        display: none !important;
    }

    .nav-auth-mobile {
        display: flex !important;
        align-items: center;
    }

    /* Login/Register page: collapse nav text buttons to icon-only on tablet */
    .site-header .nav-actions > .btn-glass.btn-sm,
    .site-header .nav-actions > .btn-secondary.btn-sm {
        font-size: 0;
        gap: 0;
        padding: 0.5rem 0.65rem;
        min-width: auto;
    }

    .site-header .nav-actions > .btn-glass.btn-sm i,
    .site-header .nav-actions > .btn-secondary.btn-sm i {
        font-size: 1.05rem;
    }

    /* On mobile: show only the user icon, hide the username text */
    #navAuthActions .btn-pill {
        font-size: 0;
        gap: 0;
        padding: 0.5rem;
        min-width: auto;
    }

    #navAuthActions .btn-pill i {
        font-size: 1.15rem;
    }

    /* Hide logout button text, keep icon compact */
    #navAuthActions .btn-glass {
        font-size: 0;
        gap: 0;
        padding: 0.5rem;
        min-width: auto;
    }

    #navAuthActions .btn-glass i {
        font-size: 1.15rem;
    }

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

    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        padding: 1.25rem;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .sidebar-user {
        margin-bottom: 1rem;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-bottom: 0;
    }

    .sidebar-link {
        flex: 1 1 calc(50% - 0.5rem);
        justify-content: flex-start;
        padding: 0.7rem 0.9rem;
    }

    .dashboard-content {
        padding: 1.75rem;
    }

    /* Storytelling & Horizontal Gallery Mobile */
    .story-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .story-sticky-pane {
        position: static;
        height: auto;
        margin-bottom: 1.5rem;
    }

    .hero-floating-badge {
        display: none;
    }

    .horizontal-card {
        flex: 0 0 290px;
    }

    /* ---- Event Details Page Responsive (Tablet) ---- */
    .grid-details-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .event-hero-banner {
        margin-bottom: 2rem !important;
    }

    .event-hero-banner > div:first-child {
        height: 300px !important;
    }

    /* ---- Dashboard/Admin Nav Actions: Icon-Only Buttons (Only in Admin/Student headers) ---- */
    .container-fluid .nav-actions .btn-glass,
    .container-fluid .nav-actions .btn-primary.btn-sm {
        font-size: 0;
        gap: 0;
        padding: 0.5rem 0.65rem;
        min-width: auto;
    }

    .container-fluid .nav-actions .btn-glass i,
    .container-fluid .nav-actions .btn-primary.btn-sm i {
        font-size: 1.1rem;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    /* ---- Force all inline grid layouts to single column on tablet ---- */
    .dashboard-content [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* ---- Table responsive: allow horizontal scroll ---- */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   MOBILE PHONES (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .navbar-brand {
        gap: 0.5rem;
    }

    .navbar-logo {
        height: 30px;
    }

    .brand-text {
        font-size: 1.05rem;
        white-space: nowrap;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    #navAuthActions {
        display: flex;
        align-items: center;
    }

    /* On mobile phone size (<= 768px): Hide separate desktop buttons, show single user button */
    .nav-auth-desktop {
        display: none !important;
    }

    .nav-auth-mobile {
        display: flex !important;
        align-items: center;
    }

    .theme-toggle-btn,
    .user-menu-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .hero-section {
        padding: 4.5rem 0 3.5rem;
    }

    .hero-title {
        font-size: 2.35rem;
    }

    .hero-subtitle {
        font-size: 1.05rem;
    }

    .grid-3,
    .grid-2,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .countdown-box {
        padding: 1.15rem 1.35rem;
        gap: 0.65rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .countdown-num {
        font-size: 1.65rem;
    }

    .countdown-unit {
        min-width: 50px;
    }

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

    .footer-bottom {
        flex-direction: column;
        gap: 1.25rem;
        text-align: center;
        padding-right: 0;
        padding-bottom: 4.5rem;
    }

    .modal-content {
        max-width: 95vw;
        border-radius: var(--radius-lg);
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .grid-filters {
        grid-template-columns: 1fr !important;
    }

    /* ---- Event Details Page Responsive (Mobile) ---- */
    .event-hero-banner > div:first-child {
        height: 260px !important;
    }

    /* Overlay text area inside hero banner */
    .event-hero-banner [style*="bottom: 2rem"] {
        bottom: 1.25rem !important;
        left: 1.25rem !important;
        right: 1.25rem !important;
    }

    /* Glass cards & panels — reduce padding on mobile */
    .glass-card,
    .glass-panel {
        padding: 1.5rem;
    }

    #eventDetailsContainer.section-py {
        padding-top: 1.5rem !important;
        padding-bottom: 3rem;
    }

    /* Event meta items - ensure full width */
    .event-meta-info {
        gap: 0.85rem;
    }

    .event-meta-item {
        font-size: 0.9rem;
    }

    /* Capacity bar section */
    .capacity-bar {
        height: 8px;
    }

    /* ---- Dashboard Pages Mobile ---- */
    .dashboard-content {
        padding: 1.25rem;
    }

    .dashboard-content .section-title {
        font-size: 1.5rem;
    }

    .dashboard-content .section-subtitle {
        font-size: 0.9rem;
    }

    /* Stat cards - stack icon and text vertically on mobile */
    .stat-card {
        padding: 1.25rem;
    }

    /* Welcome banner flex layout - stack on mobile */
    .dashboard-welcome-banner > div {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .dashboard-welcome-banner h2 {
        font-size: 1.4rem !important;
    }

    .dashboard-welcome-banner .btn-pill {
        width: 100%;
        justify-content: center;
    }

    /* Dashboard nav-actions btn-secondary: icon-only on mobile */
    .container-fluid .nav-actions .btn-secondary.btn-sm {
        font-size: 0;
        gap: 0;
        padding: 0.5rem 0.65rem;
        min-width: auto;
    }

    .container-fluid .nav-actions .btn-secondary.btn-sm i {
        font-size: 1.1rem;
    }

    /* About page hero layout */
    .about-hero-banner > div {
        flex-direction: column !important;
        text-align: center;
    }

    .about-hero-banner .section-title,
    .about-hero-banner .section-subtitle {
        text-align: center !important;
    }

    .about-hero-logo-wrapper {
        margin: 0 auto;
    }

    /* Custom tables - horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .custom-table {
        min-width: 500px;
    }

    /* Section padding reduction */
    .section-py {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }
}

/* ==========================================================================
   SMALL MOBILES (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
    .navbar-brand {
        gap: 0.4rem;
    }

    .navbar-logo {
        height: 26px;
    }

    .brand-text {
        font-size: 0.92rem;
        white-space: nowrap;
    }

    .nav-actions {
        gap: 0.4rem;
    }

    .theme-toggle-btn,
    .user-menu-btn {
        width: 35px;
        height: 35px;
        font-size: 1.02rem;
    }

    .user-dropdown-menu {
        min-width: 195px;
        right: -8px;
    }

    .btn-lg {
        padding: 0.85rem 1.6rem;
        font-size: 0.98rem;
        width: 100%;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .hero-cta .btn {
        width: 100%;
    }

    .sidebar-link {
        flex: 1 1 100%;
    }

    /* ---- Event Details Page Responsive (Small Mobile) ---- */
    .event-hero-banner > div:first-child {
        height: 220px !important;
    }

    .event-hero-banner [style*="bottom: 2rem"] {
        bottom: 1rem !important;
        left: 1rem !important;
        right: 1rem !important;
    }

    .glass-card,
    .glass-panel {
        padding: 1.25rem;
    }

    #eventDetailsContainer .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Make countdown box wrap nicely on small screens */
    .countdown-box {
        padding: 0.85rem 1rem;
        gap: 0.4rem;
    }

    .countdown-num {
        font-size: 1.4rem;
    }

    .countdown-unit {
        min-width: 42px;
    }

    .countdown-lbl {
        font-size: 0.65rem;
    }

    .countdown-divider {
        font-size: 1.2rem;
    }

    /* ---- Dashboard Small Mobile ---- */
    .dashboard-content {
        padding: 1rem;
    }

    .dashboard-content .section-title {
        font-size: 1.3rem;
    }

    .container {
        padding: 0 1rem;
    }

    /* Sidebar compact on small mobile */
    .sidebar {
        padding: 1rem;
    }

    .sidebar-user-name {
        font-size: 0.95rem;
    }

    /* Section header adjustments */
    .section-title {
        font-size: 1.6rem;
    }

    .section-tag {
        font-size: 0.75rem;
    }
}

/* ==========================================================================
   EXTRA SMALL MOBILES (<= 360px)
   ========================================================================== */
@media (max-width: 360px) {
    .navbar-brand {
        gap: 0.35rem;
    }

    .navbar-logo {
        height: 24px;
    }

    .brand-text {
        font-size: 0.84rem;
        white-space: nowrap;
    }

    /* ---- Event Details Page Responsive (Extra Small) ---- */
    .event-hero-banner > div:first-child {
        height: 180px !important;
    }

    .glass-card,
    .glass-panel {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .event-meta-item {
        font-size: 0.85rem;
    }

    .event-meta-item i {
        font-size: 0.9rem;
    }

    /* ---- Dashboard Extra Small ---- */
    .dashboard-content {
        padding: 0.75rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .section-title {
        font-size: 1.35rem;
    }

    /* Nav actions tighter spacing */
    .nav-actions {
        gap: 0.35rem;
    }

    .nav-actions .theme-toggle-btn,
    .nav-actions .user-menu-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }
}