/* responsive.css - loaded last on every normal page: phone-first safety net */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; }
body { word-wrap: break-word; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.category-dropdown-panel { max-width: calc(100vw - 1.5rem); }

/* long (e.g. Bengali) button text wraps instead of being cut off */
.btn { white-space: normal; text-align: center; line-height: 1.3; }

/* tap targets */
.btn, .action-chip, .btn-action-icon, .qm-filter a, .qm-quick-links a { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }

@media (max-width: 768px) {
    /* iOS zooms into inputs smaller than 16px */
    input, select, textarea { font-size: 16px !important; max-width: 100%; }
    .auth-container { margin: 1rem auto !important; width: calc(100% - 1.5rem) !important; max-width: 100% !important; padding: 1.25rem !important; }

    /* popups fit the screen */
    .modal-overlay { padding: 0.75rem; align-items: flex-end; }
    .modal-box { width: 100% !important; max-width: 100% !important; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 12px 12px; -webkit-overflow-scrolling: touch; }

    /* manage questions */
    .manage-container { padding: 0.75rem !important; }
    .exam-header-card { padding: 1rem !important; }
    .batch-toolbar { flex-direction: column; align-items: stretch !important; gap: 0.6rem; padding: 0.75rem !important; }
    .batch-toolbar .bulk-only { justify-content: flex-start; }
    .q-card-item { padding: 0.85rem !important; }
    .q-top-row { gap: 0.6rem; }
    .options-grid { grid-template-columns: 1fr !important; }
    .floating-bulk-bar { width: calc(100% - 1.25rem); max-width: 520px; flex-wrap: wrap; justify-content: center; gap: 0.5rem; border-radius: 16px !important; bottom: 0.75rem; }

    /* generic page wrappers */
    .admin-page, .page-wrap, main { padding-left: 0.75rem; padding-right: 0.75rem; }
    .admin-page div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

    /* tables that are not already wrapped can still scroll sideways inside their card */
    .card { overflow-x: auto; }
    .card table { min-width: 0; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.7rem !important; line-height: 1.25; }
    .hero-content a.btn, .hero-actions a.btn { width: 100%; }
    .card { padding: 1rem; }
    h2 { font-size: 1.25rem; }
}