/**
 * Mobile Fix CSS - JAKPUSSIDATU
 * =================================
 * Fixes navbar, content responsiveness, and touch interactions on mobile devices
 * 
 * Breakpoints:
 * - Extra Small Mobile: ≤320px
 * - Small Mobile: 321px – 375px
 * - Large Mobile: 376px – 425px
 * - Tablet Portrait: 426px – 768px
 * - Tablet Landscape: 769px – 1024px
 */

/* ===========================================
   NAVBAR FIXES (DO NOT MODIFY STRUCTURE)
   =========================================== */

/* Fix navbar z-index issues */
.navbar-main {
    z-index: 9999 !important;
}

.navbar-collapse {
    z-index: 10000 !important;
    position: relative;
}

/* Fix for Bootstrap 5 navbar collapse on mobile */
@media (max-width: 991px) {
    .navbar-collapse {
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background-color: var(--primary-color, #b71c1c) !important;
        padding: 1rem !important;
        overflow-y: auto !important;
        z-index: 10000 !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out !important;
    }

    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        transform: translateX(0) !important;
    }

    .navbar-collapse:not(.show):not(.collapsing) {
        transform: translateX(-100%) !important;
    }
}

/* Fix for nav-link clickability */
.nav-link,
.btn-login,
.btn-register {
    position: relative;
    z-index: 10001 !important;
    pointer-events: auto !important;
}

/* Ensure buttons in navbar are always clickable */
.navbar-nav .nav-item .btn-login,
.navbar-nav .nav-item .btn-register {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 10001 !important;
}

/* Fix dropdown menu on mobile */
@media (max-width: 991px) {
    .dropdown-menu {
        position: static !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: none !important;
        box-shadow: none !important;
        padding-left: 1rem !important;
        margin-top: 0.5rem !important;
    }

    .dropdown-item {
        color: white !important;
        padding: 0.75rem 1rem !important;
    }

    .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.2) !important;
    }
}

/* Fix hero slider overlay z-index */
.hero-slider {
    z-index: 1 !important;
}

.slider-content {
    z-index: 2 !important;
}

/* Ensure navbar is above hero slider */
.navbar-main {
    z-index: 9999 !important;
}

/* Fix any potential overlay issues */
.navbar-toggler {
    z-index: 10002 !important;
    position: relative;
}

/* Ensure proper stacking context */
@media (max-width: 991px) {
    body {
        overflow-x: hidden;
    }

    main {
        position: relative;
        z-index: 1;
    }
}

/* Fix for smooth scroll affecting anchor links */
html {
    scroll-behavior: auto;
}

/* Ensure links are always clickable */
a {
    pointer-events: auto !important;
}

/* Button hover states for better UX */
.btn-login:hover,
.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Fix for navbar brand and logo */
.navbar-brand {
    pointer-events: auto !important;
    z-index: 10001 !important;
}

/* Additional fix for navbar items */
.navbar-nav > li > a,
.navbar-nav > li > .btn {
    pointer-events: auto !important;
}

/* Fix for focus states - ensure keyboard navigation works */
.nav-link:focus,
.btn-login:focus,
.btn-register:focus {
    outline: 2px solid var(--secondary-color, #fbc02d) !important;
    outline-offset: 2px !important;
}

/* ===========================================
   CONTENT AREA - MOBILE RESPONSIVENESS
   =========================================== */

/* Base content container fixes */
@media (max-width: 768px) {
    /* Ensure main content doesn't overflow */
    main {
        overflow-x: hidden;
        width: 100%;
    }

    /* Container padding for mobile */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        max-width: 100%;
    }

    /* Section padding adjustment */
    .section {
        padding: 3rem 0 !important;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

/* ===========================================
   HERO SLIDER - MOBILE OPTIMIZATION
   =========================================== */

@media (max-width: 768px) {
    .hero-slider {
        height: 55vh !important;
        min-height: 400px !important;
        max-height: 500px !important;
    }

    .slider-content {
        padding: 0 1rem !important;
        max-width: 100% !important;
    }

    .slider-content h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }

    .slider-content p {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.25rem !important;
    }

    .slider-content .category {
        font-size: 0.7rem !important;
        padding: 0.4rem 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* Hide navigation arrows on mobile */
    .slider-nav {
        display: none !important;
    }

    /* Adjust dots for mobile */
    .slider-dots {
        bottom: 1rem !important;
        gap: 0.5rem !important;
    }

    .slider-dot {
        width: 10px !important;
        height: 10px !important;
    }

    .slider-dot.active {
        width: 24px !important;
    }
}

@media (max-width: 480px) {
    .hero-slider {
        height: 45vh !important;
        min-height: 350px !important;
    }

    .slider-content h1 {
        font-size: 1.5rem !important;
    }

    .slider-content p {
        font-size: 0.85rem !important;
    }
}

/* ===========================================
   STATS SECTION - MOBILE
   =========================================== */

@media (max-width: 768px) {
    .stats-section {
        padding: 2.5rem 0 !important;
        margin-top: -20px !important;
        border-radius: 1rem 1rem 0 0 !important;
    }

    .stat-item {
        padding: 1rem 0.5rem !important;
    }

    .stat-icon {
        font-size: 2rem !important;
        margin-bottom: 0.75rem !important;
    }

    .stat-number {
        font-size: 1.75rem !important;
    }

    .stat-label {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    .stats-section {
        padding: 2rem 0 !important;
        margin-top: -15px !important;
    }

    .stat-number {
        font-size: 1.5rem !important;
    }

    .stat-icon {
        font-size: 1.75rem !important;
    }
}

/* ===========================================
   CARDS & CONTENT GRID - MOBILE
   =========================================== */

@media (max-width: 768px) {
    /* Card adjustments */
    .card-custom {
        margin-bottom: 1rem !important;
    }

    .card-custom .card-img-top {
        height: 180px !important;
        object-fit: cover !important;
    }

    .card-custom .card-body {
        padding: 1.25rem !important;
    }

    .card-custom .card-category {
        font-size: 0.65rem !important;
        padding: 0.25rem 0.6rem !important;
    }

    .card-custom .card-title {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    .card-custom .card-text {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
        -webkit-line-clamp: 2 !important;
    }

    .card-custom .card-date {
        font-size: 0.75rem !important;
    }

    /* Section titles */
    .section-title {
        font-size: 1.5rem !important;
    }

    .section-subtitle {
        font-size: 0.9rem !important;
    }

    /* Buttons */
    .btn-primary,
    .btn-outline-primary {
        padding: 0.65rem 1.5rem !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .card-custom .card-img-top {
        height: 160px !important;
    }

    .card-custom .card-body {
        padding: 1rem !important;
    }

    .card-custom .card-title {
        font-size: 0.95rem !important;
    }

    .card-custom .card-text {
        font-size: 0.8rem !important;
    }
}

/* ===========================================
   PENGUMUMAN SECTION - MOBILE
   =========================================== */

@media (max-width: 768px) {
    .pengumuman-item {
        padding: 1.25rem !important;
        margin-bottom: 1rem !important;
    }

    .pengumuman-label {
        font-size: 0.65rem !important;
        padding: 0.25rem 0.75rem !important;
    }

    .pengumuman-title {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    .pengumuman-date {
        font-size: 0.75rem !important;
    }
}

/* ===========================================
   JADWAL SECTION - MOBILE
   =========================================== */

@media (max-width: 480px) {
    .jadwal-item {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    .jadwal-date {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.75rem !important;
        padding: 0.5rem !important;
    }

    .jadwal-date .day {
        font-size: 1.2rem !important;
        font-weight: 700 !important;
    }

    .jadwal-date .month {
        font-size: 0.75rem !important;
    }

    .jadwal-content {
        width: 100% !important;
    }

    .jadwal-title {
        font-size: 0.95rem !important;
        text-align: center !important;
    }

    .jadwal-meta {
        font-size: 0.8rem !important;
        justify-content: center !important;
        gap: 0.75rem !important;
    }

    .jadwal-meta span {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
}

/* ===========================================
   ABOUT SECTION - MOBILE
   =========================================== */

@media (max-width: 768px) {
    .about-image {
        height: 250px !important;
        margin-bottom: 1.5rem !important;
    }

    .about-content h2 {
        font-size: 1.6rem !important;
    }

    .about-content p {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }

    .about-features li {
        font-size: 0.9rem !important;
    }

    .about-features li i {
        font-size: 1rem !important;
    }
}

/* ===========================================
   CTA SECTION - MOBILE
   =========================================== */

@media (max-width: 768px) {
    .cta-section {
        padding: 3rem 0 !important;
    }

    .cta-content h2 {
        font-size: 1.75rem !important;
    }

    .cta-content p {
        font-size: 1rem !important;
    }

    .cta-buttons {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .btn-cta-primary,
    .btn-cta-secondary {
        width: 100% !important;
        max-width: none !important;
        justify-content: center !important;
        padding: 0.85rem 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .cta-content h2 {
        font-size: 1.5rem !important;
    }

    .btn-cta-primary,
    .btn-cta-secondary {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.9rem !important;
    }
}

/* ===========================================
   FOOTER - MOBILE (STRUCTURE PRESERVED)
   =========================================== */

@media (max-width: 768px) {
    footer {
        padding: 3rem 0 1.5rem !important;
    }

    .footer-brand {
        flex-direction: column !important;
        text-align: center !important;
        margin-bottom: 1.5rem !important;
    }

    .footer-brand img {
        width: 50px !important;
        height: 50px !important;
    }

    .footer-title {
        font-size: 0.9rem !important;
    }

    .footer-links a {
        font-size: 0.85rem !important;
    }

    .footer-social {
        justify-content: center !important;
        margin-top: 1rem !important;
    }

    .footer-social a {
        width: 36px !important;
        height: 36px !important;
    }

    .footer-bottom {
        font-size: 0.8rem !important;
        padding-top: 1.25rem !important;
    }
}

/* ===========================================
   EXTRA SMALL MOBILE - ≤320px
   =========================================== */

@media (max-width: 320px) {
    html {
        font-size: 14px !important;
    }

    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .navbar-logo {
        width: 32px !important;
        height: 32px !important;
    }

    .brand-name {
        font-size: 1rem !important;
    }

    .brand-tagline {
        display: none !important;
    }

    .slider-content h1 {
        font-size: 1.25rem !important;
    }

    .slider-content p {
        font-size: 0.8rem !important;
    }

    .stat-number {
        font-size: 1.25rem !important;
    }

    .section-title {
        font-size: 1.25rem !important;
    }

    .card-custom .card-title {
        font-size: 0.9rem !important;
    }

    .pengumuman-title {
        font-size: 0.9rem !important;
    }

    .jadwal-title {
        font-size: 0.85rem !important;
    }
}

/* ===========================================
   SMALL MOBILE - 321px to 375px
   =========================================== */

@media (min-width: 321px) and (max-width: 375px) {
    .navbar-logo {
        width: 34px !important;
        height: 34px !important;
    }

    .brand-name {
        font-size: 1.05rem !important;
    }

    .slider-content h1 {
        font-size: 1.4rem !important;
    }
}

/* ===========================================
   LARGE MOBILE - 376px to 425px
   =========================================== */

@media (min-width: 376px) and (max-width: 425px) {
    .navbar-logo {
        width: 36px !important;
        height: 36px !important;
    }

    .brand-name {
        font-size: 1.1rem !important;
    }

    .slider-content h1 {
        font-size: 1.5rem !important;
    }
}

/* ===========================================
   TABLET PORTRAIT - 426px to 768px
   =========================================== */

@media (min-width: 426px) and (max-width: 768px) {
    .slider-content h1 {
        font-size: 1.85rem !important;
    }

    .slider-content p {
        font-size: 1rem !important;
    }

    .stat-number {
        font-size: 2rem !important;
    }

    .section-title {
        font-size: 1.65rem !important;
    }
}

/* ===========================================
   TOUCH OPTIMIZATIONS
   =========================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-link,
    .dropdown-item,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .card-custom:hover,
    .pengumuman-item:hover,
    .jadwal-item:hover {
        transform: none !important;
    }

    /* Enable tap highlight */
    * {
        -webkit-tap-highlight-color: rgba(183, 28, 28, 0.1);
    }
}

/* ===========================================
   LANDSCAPE ORIENTATION FIXES
   =========================================== */

@media (max-width: 991px) and (orientation: landscape) {
    .hero-slider {
        height: 65vh !important;
        min-height: 350px !important;
    }

    .navbar-collapse {
        max-height: 70vh !important;
        overflow-y: auto !important;
    }

    .stats-section {
        padding: 2rem 0 !important;
    }
}

/* ===========================================
   UTILITY CLASSES FOR MOBILE
   =========================================== */

/* Hide elements on mobile */
.hide-mobile {
    display: none !important;
}

@media (min-width: 769px) {
    .hide-mobile {
        display: block !important;
    }
}

/* Full width on mobile */
.mobile-full-width {
    width: 100% !important;
}

/* Center text on mobile */
.mobile-text-center {
    text-align: center !important;
}

@media (min-width: 769px) {
    .mobile-text-center {
        text-align: left !important;
    }
}

/* Stack columns on mobile */
.mobile-stack {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

@media (min-width: 769px) {
    .mobile-stack {
        flex-direction: row !important;
    }
}

/* ===========================================
   PERFORMANCE OPTIMIZATIONS
   =========================================== */

/* Reduce animations on mobile */
@media (max-width: 768px) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Re-enable essential animations */
    .slider-container,
    .navbar-collapse {
        animation-duration: initial !important;
        transition-duration: initial !important;
    }
}

