/* ==========================================
   1. CORE VARIABLES & BASE STYLES
   ========================================== */
:root {
    --bg: #fdfbf7;
    --txt: #1a1a1a;
    --card-bg: #ffffff;
    --primary: #2c3e50; 
    --accent: #e74c3c;  /* Dynamic: Overridden by JS */
    --muted: #999999;
    --border: #eeeeee;
    --shadow: 0 4px 20px rgba(0,0,0,0.05);
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
    outline: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    margin: 0; 
    padding: 0; 
    color: var(--txt);
    overflow-x: hidden;
}

/* Bulma Mobile Grid Fix */
.columns.is-mobile > .column.is-6-mobile { width: 50%; }

/* ==========================================
   2. SPLASH SCREEN
   ========================================== */
#splash {
    position: fixed; inset: 0; background: #fff; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.8s ease-out;
}
.splash-logo {
    width: 130px; height: 130px; object-fit: contain;
    animation: PulseZoom 2s infinite ease-in-out alternate;
    display: none;
}
.loading-txt { 
    margin-top: 25px; font-size: 0.7rem; letter-spacing: 2.5px; 
    color: var(--muted); font-weight: 700; text-transform: uppercase;
}
@keyframes PulseZoom { 
    0% { transform: scale(0.95); opacity: 0.8; } 
    100% { transform: scale(1.05); opacity: 1; } 
}

/* ==========================================
   3. PORTAL UI & HEADER
   ========================================== */
.view { display: none; padding-bottom: 140px; opacity: 0; transition: opacity 0.6s; }
.view.is-active { display: block; opacity: 1; }

.ph { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1rem 1.5rem;
    position: relative;
}
.ph-spacer { width: 45px; } 

.top-logo { 
    height: 65px; width: 65px; object-fit: contain; 
    background: #fff; padding: 5px; border: 1px solid var(--border); border-radius: 12px; 
}

.bb { 
    height: 150px; width: 150px; object-fit: contain; 
    background: #fff; padding: 5px; border: 1px solid var(--border); border-radius: 12px; 
}

.ph-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: 0.2s;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.ph-icon i {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ph-icon:active { transform: scale(0.9); background: #f5f5f5; }
.ph-icon.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.mh { text-align: center; padding: 0 1rem; }
.cw { 
    width: 145px; height: 145px; margin: 0 auto; 
    border-radius: 20%; overflow: hidden; 
    background: #f4f4f4; box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    border: 4px solid #fff;
}
.cw img { width: 100%; height: 100%; object-fit: cover; }

.leader-name { font-size: 1.35rem; font-weight: 800; margin-top: 1.2rem; color: var(--primary); }
.leader-title { 
    font-size: 0.65rem; color: var(--muted); font-weight: 700; 
    text-transform: uppercase; letter-spacing: 1.5px; margin-top: 5px;
}

.acts { display: flex; justify-content: center; gap: 20px; margin-top: 25px; flex-wrap: wrap; }
.act-btn { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: 0.2s; width: 60px; }
.act-btn:active { transform: scale(0.9); }
.act-btn i { font-size: 1.5rem; color: var(--primary); margin-bottom: 8px; }
.act-btn span { font-size: 0.5rem; font-weight: 800; color: #666; letter-spacing: 1px; text-transform: uppercase; }

.sep-line { width: 100%; height: 1px; background: var(--border); margin: 2.5rem 0; }

/* ==========================================
   4. ASSOCIATE CARDS
   ========================================== */
.card-base {
    background: var(--card-bg); border-radius: 24px; padding: 1.2rem 0.8rem;
    display: flex; flex-direction: column; align-items: center;
    border: 1px solid #f0f0f0; box-shadow: var(--shadow);
    height: 100%; cursor: pointer; transition: transform 0.2s;
    position: relative;
}
.card-base:active { transform: scale(0.96); background-color: #f9f9f9; }

.aa { 
    width: 75px; height: 75px; border-radius: 50%; overflow: hidden; 
    background: #f8f8f8; margin-bottom: 0.8rem; object-fit: cover;
    border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.ln { font-size: 0.85rem; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; text-align: center; }
.branch-info { text-align: center; margin-bottom: 12px; }
.b-name { display: block; font-size: 0.6rem; font-weight: 600; color: #4a4a4a; }
.b-loc { display: block; font-size: 0.55rem; color: var(--muted); }

.sm-acts { display: flex; gap: 10px; margin-top: auto; color: var(--muted); opacity: 0.4; justify-content: center; }
.sm-acts i { font-size: 0.8rem; }

/* Branch List Styling */
.branches-list { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    margin: 8px 0 12px;
    width: 100%;
}
.branch-tag { 
    display: flex; 
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 6px 10px;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}
.branch-tag .b-name { 
    font-size: 0.65rem; 
    font-weight: 700; 
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.branch-tag .b-loc { 
    font-size: 0.6rem; 
    color: var(--muted);
    margin-top: 2px;
}

/* Multi-branch card fix */
.card-base .branches-list:has(.branch-tag:nth-child(2)) {
    gap: 8px;
}

/* Card height consistency */
#assocGrid .column { margin-bottom: 1rem; }
#assocGrid .card-base { min-height: 280px; }

/* ==========================================
   5. DRAWERS & MODALS
   ========================================== */
.oc { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100dvh; 
    background: rgba(255,255,255,0.98); z-index: 6000; 
    opacity: 0; pointer-events: none; transition: opacity .3s ease; 
    display: flex; align-items: center; justify-content: center;
}
.oc.is-open { opacity: 1; pointer-events: auto; }
.occ { width: 100%; max-width: 450px; padding: 2.5rem; position: relative; max-height: 90vh; overflow-y: auto; }

.c-btn-x { 
    position: absolute; top: 15px; right: 15px;
    border: none; background: #f5f5f5; width: 35px; height: 35px; border-radius: 50%;
    font-size: 1rem; cursor: pointer; z-index: 10; display: flex; align-items: center; justify-content: center;
}

.drawer-header { text-align: center; margin-bottom: 2rem; }
.drawer-user-name { font-weight: 800; font-size: 1.1rem; margin-top: 10px; color: var(--primary); }
.drawer-sub-label { font-size: 0.6rem; color: var(--muted); letter-spacing: 2px; font-weight: 700; text-transform: uppercase; }

.custom-input {
    border-radius: 12px !important;
    border: 1.5px solid var(--border) !important;
    padding: 25px 15px !important;
    font-weight: 600;
}
.custom-select-wrap select {
    border-radius: 12px !important;
    height: 50px !important;
    border: 1.5px solid var(--border) !important;
    font-weight: 600;
}

.custom-select { 
    position: relative; width: 100%; height: 52px; 
    background: #fff; border: 1.5px solid var(--border); border-radius: 14px; margin-bottom: 12px;
}
.custom-select select {
    width: 100%; height: 100%; padding: 0 15px; background: transparent;
    border: none; outline: none; font-size: 0.95rem; font-weight: 700; appearance: none;
    font-family: 'Courier New', Courier, monospace;
}
.custom-select .caret { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); pointer-events: none; }

.s-btn { 
    width: 100%; padding: 18px; background: var(--primary); color: #fff; 
    font-weight: 800; text-transform: uppercase; border: none; border-radius: 14px; cursor: pointer;
    transition: 0.2s;
}
.s-btn:active { background: #000; transform: scale(0.98); }

.drawer-list { margin-top: 1rem; }
.vi { 
    padding: 14px 0; border-bottom: 1px solid #f9f9f9; cursor: pointer; 
    font-size: 0.95rem; transition: 0.2s;
}
.vi:active { background: #f5f5f5; }

.list-thumb { width: 50px; height: 50px; border-radius: 10px; object-fit: cover; background: #eee; }
.date-box { 
    width: 45px; height: 45px; background: #f8f8f8; border-radius: 10px; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #eee;
}
.date-box span { font-size: 0.55rem; font-weight: 700; color: var(--muted); }
.date-box b { font-size: 0.95rem; }

/* ==========================================
   6. MEMBER CARD & SCANNER UI
   ========================================== */
.member-card-ui {
    background: linear-gradient(135deg, var(--primary) 0%, #000 100%);
    color: white;
    border-radius: 24px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    position: relative;
    overflow: hidden;
}
.member-card-ui::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
}
.card-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 1.5rem; }
.card-logo-sm { height: 24px; filter: brightness(0) invert(1); }
.card-header span { font-size: 0.65rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }

.qr-placeholder {
    background: white;
    color: #000;
    width: 130px;
    height: 130px;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.card-footer {
    margin-top: 1.5rem; font-size: 0.55rem; letter-spacing: 2px; font-weight: 700;
    border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1rem; opacity: 0.5;
}

/* Scanner Logic UI */
.scan-trigger-container {
    display: flex; flex-direction: column; align-items: center;
    margin-bottom: 2rem; cursor: pointer;
}
.scan-btn-circle {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--accent) 0%, #ff7e5f 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.8rem;
    box-shadow: 0 10px 25px rgba(231, 76, 60, 0.4);
    animation: PulseBtn 2s infinite;
    margin-bottom: 10px;
}
.scan-label {
    font-size: 0.7rem; font-weight: 800; letter-spacing: 1px;
    color: var(--primary);
}
@keyframes PulseBtn {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

#scannerView { text-align: center; }
.scan-anim-icon {
    width: 50px; height: 50px; margin: 0 auto 10px;
    background: #f0f0f0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #666;
}

/* ==========================================
   7. UNIFIED PLAYER OVERLAY
   ========================================== */
#pv { 
    position: fixed; inset: 0; background: #fff; z-index: 7000; 
    transform: translateY(100%); transition: transform .5s cubic-bezier(.19,1,.22,1); 
    display: flex; flex-direction: column; 
}
#pv.is-open { transform: translateY(0); }

.p-head { padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.p-mode-tag { font-size: 0.65rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.ib { border: none; background: none; font-size: 1.3rem; color: var(--primary); cursor: pointer; padding: 10px; }

.vl { flex: 1; overflow-y: auto; padding: 1.5rem 1.5rem 180px; font-family: 'Courier New', Courier, monospace; }
.vl .vi b { font-size: 0.7rem; vertical-align: super; margin-right: 10px; color: var(--muted); }
.vl .vi.is-active { color: #000; font-weight: 700; border-left: 4px solid var(--accent); padding-left: 12px; }

#bookStage { flex: 1; display: none; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 80px; }
.book-cover-large { 
    width: 280px; height: 280px; object-fit: cover; 
    border-radius: 28px; box-shadow: 0 30px 60px rgba(0,0,0,0.15); 
}

#pv.mode-bible .vl { display: block; }
#pv.mode-bible #bookStage { display: none; }
#pv.mode-book .vl { display: none; }
#pv.mode-book #bookStage { display: flex; }

.p-foot { position: absolute; bottom: 0; width: 100%; background: #fff; box-shadow: 0 -10px 40px rgba(0,0,0,0.03); }
.sc-wrap { position: relative; height: 4px; background: #f0f0f0; width: 100%; }
.sc-prog { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s linear; }
.sc-inp { position: absolute; top: -15px; left: 0; width: 100%; height: 35px; opacity: 0; cursor: pointer; }

.ctrl-row { display: flex; padding: 1.2rem 1.5rem 2.8rem; align-items: center; }
.foot-left { width: 75px; position: relative; }
.footer-art { 
    width: 70px; height: 70px; border-radius: 14px; object-fit: cover; 
    position: absolute; top: -48px; border: 3px solid #fff; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); background:#eee; 
}
.foot-name { font-size: 0.5rem; font-weight: 800; margin-top: 35px; text-transform: uppercase; color: var(--muted); text-align: center; }

.foot-right { flex: 1; padding-left: 20px; }
.track-ref { font-size: 0.9rem; font-weight: 800; text-align: center; margin-bottom: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
.btn-deck { display: flex; justify-content: space-between; align-items: center; }
.c-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #444; }
.speed-btn { font-size: 0.75rem; font-weight: 800; color: var(--muted); width: 35px; }
.play-btn { font-size: 2.2rem; color: var(--primary); }

/* ==========================================
   8. MINI PLAYER (STICKY)
   ========================================== */
#mp { 
    position: fixed; bottom: 0; width: 100%; height: 78px; 
    background: rgba(255,255,255,0.95); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--border); display: flex; align-items: center; 
    padding: 0 1.2rem; z-index: 5000; 
    transform: translateY(100%); transition: .3s ease-out; 
}
#mp.is-visible { transform: translateY(0); }
.ma { width: 48px; height: 48px; border-radius: 10px; margin-right: 15px; object-fit: cover; background: #eee; }
.m-tit { font-weight: 700; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-art { font-size: 0.65rem; color: var(--muted); margin-top: 2px; }

/* ==========================================
   9. DEVOTIONAL READER
   ========================================== */
.reader-container { 
    max-width: 650px !important; background: #fdfbf7 !important; 
    height: 100dvh; display: block !important; padding: 4rem 2rem !important; 
}
.reader-header { text-align: center; margin-bottom: 3rem; }
.reader-date { font-size: 0.7rem; color: var(--muted); letter-spacing: 2.5px; text-transform: uppercase; font-weight: 700; }
.reader-title { font-size: 1.8rem; font-weight: 800; margin: 15px 0; color: var(--primary); line-height: 1.2; }
.reader-sep { width: 45px; height: 4px; background: var(--accent); margin: 0 auto; border-radius: 2px; }

.reader-body { 
    font-family: 'Georgia', serif; font-size: 1.15rem; line-height: 1.95; 
    color: #222; padding-bottom: 140px; 
}

.scrip-link {
    display: inline-flex; align-items: center; color: var(--accent); 
    font-weight: 700; cursor: pointer; background: rgba(0,0,0,0.03); 
    padding: 2px 10px; border-radius: 8px; margin: 0 2px;
    font-family: 'Courier New', monospace; font-size: 0.85rem;
    border-bottom: 2px solid var(--accent);
}
.scrip-link i { margin-left: 8px; font-size: 0.7rem; opacity: 0.6; }

.hidden { display: none !important; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #eee; border-radius: 10px; }

/* ==========================================
   MEMBERSHIP CARD PAGE STYLES
   ========================================== */
.membership-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
    min-height: 100vh;
    background: var(--bg);
}

.mem-header {
    margin-bottom: 1.5rem;
    padding-top: 1rem;
}

.mem-header .church-logo {
    width: 70px;
    height: 70px;
    margin: 0 auto 0.8rem;
    border-radius: 50%;
    overflow: hidden;
    background: #f4f4f4;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.mem-header .church-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mem-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.mem-subtitle {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0.3rem;
    font-weight: 700;
}

/* Member Card */
.member-card {
    background: linear-gradient(145deg, var(--primary) 0%, #1a1a2e 50%, #16213e 100%);
    border-radius: 24px;
    padding: 1.8rem 1.3rem;
    color: white;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.member-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    border: 1px solid rgba(255,255,255,0.1);
}

.member-photo {
    width: 90px;
    height: 90px;
    margin: 0.5rem auto 1rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: rgba(255,255,255,0.7);
    border: 4px solid rgba(255,255,255,0.25);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

#memName {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 0.3rem;
    letter-spacing: 0.5px;
}

.mem-branch {
    font-size: 0.85rem;
    opacity: 0.85;
    margin: 0;
    font-weight: 500;
}

.mem-divider {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    margin: 1.2rem auto;
    border-radius: 2px;
}

.mem-details {
    text-align: left;
    margin-bottom: 1.2rem;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 1rem;
}

.mem-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.mem-row:last-child {
    border-bottom: none;
}

.mem-label {
    font-size: 0.75rem;
    opacity: 0.6;
    font-weight: 500;
}

.mem-value {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* QR Section */
.qr-section {
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 1rem;
    margin-top: 0.5rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.qr-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 0.8rem;
    opacity: 0.8;
    font-weight: 700;
}

.qr-code {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.qr-code img {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-hint {
    font-size: 0.7rem;
    margin: 0.8rem 0 0;
    opacity: 0.5;
    font-weight: 500;
}

/* Action Buttons */
.mem-actions {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.mem-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.mem-btn:active {
    transform: scale(0.96);
}

.mem-btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(44,62,80,0.3);
}

.mem-btn.secondary {
    background: #f0f0f0;
    color: var(--primary);
}

.mem-btn.checkin {
    width: 100%;
    background: linear-gradient(135deg, var(--accent) 0%, #ff6b6b 100%);
    color: white;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(231,76,60,0.3);
}

.mem-back {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    font-family: inherit;
    font-weight: 600;
    transition: color 0.2s;
}

.mem-back:hover {
    color: var(--primary);
}


.top-logo {
    height: 100px;
    width: 2000px;
    object-fit: contain;
    background: #fff;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

/* ==========================================
   OFFLINE INDICATOR
   ========================================== */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9998;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.offline-indicator.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.offline-indicator i {
    color: #ff9800;
}

/* ==========================================
   GLOBAL ERROR BOUNDARY
   ========================================== */
.global-error {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.global-error .error-content {
    text-align: center;
    max-width: 400px;
}

.global-error h2 {
    color: var(--primary);
    margin-bottom: 10px;
}

.global-error button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 20px;
}

.global-error .error-id {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 15px;
}

/* ==========================================
   NOTIFICATION TOAST
   ========================================== */
.notification-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90%;
    min-width: 280px;
}

.notification-toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification-toast.success {
    background: #27ae60;
}

.notification-toast.error {
    background: #e74c3c;
}

.notification-toast.warning {
    background: #f39c12;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.notification-content i {
    font-size: 1.1rem;
}

.notif-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 4px;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.notif-close:hover {
    color: white;
}

/* ==========================================
   CONFIRM MODAL
   ========================================== */
.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.confirm-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.confirm-box {
    background: white;
    border-radius: 20px;
    padding: 1.8rem;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.confirm-modal.is-visible .confirm-box {
    transform: scale(1);
}

.confirm-header {
    margin-bottom: 1rem;
}

.confirm-header i {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.confirm-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.confirm-box > p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn.primary {
    background: var(--primary);
    color: white;
}

.confirm-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

.confirm-btn:active {
    transform: scale(0.96);
}

/* ==========================================
   MEMBER CARD UPDATES
   ========================================== */
.member-icon-placeholder {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.8);
    border: 3px solid rgba(255,255,255,0.3);
}

.member-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.member-actions-row button {
    color: var(--primary);
    font-weight: 600;
}

.member-actions-row button.has-text-danger {
    color: #e74c3c;
}

/* ==========================================
   LOADING STATES
   ========================================== */
body.is-loading {
    cursor: wait;
}

button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   SCANNER MODAL FOR MEMBERSHIP PAGE
   ========================================== */
.scanner-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.scanner-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.scanner-modal.hidden {
    display: none !important;
}

.scanner-modal-content {
    width: 90%;
    max-width: 400px;
    background: #1a1a1a;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.scanner-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scanner-header h3 i {
    color: var(--accent);
}

.scanner-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.scanner-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.scanner-close:active {
    transform: scale(0.95);
}

.scanner-hint {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    font-size: 0.85rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* Hide QR code placeholder on member card UI */
#regCard .qr-placeholder,
#regCard .qr-code {
    display: none !important;
}

/* ==========================================
   MINIMAL APP MODAL (REPLACES ALERT/PROMPT)
   ========================================== */
.app-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10005;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 1rem;
}

.app-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.app-modal.hidden {
    display: none !important;
}

.app-modal-box {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalPop 0.25s ease;
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.app-modal-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.3rem;
}

.app-modal-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.app-modal-icon.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.app-modal-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.app-modal-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.app-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.app-modal-message {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.app-modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e5e5;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 1.25rem;
    transition: border-color 0.2s;
}

.app-modal-input:focus {
    outline: none;
    border-color: var(--accent);
}

.app-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.app-modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.app-modal-btn:hover {
    transform: translateY(-1px);
}

.app-modal-btn:active {
    transform: translateY(0);
}

.app-modal-btn.secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.app-modal-btn.secondary:hover {
    background: #e5e7eb;
}

.app-modal-btn.primary {
    background: var(--primary);
    color: white;
}

.app-modal-btn.primary:hover {
    background: #1a252f;
}

.app-modal-btn.danger {
    background: #ef4444;
    color: white;
}

.app-modal-btn.danger:hover {
    background: #dc2626;
}
