/* ==========================================================================
   ABDM V2 UI — Single CSS file for all ABDM-related components
   Bootstrap 5.3 + Inter font
   REVERT: Delete public/assets/v2/ directory entirely
   ========================================================================== */

/* ---------- Base ---------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
}

.abdm-main {
    min-height: calc(100vh - 200px);
}

/* ---------- Hero Section (get-abha page) ---------- */
.abdm-hero {
    background: linear-gradient(135deg, #0d6e6e 0%, #0891b2 50%, #22d3ee 100%);
    color: #fff;
    padding: 3.5rem 0 2.5rem;
    position: relative;
    overflow: hidden;
}
.abdm-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.abdm-hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.abdm-hero p {
    opacity: 0.9;
    font-size: 0.95rem;
}
.abdm-hero .benefit-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}
.abdm-hero .benefit-item i {
    font-size: 1.1rem;
    margin-right: 8px;
    margin-top: 3px;
    color: #a7f3d0;
}
.abdm-hero .benefit-item span {
    font-size: 0.88rem;
}

/* ---------- Cards ---------- */
.abdm-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    overflow: hidden;
}
.abdm-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.abdm-card .card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
}

/* ---------- Action Cards (Create/Link ABHA) ---------- */
.abdm-action-card {
    border: 2px dashed #0891b2;
    border-radius: 12px;
    text-align: center;
    padding: 2rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}
.abdm-action-card:hover {
    background: #ecfeff;
    border-color: #0d6e6e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13,110,110,0.12);
}
.abdm-action-card i {
    font-size: 2.5rem;
    color: #0891b2;
}
.abdm-action-card h5 {
    margin-top: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #0d6e6e;
}
.abdm-action-card p {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0;
}

/* ---------- Action Cards V2 (horizontal with header) ---------- */
.abdm-action-card-v2 {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.abdm-action-card-v2:hover {
    border-color: #0891b2;
    box-shadow: 0 4px 16px rgba(13,110,110,0.12);
    transform: translateY(-2px);
}
.abdm-ac-header {
    background: linear-gradient(90deg, #0d6e6e, #0891b2);
    color: #fff;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.abdm-ac-body {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    align-items: flex-start;
}
.abdm-ac-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ecfeff, #d1fae5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #0d6e6e;
}
.abdm-ac-content {
    flex: 1;
    min-width: 0;
}
.abdm-ac-content p {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.4;
}
.abdm-ac-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0.75rem;
}
.abdm-ac-list li {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.abdm-ac-list li i {
    color: #059669;
    font-size: 0.7rem;
    flex-shrink: 0;
}
.abdm-ac-btn {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #0891b2;
    transition: color 0.15s;
}
.abdm-action-card-v2:hover .abdm-ac-btn {
    color: #0d6e6e;
}
.abdm-ac-btn i {
    transition: transform 0.15s;
}
.abdm-action-card-v2:hover .abdm-ac-btn i {
    transform: translateX(3px);
}

/* Mobile: stack icon above content */
@media (max-width: 576px) {
    .abdm-ac-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .abdm-ac-list li {
        justify-content: center;
    }
}

/* ---------- ABHA Profile Badge ---------- */
.abdm-profile-badge {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-left: 4px solid #059669;
    padding: 1rem 1.25rem;
    border-radius: 8px;
}
.abdm-number-display {
    font-size: 1.3rem;
    font-weight: 700;
    color: #047857;
    letter-spacing: 1.5px;
    font-variant-numeric: tabular-nums;
}

/* ---------- Patient Profile Header ---------- */
.abdm-patient-header {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1.5rem;
}
.abdm-patient-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e2e8f0;
}
.abdm-patient-avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}

/* ---------- ABHA Section ---------- */
.abdm-abha-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.abdm-abha-section .section-header {
    background: linear-gradient(90deg, #0d6e6e, #0891b2);
    color: #fff;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.abdm-abha-photo {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}
.abdm-abha-photo-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.5rem;
}

/* ---------- Status Badges ---------- */
.abdm-badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.3em 0.65em;
    border-radius: 6px;
}
.abdm-badge-active {
    background: #dcfce7;
    color: #166534;
}
.abdm-badge-kyc {
    background: #dbeafe;
    color: #1e40af;
}
.abdm-badge-linked {
    background: #d1fae5;
    color: #047857;
}
.abdm-badge-unlinked {
    background: #fef3c7;
    color: #92400e;
}
.abdm-badge-pending {
    background: #fef9c3;
    color: #854d0e;
}

/* ---------- Care Context / Consent Tables ---------- */
.abdm-table {
    font-size: 0.82rem;
}
.abdm-table thead th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}
.abdm-table tbody td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}
.abdm-table tbody tr:hover {
    background: #f8fafc;
}

/* ---------- Section Tabs / Filter Bar ---------- */
.abdm-filter-bar {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}
.abdm-filter-bar .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
}
.abdm-filter-bar .btn-check:checked + .btn {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ---------- Section Cards (Consent, Records) ---------- */
.abdm-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}
.abdm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
}
.abdm-section-header h6 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}
.abdm-section-body {
    padding: 1rem;
}

/* ---------- Modals ---------- */
.abdm-modal .modal-header {
    background: linear-gradient(90deg, #0d6e6e, #0891b2);
    color: #fff;
    border: none;
    padding: 0.85rem 1.25rem;
}
.abdm-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}
.abdm-modal .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

/* ---------- OTP Input Cells ---------- */
.abdm-otp-cell {
    width: 44px;
    height: 48px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s;
}
.abdm-otp-cell:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
    outline: none;
}

/* ---------- Progress Steps ---------- */
.abdm-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    counter-reset: step;
}
.abdm-step {
    display: flex;
    align-items: center;
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
}
.abdm-step::before {
    counter-increment: step;
    content: counter(step);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    margin-right: 0.4rem;
    transition: all 0.2s;
}
.abdm-step.active {
    color: #0d6e6e;
}
.abdm-step.active::before {
    background: #0d6e6e;
    color: #fff;
}
.abdm-step.completed::before {
    background: #059669;
    color: #fff;
    content: '\F26E'; /* bi-check-lg */
    font-family: 'bootstrap-icons';
}
.abdm-step + .abdm-step::after {
    content: '';
    width: 2rem;
    height: 2px;
    background: #e2e8f0;
    margin: 0 0.5rem;
    order: -1;
}
.abdm-step.completed + .abdm-step::after,
.abdm-step.active + .abdm-step::after {
    background: #059669;
}

/* ---------- Profile Selector ---------- */
.abdm-profile-selector {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 10px;
    padding: 1rem;
}
.abdm-profile-selector label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0d6e6e;
}
.abdm-profile-selector select {
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ---------- Toast Notifications ---------- */
.abdm-toast {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: 1060;
    min-width: 300px;
}

/* ---------- Loading Spinner ---------- */
.abdm-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: abdm-spin 0.6s linear infinite;
}
@keyframes abdm-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Timeline ---------- */
.abdm-timeline {
    padding: 1rem 1.25rem;
}
.abdm-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1rem;
    position: relative;
}
.abdm-timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.abdm-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    z-index: 1;
}
.abdm-timeline-content {
    flex: 1;
    min-width: 0;
}

/* ---------- Nav Tabs Override ---------- */
.nav-tabs .nav-link {
    color: #64748b;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    transition: all 0.15s;
}
.nav-tabs .nav-link:hover {
    color: #0d6e6e;
    border-color: transparent;
    background: transparent;
}
.nav-tabs .nav-link.active {
    color: #0d6e6e;
    font-weight: 600;
    border-bottom-color: #0d6e6e;
    background: transparent;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .container-fluid { padding-left: 1rem; padding-right: 1rem; }
}
@media (max-width: 768px) {
    .abdm-hero { padding: 2rem 0 1.5rem; }
    .abdm-hero h1 { font-size: 1.4rem; }
    .abdm-patient-avatar,
    .abdm-patient-avatar-placeholder { width: 64px; height: 64px; font-size: 1.5rem; }
    .abdm-abha-photo,
    .abdm-abha-photo-placeholder { width: 56px; height: 56px; }
    .abdm-steps { gap: 0.25rem; }
    .abdm-step + .abdm-step::after { width: 1rem; }
    .abdm-section-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
    .nav-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .nav-tabs .nav-link { white-space: nowrap; padding: 0.5rem 0.75rem; font-size: 0.78rem; }
}
@media (max-width: 576px) {
    .abdm-patient-header .row { flex-direction: column; text-align: center; }
    .abdm-patient-avatar, .abdm-patient-avatar-placeholder { margin: 0 auto 0.5rem; }
    .abdm-abha-section .row { flex-direction: column; }
    .abdm-abha-section .col-auto { text-align: center; margin-top: 0.5rem; }
}

/* ---------- BS4 Modal Compatibility (existing modal partials under BS5) ---------- */

/* Modal positioning — centered vertically */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1055;
    overflow-y: auto;
}
.modal.show {
    display: block;
}
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
}
.modal .modal-dialog {
    margin: 2rem auto;
    position: relative;
    z-index: 1056;
}

/* Modal header */
.modal .modal-header.bg-primary,
.modal .modal-header.bg-info {
    background: linear-gradient(90deg, #0d6e6e, #0891b2) !important;
    border: none;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal .modal-header .modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}
.modal .modal-header .modal-title i,
.modal .modal-header .modal-title .fas,
.modal .modal-header .modal-title .bi {
    margin-right: 0.5rem;
}
.modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}
/* BS4 close button (×) — not present in BS5 */
.modal .modal-header .close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    opacity: 0.85;
    padding: 0.5rem;
    cursor: pointer;
    text-shadow: none;
    order: 2;
    margin-left: auto;
    margin-right: 0;
}
.modal .modal-header .close:hover {
    opacity: 1;
    color: #fff;
}
.modal .modal-header .modal-title {
    order: 1;
}

/* Modal body */
.modal .modal-body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.88rem;
}
.modal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
}
.modal .modal-dialog.modal-lg {
    max-width: 600px;
}

/* Tab nav inside modals */
.modal .nav-tabs {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
}
.modal .nav-tabs .nav-link {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.65rem 0.5rem;
    transition: all 0.15s;
}
.modal .nav-tabs .nav-link.active {
    color: #0d6e6e;
    font-weight: 600;
    border-bottom-color: #0d6e6e;
    background: transparent;
}
.modal .nav-tabs .nav-link.disabled {
    color: #cbd5e1;
}

/* BS4 custom-control → fix under BS5 */
.modal .custom-control {
    position: relative;
    display: block;
    padding-left: 1.75rem;
    margin-bottom: 0.5rem;
}
.modal .custom-control-input {
    position: absolute;
    left: 0;
    z-index: 1;
    width: 1rem;
    height: 1rem;
    margin-top: 0.2rem;
    opacity: 1;
    accent-color: #0891b2;
}
.modal .custom-control-label {
    position: relative;
    margin-bottom: 0;
    vertical-align: top;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #334155;
    padding-left: 0.25rem;
}
.modal .custom-control-label::before,
.modal .custom-control-label::after {
    display: none !important;
}

/* BS4 custom-radio under BS5 */
.modal .custom-radio .custom-control-input {
    appearance: auto;
    -webkit-appearance: auto;
}
.modal .custom-checkbox .custom-control-input {
    appearance: auto;
    -webkit-appearance: auto;
}

/* Form groups */
.modal .form-group {
    margin-bottom: 1rem;
}
.modal .font-weight-bold {
    font-weight: 600 !important;
}
.modal label.font-weight-bold {
    font-size: 0.82rem;
    color: #1e293b;
    margin-bottom: 0.35rem;
}

/* Form controls */
.modal .form-control {
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    font-size: 0.88rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s;
}
.modal .form-control:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}

/* OTP digit cells in modals */
.modal .otp-digit {
    width: 44px !important;
    height: 50px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.15s;
}
.modal .otp-digit:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
}
.modal .otp-digit::placeholder {
    color: #cbd5e1;
}

/* Aadhaar input groups */
.modal .aadhaar-group {
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
}
.modal .aadhaar-group:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}

/* Buttons in modals */
.modal .btn-primary {
    background: #0891b2;
    border-color: #0891b2;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.55rem 1rem;
}
.modal .btn-primary:hover { background: #0d6e6e; border-color: #0d6e6e; }
.modal .btn-primary:disabled { background: #94a3b8; border-color: #94a3b8; }

.modal .btn-info {
    background: #0891b2;
    border-color: #0891b2;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.55rem 1rem;
}
.modal .btn-info:hover { background: #0d6e6e; border-color: #0d6e6e; color: #fff; }

.modal .btn-success {
    background: #059669;
    border-color: #059669;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.55rem 1rem;
}
.modal .btn-success:hover { background: #047857; border-color: #047857; }

.modal .btn-outline-secondary {
    border-radius: 8px;
    border-color: #e2e8f0;
    color: #64748b;
}

.modal .btn-block {
    display: block;
    width: 100%;
}

/* Input group (Aadhaar toggle, address @abdm) */
.modal .input-group {
    flex-wrap: nowrap;
}
.modal .input-group .input-group-append {
    display: flex;
}
.modal .input-group .input-group-append .input-group-text,
.modal .input-group .input-group-append .btn {
    border-radius: 0 8px 8px 0;
    border: 1.5px solid #cbd5e1;
    border-left: none;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
}
.modal .input-group .form-control {
    border-radius: 8px 0 0 8px;
}
.modal .input-group .form-control:first-child:last-child {
    border-radius: 8px;
}

/* Alerts */
.modal .alert {
    border-radius: 8px;
    font-size: 0.82rem;
    border: none;
}
.modal .alert-info {
    background: #ecfeff;
    color: #155e75;
}
.modal .alert-danger {
    background: #fef2f2;
    color: #991b1b;
}
.modal .alert-success {
    background: #ecfdf5;
    color: #065f46;
}

/* Cards inside modal (profile confirm step) */
.modal .card {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Consent text styling */
.modal .border-left {
    border-left: 3px solid #e2e8f0 !important;
    padding-left: 1rem;
    margin-top: 0.75rem;
}

/* Tab content padding */
.modal .tab-content {
    padding: 1.5rem !important;
}
/* Fix: hidden tab panes must not take space */
.modal .tab-pane:not(.active) {
    display: none !important;
}
.modal .tab-pane.active {
    display: block !important;
}
/* Fix: jQuery .show() must override d-none */
.modal #loginProfileAddressRow[style*="display: block"],
.modal #loginProfileAddressRow[style*="display:block"] {
    display: block !important;
}

/* BS4 mr-* spacing */
.modal .d-flex {
    gap: 0.35rem;
}

/* Login method btn-group-toggle */
.modal .btn-group-toggle .btn {
    border-radius: 6px !important;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #475569;
}
.modal .btn-group-toggle .btn.active,
.modal .btn-group-toggle .btn-check:checked + .btn {
    background: #0891b2;
    border-color: #0891b2;
    color: #fff;
}

/* Radio/checkbox inline */
.modal .custom-control-inline {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

/* Login & Link modal */
#abhaLoginModal .modal-dialog.modal-lg {
    max-width: 680px;
}

/* Login step 1: auth mode + ABHA input side by side when both visible */
#abhaLoginModal #login-step1 {
    display: flex;
    flex-wrap: wrap;
}
#abhaLoginModal #login-step1 > * {
    width: 100%;
}
/* When auth mode is visible, put it and input side by side */
#abhaLoginModal #loginAuthModeGroup:not(.d-none) {
    width: 45%;
    padding-right: 1rem;
}
#abhaLoginModal #loginAuthModeGroup:not(.d-none) ~ #loginIdGroup {
    width: 55%;
}
/* Center Send OTP button */
#abhaLoginModal #login-step1 > .btn {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    width: 100%;
}
/* Center input when auth mode is hidden (Aadhaar/Find by Mobile) */
#abhaLoginModal #loginAuthModeGroup.d-none ~ #loginIdGroup {
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 576px) {
    #abhaLoginModal #loginAuthModeGroup:not(.d-none) {
        width: 100%;
        padding-right: 0;
    }
    #abhaLoginModal #loginAuthModeGroup:not(.d-none) ~ #loginIdGroup {
        width: 100%;
    }
}

/* Guest login form — phone and password side by side */
#guestFormArea .form-group:has(#guestLoginPhone) {
    display: inline-block;
    width: 48%;
    margin-right: 2%;
    vertical-align: top;
}
#guestFormArea .form-group:has(#guestLoginPass) {
    display: inline-block;
    width: 48%;
    vertical-align: top;
}
#guestFormArea .form-group:has(#guestLoginOtp) {
    display: inline-block;
    width: 48%;
    vertical-align: top;
}
/* Guest Login & Link — handled via form-row col-md-6 in JS */

/* Profile photo in confirm step */
.modal .card .rounded.bg-light {
    border-radius: 10px !important;
}

/* Wider modal for login method radios to fit single row */
.modal .modal-dialog.modal-lg {
    max-width: 680px;
}

/* Login method radios — single row */
.modal .custom-control-inline {
    margin-right: 0.75rem;
    margin-bottom: 0.25rem;
}
.modal .custom-control-inline .custom-control-label {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Guest register form — uses BS4 .form-row + .col-md-* (support both grid systems) */
.modal #guestFormArea .form-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -5px;
    margin-right: -5px;
}
.modal #guestFormArea .form-row > [class*="col-"] {
    padding-left: 5px;
    padding-right: 5px;
}
.modal #guestFormArea .form-row > .col-md-6 { flex: 0 0 50%; max-width: 50%; }
.modal #guestFormArea .form-row > .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }

/* Three-col rows for non-form-row fallback: Address + City + State */
.modal #guestFormArea .card-body > .form-group:has(#guestRegAddress),
.modal #guestFormArea .card-body > .form-group:has(#guestRegCity),
.modal #guestFormArea .card-body > .form-group:has(#guestRegState) {
    width: 31%;
}

/* Guest Login & Link form — force col-md-6 inside modal regardless of viewport */
.modal #guestFormArea .card.border-info .form-row > .col-md-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
}
/* Login & Link button alongside password row */
.modal #guestFormArea #guestLoginSubmit {
    margin-top: 0.5rem;
}
/* Login method + button side by side */
.modal #guestFormArea .form-group:has([name="guestLoginMethod"]) {
    width: 55% !important;
}
.modal #guestFormArea #guestLoginSubmit {
    width: 42% !important;
    align-self: flex-end;
    margin-bottom: 1rem;
}

/* Sync/Skip buttons side by side */
.modal #guestSyncArea .row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
}
.modal #guestSyncArea .row > .col-6 {
    flex: 1;
    width: auto;
    max-width: none;
}

/* Full-width overrides for sync area */
.modal #guestSyncArea .alert,
.modal #guestSyncArea .card,
.modal #guestSyncArea p {
    width: 100%;
}

/* Responsive modal */
@media (max-width: 576px) {
    .modal .modal-dialog { margin: 0.5rem; max-width: calc(100% - 1rem); }
    .modal .tab-content { padding: 1rem !important; }
    .modal .otp-digit { width: 38px !important; height: 42px; font-size: 1rem; }
    .modal .aadhaar-group { font-size: 0.88rem; letter-spacing: 1px; }
    .modal .nav-tabs .nav-link { font-size: 0.7rem; padding: 0.5rem 0.25rem; }
    /* Stack form fields on mobile */
    .modal #guestFormArea .form-row > [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .modal #guestFormArea .card-body > .form-group,
    .modal #guestFormArea .form-group,
    .modal #guestFormArea #guestPassGroup,
    .modal #guestFormArea #guestOtpGroup,
    .modal #guestFormArea #guestLoginSubmit {
        width: 100% !important;
    }
    .modal .custom-control-inline { margin-right: 0.5rem; }
}

/* ---------- BS4 Badge Compatibility (consent section) ---------- */
.badge-success, .badge-primary { background: #059669; color: #fff; }
.badge-danger { background: #dc2626; color: #fff; }
.badge-warning { background: #f59e0b; color: #1a1a2e; }
.badge-secondary { background: #64748b; color: #fff; }
.badge-info { background: #0891b2; color: #fff; }
.badge-light { background: #f1f5f9; color: #334155; }
.badge-dark { background: #1e293b; color: #fff; }

/* BS4 btn-outline-* fix for filter bars */
.btn-outline-success { color: #059669; border-color: #059669; }
.btn-outline-success:hover, .btn-outline-success.active { background: #059669; color: #fff; }
.btn-outline-danger { color: #dc2626; border-color: #dc2626; }
.btn-outline-danger:hover, .btn-outline-danger.active { background: #dc2626; color: #fff; }
.btn-outline-warning { color: #d97706; border-color: #d97706; }
.btn-outline-warning:hover, .btn-outline-warning.active { background: #d97706; color: #fff; }
.btn-outline-info { color: #0891b2; border-color: #0891b2; }
.btn-outline-info:hover, .btn-outline-info.active { background: #0891b2; color: #fff; }
.btn-outline-primary { color: #0d6e6e; border-color: #0d6e6e; }
.btn-outline-primary:hover, .btn-outline-primary.active { background: #0d6e6e; color: #fff; }

/* Consent filter bar badges inside buttons */
.abdm-filter-bar .badge, .btn .badge {
    font-size: 0.65rem;
    padding: 0.2em 0.5em;
    vertical-align: middle;
}

/* ---------- Print ---------- */
@media print {
    .abdm-footer, .navbar, .noPrint, .nav-tabs { display: none !important; }
    .tab-pane { display: block !important; opacity: 1 !important; }
    .abdm-card, .abdm-section, .abdm-abha-section { box-shadow: none; border: 1px solid #ddd; }
}
