/* Karnataka Society Registration - Global responsive layer
   Loaded last (just before </head>) so it can refine site.css and the layout styles. */

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; padding-bottom: env(safe-area-inset-bottom); }
img, video, iframe, canvas, svg { max-width: 100%; }
img, video { height: auto; }
.card-body, .field-value, .table td, .table th { overflow-wrap: break-word; word-wrap: break-word; }

/* Wizard connector line was drawn at z-index:-1 (behind the page background) - keep it inside the wizard */
.step-wizard { position: relative; isolation: isolate; }

/* Cards: header rows with buttons wrap instead of overflowing */
.card-header.d-flex { flex-wrap: wrap; gap: .5rem; }

/* Wide tables scroll inside their wrapper instead of crushing columns */
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ── Tablets and below ───────────────────────────────────────── */
@media (max-width: 991.98px) {
    .dropdown-menu { max-width: 92vw; }
    .modal-dialog { margin: .75rem; }
}

/* ── Phones / small tablets ─────────────────────────────────── */
@media (max-width: 767.98px) {
    .container, .container-fluid { padding-left: 14px; padding-right: 14px; }

    /* 16px inputs stop iOS from zooming the page on focus; comfortable tap targets */
    .form-control, .form-select, textarea.form-control { font-size: 16px; min-height: 44px; }
    textarea.form-control { min-height: 96px; }
    .btn { min-height: 42px; }
    .btn-sm { min-height: 34px; }
    .form-check-input { width: 1.2em; height: 1.2em; }

    .card-body { padding: 1rem; }
    .card-header, .card-footer { padding: .75rem 1rem; }

    /* Tabs / pills become one horizontally-scrollable row */
    .nav-tabs, .nav-pills { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .nav-tabs::-webkit-scrollbar, .nav-pills::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-link, .nav-pills .nav-link { white-space: nowrap; }

    /* Tables keep a readable width and scroll sideways */
    .table-responsive > .table { min-width: 580px; }
    .table th[style*="width"] { width: auto !important; min-width: 90px; }

    /* Action button rows in forms/cards stack full width */
    .card-body form > .d-flex.justify-content-between,
    .card-body > .d-flex.justify-content-between.mt-4,
    .card-body > .d-flex.justify-content-end { flex-wrap: wrap; gap: .5rem; }
    .card-body form > .d-flex.justify-content-between .btn,
    .card-body > .d-flex.justify-content-between.mt-4 .btn { flex: 1 1 100%; }

    h1, .h1 { font-size: 1.65rem; }
    h2, .h2 { font-size: 1.4rem; }
    h3, .h3 { font-size: 1.2rem; }

    .top-bar { font-size: 12px; padding: 7px 0; }
    .navbar-karnataka { padding: 10px 0; }
    .navbar-brand { font-size: 1rem; }
    .navbar-brand img { height: 34px; }

    /* Applicant wizard */
    .step-wizard .step-circle { width: 32px; height: 32px; font-size: 13px; }
    .step-wizard .step-line { top: 16px; }
    .step-wizard .step small, .step-wizard .step div:not(.step-circle) { font-size: 10.5px; line-height: 1.25; }

    /* Detail pages: label/value pairs */
    .field-label { display: block; margin-bottom: 2px; }

    .ka-popup { width: calc(100vw - 24px); }
}

/* ── Small phones ───────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .step-wizard .step small, .step-wizard .step div:not(.step-circle) { font-size: 9.5px; }
    .btn-lg { padding: .6rem 1rem; font-size: 1rem; }
    .badge, .status-badge { white-space: normal; }
}
