/* ======================================================
   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 (di atas bottom-bar) */
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: calc(96px + env(safe-area-inset-bottom));
        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: horizontal scroll, bukan column */
    .navbar {
        padding: 0.6rem 0;
    }
    .navbar .container {
        flex-direction: row;
        gap: 0.5rem;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .navbar .container::-webkit-scrollbar {
        display: none;
    }
    .navbar-brand {
        white-space: nowrap;
        flex-shrink: 0;
    }
    .navbar-nav {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .nav-link {
        font-size: 0.82rem;
        padding: 0.35rem 0.65rem;
    }
}

/* Progress Ring Mobile Responsiveness */
.progress-ring-card {
    background: rgba(13, 27, 42, 0.75);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
}

.progress-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.progress-header-title {
    color: var(--gold);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.progress-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
}

.progress-stat-card {
    padding: 0.5rem 0.25rem;
    border-radius: 10px;
}

.progress-stat-val {
    font-weight: 800;
    font-size: 1.1rem;
}

.progress-stat-lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.progress-estimate-banner {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(212, 168, 83, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    font-size: 0.82rem;
    text-align: center;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .progress-ring-card {
        padding: 1rem;
    }
    
    .progress-header-title {
        font-size: 1rem;
    }

    .progress-header-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .progress-stat-val {
        font-size: 0.95rem;
    }

    .progress-stat-lbl {
        font-size: 0.65rem;
    }

    .progress-estimate-banner {
        font-size: 0.78rem;
        padding: 0.5rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .progress-stats-grid {
        gap: 0.35rem;
    }

    .progress-stat-card {
        padding: 0.4rem 0.2rem;
    }

    .progress-stat-lbl {
        font-size: 0.6rem;
    }
}

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

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