/* 4BroKhata public frontend — mobile + OTP (max-width: 767px). Desktop unchanged via overrides scoped to mobile. */

/* ── OTP gate (navy site palette + dark card + keypad) ─ */
#otpGate.otp-gate {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(160deg, #0f172a 0%, #1a237e 45%, #1565c0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
}

html.otp-ok #otpGate {
    display: none !important;
}

#otpMain {
    display: none;
}

html.otp-ok #otpMain {
    display: block;
}

.otp-gate__card {
    width: 100%;
    max-width: 320px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(100, 181, 246, 0.25);
    border-radius: 20px;
    padding: 28px 18px 22px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.otp-gate__icon {
    text-align: center;
    color: #64b5f6;
    font-size: 28px;
    margin-bottom: 12px;
    line-height: 1;
}

.otp-gate__title {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: 0.02em;
}

.otp-gate__hint {
    color: rgba(203, 213, 225, 0.9);
    font-size: 14px;
    text-align: center;
    margin: 0 0 20px;
}

.otp-gate__dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 24px;
}

.otp-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #64b5f6;
    background: transparent;
    transition: background 0.15s, transform 0.15s;
}

.otp-dot.is-filled {
    background: linear-gradient(135deg, #42a5f5, #1565c0);
    border-color: #90caf9;
    box-shadow: 0 0 8px rgba(66, 165, 245, 0.5);
}

.otp-gate__keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 280px;
    margin: 0 auto;
}

.otp-gate__key {
    min-height: 52px;
    border: 1px solid rgba(100, 181, 246, 0.35);
    border-radius: 14px;
    background: rgba(30, 58, 95, 0.85);
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, transform 0.08s;
}

.otp-gate__key:active {
    transform: scale(0.97);
    background: rgba(21, 101, 192, 0.55);
}

.otp-gate__key--action {
    font-size: 20px;
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.9);
}

.otp-gate__key--enter {
    background: linear-gradient(135deg, #1565c0 0%, #42a5f5 100%);
    border-color: rgba(144, 202, 249, 0.6);
    color: #fff;
    font-size: 24px;
}

.otp-gate__key--enter:active {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
}

.otp-gate__err {
    color: #fecaca;
    font-size: 13px;
    margin: 16px 0 0;
    min-height: 20px;
    text-align: center;
}

@keyframes otpShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.otp-gate__dots--shake-target.otp-shake {
    animation: otpShake 0.45s ease;
}

/* ── Mobile layout (≤767px) — app-like polish ───────── */
@media (max-width: 767px) {
    html.otp-ok body {
        overflow-x: hidden;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    }

    .fe-app-shell {
        padding-bottom: env(safe-area-inset-bottom, 0);
        min-height: 100vh;
        min-height: 100dvh;
    }

    /* Sticky app header */
    .fe-app-navbar.fe-navbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        min-height: 52px;
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 0.5rem !important;
        background: rgba(26, 43, 107, 0.92) !important;
        background-image: none !important;
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    .fe-navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        max-width: 100%;
    }

    .fe-navbar .navbar-brand {
        font-size: 18px;
        font-weight: 700;
        padding: 0;
        margin: 0;
        letter-spacing: -0.02em;
    }

    .fe-navbar .btn-admin {
        font-size: 12px;
        font-weight: 600;
        padding: 8px 16px;
        border-radius: 999px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        border-width: 1.5px;
    }

    /* Hero — app “home” */
    .fe-hero {
        background: linear-gradient(165deg, #0f172a 0%, #1a2b6b 40%, #1e40af 100%) !important;
        padding: 20px 16px 28px !important;
        padding-top: max(16px, env(safe-area-inset-top, 0px)) !important;
    }

    .fe-hero .fe-hero-inner {
        max-width: 100%;
    }

    .fe-app-hero-brand {
        margin-bottom: 20px;
    }

    .fe-app-icon-wrap {
        width: 64px;
        height: 64px;
        margin: 0 auto 14px;
        border-radius: 18px;
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
        border: 1px solid rgba(255, 255, 255, 0.25);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        color: #fff;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .fe-app-hero-title {
        font-size: 1.5rem;
        font-weight: 800;
        letter-spacing: -0.03em;
        margin: 0 0 6px;
        color: #fff;
    }

    .fe-app-hero-tagline {
        font-size: 13px;
        color: rgba(226, 232, 240, 0.85);
        margin: 0;
        font-weight: 500;
    }

    .fe-stat-stack {
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-width: 100%;
        margin: 0 auto;
    }

    .fe-stat-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
        border-radius: 16px;
        min-height: 76px;
        padding: 0 18px;
        width: 100%;
        box-sizing: border-box;
        border: none;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08), 0 0 1px rgba(15, 23, 42, 0.06);
    }

    .fe-stat-row {
        transition: transform 0.15s ease;
    }

    .fe-stat-row:active {
        transform: scale(0.99);
    }

    .fe-stat-row .fe-stat-label {
        font-size: 13px;
        color: #64748b;
        font-weight: 500;
        margin: 0;
    }

    .fe-stat-row .fe-stat-val {
        font-size: 18px;
        font-weight: 700;
        margin: 0;
        letter-spacing: -0.02em;
        font-variant-numeric: tabular-nums;
    }

    .fe-stat-row .fe-stat-val--amad {
        color: #16a34a;
    }

    .fe-stat-row .fe-stat-val--kharcha {
        color: #dc2626;
    }

    .fe-stat-row .fe-stat-val--bal-pos {
        color: #16a34a;
    }

    .fe-stat-row .fe-stat-val--bal-neg {
        color: #dc2626;
    }

    /* Home — sheet-style list section */
    .fe-statements-wrap.fe-app-section {
        padding-top: 8px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-top: -12px;
        border-radius: 22px 22px 0 0;
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%);
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .fe-section-label {
        display: block;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #64748b;
    }

    .fe-statements-title {
        margin: 8px 20px 14px !important;
    }

    .fe-statements-grid {
        display: block !important;
        margin: 0 !important;
    }

    .fe-statements-grid > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 12px;
    }

    .fe-stmt-card {
        margin: 0 16px 14px !important;
        width: calc(100% - 32px) !important;
        max-width: none !important;
        border-radius: 18px !important;
        border: none !important;
        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.09), 0 0 1px rgba(15, 23, 42, 0.06) !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .fe-stmt-card:active {
        transform: scale(0.985);
    }

    .fe-stmt-card .card-body {
        padding: 16px !important;
    }

    .fe-stmt-card .card-title {
        font-size: 16px !important;
        font-weight: 600 !important;
        margin-bottom: 4px !important;
    }

    .fe-stmt-card .fe-stmt-date {
        font-size: 13px;
        color: #6b7280;
        margin-bottom: 12px !important;
    }

    .fe-stmt-card .fe-stmt-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        margin-bottom: 8px;
    }

    .fe-stmt-card .fe-stmt-row-label {
        font-size: 13px;
        color: #6b7280;
    }

    .fe-stmt-card .fe-stmt-divider {
        border-top: 1px solid #e5e7eb;
        margin: 12px 0;
    }

    .fe-stmt-card .fe-stmt-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .fe-stmt-card .fe-bal-pill {
        font-size: 13px;
        border-radius: 20px;
        padding: 5px 14px;
        color: #fff !important;
        font-weight: 600;
    }

    .fe-stmt-card .fe-bal-pill.bg-success {
        background: #16a34a !important;
    }

    .fe-stmt-card .fe-bal-pill.bg-danger {
        background: #dc2626 !important;
    }

    .fe-stmt-card .btn-view {
        border-radius: 999px;
        font-size: 13px;
        font-weight: 600;
        padding: 10px 18px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    }

    .fe-pagination-wrap {
        padding: 0 16px 8px;
    }

    .fe-pagination-wrap .pagination {
        margin-bottom: 0;
        gap: 4px;
    }

    .fe-pagination-wrap .page-link {
        border-radius: 10px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Footer */
    footer.fe-footer {
        font-size: 13px;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        background: #0f172a !important;
        color: rgba(255, 255, 255, 0.65) !important;
        margin-top: 0 !important;
    }

    /* Statement — app-style top bar + actions */
    .fe-app-topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px 12px;
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
        border-bottom: 1px solid #e2e8f0;
    }

    .fe-app-topbar__back {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        color: #1a2b6b;
        font-size: 20px;
        line-height: 1;
        text-decoration: none;
        background: #f3f4f6;
        box-shadow: none;
        border: 1px solid #e5e7eb;
        transition: transform 0.12s ease, background 0.12s ease;
    }

    .fe-app-topbar__back:active {
        transform: scale(0.95);
    }

    .fe-app-topbar__title {
        flex: 1;
        min-width: 0;
        font-size: 16px;
        font-weight: 700;
        color: #0f172a;
        line-height: 1.25;
    }

    .fe-app-topbar__spacer {
        width: 40px;
        flex-shrink: 0;
    }

    .fe-app-date-chip {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        background: #fff;
        border-radius: 999px;
        border: 1px solid #e2e8f0;
        font-weight: 500;
        color: #475569;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    }

    .statement-page-head {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Share + Back row: hidden on mobile — use floating FAB only (see statement.blade.php) */
    .fe-statement-public .statement-share-buttons-row {
        display: none !important;
    }

    /* Statement capture — public frontend only (admin uses same partial without publicMobile) */
    .fe-statement-public .statement-desktop-table {
        display: none !important;
    }

    .fe-statement-public .statement-mobile-stack {
        display: block !important;
        padding: 0 0 8px;
    }

    .fe-statement-public.statement-page-container {
        padding-top: 0 !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    }

    .fe-statement-public #statement-capture {
        border-width: 0 !important;
        margin-left: 16px !important;
        margin-right: 16px !important;
        width: calc(100% - 32px) !important;
        max-width: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .statement-mobile-card {
        border-radius: 16px !important;
        overflow: hidden;
        border: none !important;
        background: #fff;
        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    }

    .statement-mobile-card__head {
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        color: #fff;
        font-size: 13px;
        font-weight: 700;
        padding: 12px 16px;
        letter-spacing: 0.02em;
    }

    .statement-mobile-card__head--amad {
        background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    }

    .statement-mobile-card .table {
        margin-bottom: 0;
    }

    .statement-mobile-card .table th,
    .statement-mobile-card .table td {
        border-color: #eee;
        vertical-align: middle;
    }

    .fe-statement-public .statement-mobile-balance-banner {
        width: calc(100% - 32px);
        margin: 0 16px 16px;
        min-height: 84px;
        padding: 14px 16px;
        background: linear-gradient(145deg, #fcd34d 0%, #fbbf24 50%, #f59e0b 100%);
        border-radius: 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        box-shadow: 0 8px 24px rgba(245, 158, 11, 0.28);
        border: 1px solid rgba(251, 191, 36, 0.6);
    }

    .statement-mobile-balance-banner .fe-bal-amt {
        font-size: 30px;
        font-weight: 800;
        color: #0f172a;
        line-height: 1.1;
        font-variant-numeric: tabular-nums;
    }

    .statement-mobile-balance-banner .fe-bal-lbl {
        font-size: 12px;
        color: #78350f;
        font-weight: 600;
        margin-top: 4px;
    }

    .statement-note-mobile {
        margin: 0 16px 16px !important;
        width: calc(100% - 32px) !important;
        border-radius: 14px !important;
        padding: 14px 16px !important;
        font-size: 13px !important;
        box-sizing: border-box;
        border: 1px solid #bae6fd !important;
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
        color: #0c4a6e !important;
    }

    .statement-page-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Desktop: hide mobile-only pieces (public statement page) */
@media (min-width: 768px) {
    .fe-statement-public .statement-mobile-stack,
    .fe-statement-public .statement-mobile-balance-banner {
        display: none !important;
    }

    .fe-statement-public .statement-desktop-table {
        display: block !important;
    }
}
