/* ==========================================
   MunyBank - App Styles
   Mobile-first design
   ========================================== */

:root {
    --primary: #1a3a6b;
    --primary-light: #2563eb;
    --primary-dark: #0f2444;
    --gold: #d4a017;
    --gold-light: #f0c040;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%;
    font-family: 'Noto Sans Lao', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    overflow-x: hidden;
}

/* ---- Layout ---- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding-bottom: 80px; }

/* ---- Navbar ---- */
.navbar-main {
    background: var(--primary) !important;
    box-shadow: 0 2px 12px rgba(26,58,107,0.25);
    padding: 10px 16px;
    position: sticky; top: 0; z-index: 1030;
}
.navbar-main .navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff !important;
    display: flex; align-items: center; gap: 8px;
}
.navbar-main .navbar-brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav-user-badge {
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: #fff;
    display: inline-flex;
    align-items: center;
}

/* Desktop Menu Navigation */
.desktop-menu-nav .nav-link {
    color: rgba(255,255,255,0.8) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 14px !important;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 0 2px;
}
.desktop-menu-nav .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.12);
}
.desktop-menu-nav .nav-link.active {
    color: var(--gold-light) !important;
    background: rgba(255,255,255,0.18);
    font-weight: 600;
}

/* Desktop Container adjustments */
@media (min-width: 992px) {
    .container-fluid {
        max-width: 1200px;
        margin: 0 auto;
    }
    .balance-card {
        padding: 28px;
    }
    .balance-amount {
        font-size: 2.5rem;
    }
}

/* ---- Bottom Nav (Mobile) ---- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--primary-dark);
    display: flex; justify-content: space-around; align-items: center;
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
    z-index: 1020;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.65rem; gap: 2px;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}
.bottom-nav a.active, .bottom-nav a:hover {
    color: var(--gold-light);
    background: rgba(255,255,255,0.08);
}
.bottom-nav a i { font-size: 1.35rem; }

/* ---- Cards ---- */
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-weight: 600;
    padding: 12px 16px;
}

/* ---- Balance Card ---- */
.balance-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.balance-card::before {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -60px; right: -60px;
}
.balance-label { font-size: 0.8rem; opacity: 0.8; }
.balance-amount {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.1;
}
.balance-currency { font-size: 1rem; opacity: 0.8; }
.balance-bank { font-size: 0.85rem; opacity: 0.7; margin-top: 4px; }

/* ---- Stats ---- */
.stat-chip {
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
}
.stat-chip .val { font-size: 1.1rem; font-weight: 700; }
.stat-chip .lbl { font-size: 0.7rem; opacity: 0.8; }

/* ---- Transaction List ---- */
.tx-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:active { background: #f8fafc; }
.tx-icon {
    width: 42px; height: 42px;
    background: #e0edff;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--primary-light);
}
.tx-info { flex: 1; min-width: 0; }
.tx-bank { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 0.75rem; color: var(--text-muted); }
.tx-amount { font-weight: 700; font-size: 1rem; color: var(--success); white-space: nowrap; }

/* ---- Form Styles ---- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 10px 14px;
    font-size: 1rem;
    font-family: 'Noto Sans Lao', sans-serif;
    transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.input-group .form-control { border-radius: var(--radius-sm) !important; }

/* ---- Buttons ---- */
.btn {
    font-family: 'Noto Sans Lao', sans-serif;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}
.btn-gold:hover { background: #b8880f; border-color: #b8880f; color: #fff; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-fab {
    position: fixed; bottom: 88px; right: 20px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    z-index: 1010;
    transition: transform 0.2s;
}
.btn-fab:hover { transform: scale(1.08); }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { width: 80px; height: 80px; border-radius: 20px; }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-top: 12px; }

/* ---- Image Preview ---- */
.img-preview-wrap {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    min-height: 140px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; cursor: pointer;
    background: #f8fafc;
    transition: border-color 0.2s;
}
.img-preview-wrap:hover { border-color: var(--primary-light); }
.img-preview-wrap img { width: 100%; height: 200px; object-fit: cover; }
.img-placeholder { text-align: center; color: var(--text-muted); padding: 20px; }
.img-placeholder i { font-size: 2.5rem; display: block; margin-bottom: 8px; }

/* ---- Photo Modal ---- */
.photo-modal img { width: 100%; border-radius: 12px; }

/* ---- Badges ---- */
.badge { font-family: 'Noto Sans Lao', sans-serif; font-size: 0.72rem; }

/* ---- Search Bar ---- */
.search-bar { position: relative; }
.search-bar .form-control { padding-left: 40px; }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ---- Date separator ---- */
.date-separator {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 8px 0;
    display: flex; align-items: center; gap: 8px;
}
.date-separator::before, .date-separator::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ---- Alert ---- */
.alert { border-radius: var(--radius-sm); font-size: 0.9rem; }

/* ---- Section Title ---- */
.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px 6px;
}

/* ---- Setup page ---- */
.setup-page { min-height: 100vh; background: var(--bg); padding: 24px; }
.setup-card { max-width: 600px; margin: 0 auto; }

/* ---- Spinner overlay ---- */
.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.spinner-overlay .spinner-border { width: 3rem; height: 3rem; color: #fff; }

/* ---- Admin table ---- */
.table { font-size: 0.88rem; }
.table th { font-weight: 600; white-space: nowrap; }

/* ---- Adjustment ---- */
.adj-row {
    background: #fff8e1;
    border-left: 4px solid var(--gold);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 8px 12px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- PWA install prompt ---- */
#pwa-install { display: none; }
#pwa-install.show { display: flex; }

/* ---- Toast ---- */
.toast-container { z-index: 9999 !important; }

/* ---- Admin Incoming Transaction Alert Banner ---- */
.tx-notify-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 380px;
    width: calc(100% - 40px);
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.22);
    border-left: 6px solid var(--success);
    z-index: 10000;
    overflow: hidden;
    animation: slideInNotify 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInNotify {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.tx-notify-header {
    background: #f0fdf4;
    color: var(--success);
    font-weight: 700;
    padding: 10px 14px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dcfce7;
}

.tx-notify-body {
    padding: 12px 14px;
}

.tx-notify-amount {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--success);
    letter-spacing: -0.5px;
}

@media (min-width: 768px) {
    .main-content { padding-bottom: 20px; }
    .bottom-nav { display: none; }
    .btn-fab { bottom: 24px; }
}

/* ---- Slip Lightbox & Zoom Viewer ---- */
.slip-lightbox {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 15, 25, 0.96);
    z-index: 10080;
    display: none;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    animation: slipFadeIn 0.2s ease-out;
}
.slip-lightbox.active {
    display: flex;
}
@keyframes slipFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.slip-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    z-index: 2;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.slip-lightbox-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.slip-lightbox-controls .btn {
    padding: 4px 10px;
    font-size: 0.85rem;
}
.slip-lightbox-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    cursor: grab;
    width: 100%;
    height: 100%;
}
.slip-lightbox-body.grabbing {
    cursor: grabbing;
}
.slip-lightbox-img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    transition: transform 0.06s ease-out;
    pointer-events: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    border-radius: 6px;
    will-change: transform;
}
.slip-preview-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    background: #0f172a;
    text-align: center;
}
.slip-preview-container img {
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.slip-preview-container:hover img {
    transform: scale(1.02);
    opacity: 0.95;
}
.slip-preview-overlay-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 0.8rem;
    padding: 5px 12px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.slip-zoom-hint-btn {
    transition: all 0.15s ease;
}
.slip-zoom-hint-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

