/* ======================================================
   MOBILE & RESPONSIVE DESIGN ENHANCEMENTS
   ====================================================== */

/* Mobile Breakpoint: screens up to 768px */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 1rem;
    }

    .glass-card {
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }

    .arabic {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    /* Form input touch optimization */
    input, select, textarea {
        padding: 0.85rem 1rem;
        font-size: 16px; /* Prevents auto-zoom on iOS Safari */
        border-radius: 10px;
    }

    .btn {
        padding: 0.85rem 1.25rem;
        font-size: 1rem;
        min-height: 48px; /* Mobile touch target standard */
        border-radius: 10px;
    }

    /* Juz Grid Responsive: 3 columns on mobile */
    .juz-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .juz-card {
        padding: 0.6rem 0.4rem;
        border-radius: 10px;
    }

    .juz-card .juz-nomor {
        font-size: 1.8rem;
        margin-bottom: 0.2rem;
    }

    .juz-card .juz-name {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .juz-card .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }

    /* OTP Inputs on Mobile: Auto-scale to fit 6 boxes */
    .otp-container {
        gap: 0.35rem;
        margin: 1.5rem 0;
        justify-content: space-between;
    }

    .otp-input {
        width: calc((100% - 1.75rem) / 6);
        max-width: 48px;
        height: 52px;
        font-size: 1.5rem;
        border-radius: 8px;
        padding: 0;
    }

    /* Timer Display on Mobile */
    .timer-display {
        font-size: 2.2rem;
        margin: 1rem 0;
        letter-spacing: 1px;
    }

    /* Bottom Floating Action Bar */
    .bottom-bar {
        padding: 0.75rem 1rem;
    }

    .bottom-bar #selection-count {
        font-size: 0.95rem;
    }

    .bottom-bar .btn {
        padding: 0.65rem 1.1rem;
        font-size: 0.9rem;
        min-height: 42px;
    }

    /* Toast Notification on Mobile */
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
        font-size: 0.9rem;
        padding: 0.85rem 1.1rem;
        text-align: center;
        transform: translateY(180%);
    }

    .toast.show {
        transform: translateY(0);
    }

    /* Admin Mobile Table Scroll */
    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 1rem;
    }

    .admin-table th, .admin-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Admin Stat Cards 2x2 on Mobile */
    .admin-stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    #admin-juz-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.35rem !important;
    }

    .stat-card {
        padding: 0.85rem;
        gap: 0.5rem;
        border-radius: 10px;
    }

    .stat-icon {
        font-size: 1.4rem;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .stat-info p {
        font-size: 0.75rem;
    }

    /* Navbar Mobile Optimization */
    .navbar .container {
        flex-direction: column;
        gap: 0.55rem;
    }
    .navbar-nav {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .nav-link {
        font-size: 0.82rem;
        padding: 0.35rem 0.65rem;
    }
}

/* Extra Small Phones (< 380px) */
@media (max-width: 380px) {
    .juz-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .otp-input {
        height: 46px;
        font-size: 1.3rem;
    }
}
