/* ==========================================================
   Mess 360 — Glass Design System
   ========================================================== */

:root {
    /* Brand */
    --brand-primary: #6C5CE7;
    --brand-primary-2: #8E7CF1;
    --brand-accent: #00D9C0;
    --brand-warn: #FFB020;
    --brand-danger: #FF5470;
    --brand-success: #2ED9A5;

    /* Light mode surfaces */
    --bg-base: #EEF1FA;
    --bg-gradient: radial-gradient(circle at 15% 10%, #E4E9FB 0%, #EEF1FA 40%, #F5F3FC 100%);
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.12);
    --text-primary: #1B1D2A;
    --text-secondary: #5B5F73;
    --text-muted: #8B90A3;
    --blur: 18px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;

    /* Fine grain texture, layered into every card for a tactile, non-flat finish */
    --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

:root[data-theme="dark"] {
    --bg-base: #0D0E1A;
    --bg-gradient: radial-gradient(circle at 15% 10%, #1B1D33 0%, #0D0E1A 45%, #100B1F 100%);
    --glass-bg: rgba(30, 32, 54, 0.55);
    --glass-bg-strong: rgba(30, 32, 54, 0.75);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --text-primary: #F1F2FA;
    --text-secondary: #B4B7CC;
    --text-muted: #7E82A0;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-base: #0D0E1A;
        --bg-gradient: radial-gradient(circle at 15% 10%, #1B1D33 0%, #0D0E1A 45%, #100B1F 100%);
        --glass-bg: rgba(30, 32, 54, 0.55);
        --glass-bg-strong: rgba(30, 32, 54, 0.75);
        --glass-border: rgba(255, 255, 255, 0.10);
        --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
        --text-primary: #F1F2FA;
        --text-secondary: #B4B7CC;
        --text-muted: #7E82A0;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient) fixed;
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }

/* ---------- Glass Card Primitive ---------- */
.glass-card {
    position: relative;
    z-index: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 20px 44px -12px rgba(31, 22, 90, 0.18),
        0 2px 8px rgba(31, 22, 90, 0.06);
    backdrop-filter: blur(var(--blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    overflow: hidden;
    isolation: isolate;
}
:root[data-theme="dark"] .glass-card {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 20px 44px -12px rgba(0, 0, 0, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.25);
}

.glass-card::before {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    background-repeat: no-repeat;
    background-size: cover;
}

/* ---------- Background Mesh Overlays ----------
   Soft, asymmetric gradient meshes + fine grain, sitting behind the
   frosted glass panel — an "aurora behind frosted glass" treatment
   instead of a flat repeating pattern. Each variant carries its own
   color identity so cards read as a family without looking identical. */
.pattern-glass-geo-1::before {
    background-image:
        radial-gradient(120% 90% at 8% -10%, rgba(108, 92, 231, 0.38), transparent 55%),
        radial-gradient(90% 90% at 100% 8%, rgba(142, 124, 241, 0.28), transparent 50%),
        radial-gradient(85% 85% at 90% 115%, rgba(0, 217, 192, 0.20), transparent 55%),
        var(--grain);
    background-blend-mode: normal, normal, normal, overlay;
}

.pattern-glass-geo-2::before {
    background-image:
        radial-gradient(110% 90% at 92% -15%, rgba(0, 217, 192, 0.36), transparent 55%),
        radial-gradient(90% 90% at -10% 20%, rgba(108, 92, 231, 0.24), transparent 52%),
        radial-gradient(80% 80% at 50% 120%, rgba(142, 124, 241, 0.18), transparent 55%),
        var(--grain);
    background-blend-mode: normal, normal, normal, overlay;
}

.pattern-glass-wave::before {
    background-image:
        radial-gradient(100% 100% at 100% 100%, rgba(255, 176, 32, 0.30), transparent 55%),
        radial-gradient(90% 90% at 0% 0%, rgba(255, 84, 112, 0.16), transparent 50%),
        radial-gradient(70% 70% at 30% 100%, rgba(142, 124, 241, 0.16), transparent 55%),
        var(--grain);
    background-blend-mode: normal, normal, normal, overlay;
}

.pattern-glass-grid::before {
    background-image:
        radial-gradient(90% 70% at 0% -10%, rgba(108, 92, 231, 0.26), transparent 60%),
        radial-gradient(80% 80% at 100% 110%, rgba(0, 217, 192, 0.26), transparent 60%),
        radial-gradient(60% 60% at 50% 50%, rgba(142, 124, 241, 0.10), transparent 70%),
        var(--grain);
    background-blend-mode: normal, normal, normal, overlay;
}

.pattern-glass-sunset::before {
    background-image:
        radial-gradient(110% 90% at 0% 0%, rgba(255, 84, 112, 0.30), transparent 55%),
        radial-gradient(100% 90% at 100% 100%, rgba(255, 176, 32, 0.28), transparent 55%),
        radial-gradient(80% 80% at 100% 0%, rgba(108, 92, 231, 0.18), transparent 50%),
        var(--grain);
    background-blend-mode: normal, normal, normal, overlay;
}

.pattern-none::before { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-2));
    color: #fff;
    box-shadow: 0 6px 18px rgba(108, 92, 231, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(108, 92, 231, 0.45); }

.btn-glass {
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
}

.btn-danger { background: var(--brand-danger); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.field {
    margin-bottom: 16px;
}
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea {
    background: rgba(255, 255, 255, 0.05);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}

/* ---------- Info Tooltip Icon ---------- */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.info-icon .tooltip-pop {
    display: none;
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    padding: 12px 14px;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(var(--blur));
    font-size: 12px;
    font-weight: 400;
    color: var(--text-primary);
    z-index: 50;
    text-align: left;
}
.info-icon.open .tooltip-pop { display: block; }

/* ---------- Top Nav / Bottom Nav (PWA mobile) ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--blur));
    border-bottom: 1px solid var(--glass-border);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: none;
    justify-content: space-around;
    padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--blur));
    border-top: 1px solid var(--glass-border);
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
}
.bottom-nav a.active { color: var(--brand-primary); }

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    body { padding-bottom: 70px; }
}

/* ---------- Modal / Lightbox ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 100;
    background: rgba(10, 10, 20, 0.55);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px;
}

/* ---------- Utility ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.rounded-full { border-radius: 999px; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-success { background: rgba(46, 217, 165, 0.18); color: var(--brand-success); }
.badge-warn { background: rgba(255, 176, 32, 0.18); color: var(--brand-warn); }
.badge-danger { background: rgba(255, 84, 112, 0.18); color: var(--brand-danger); }
.badge-frozen { background: rgba(139, 144, 163, 0.2); color: var(--text-muted); }

/* ---------- Rendered Cards (credit/ID/summary/auto-post) ---------- */
.render-card-outer { display: flex; flex-direction: column; gap: 10px; }
.render-card {
    cursor: zoom-in;
    min-height: 168px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.render-card:hover { transform: translateY(-2px); }
.card-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-secondary);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.card-label::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    flex-shrink: 0;
}
.card-name { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; margin-top: 8px; }
.card-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.card-mini-label { font-size: 10.5px; color: var(--text-muted); letter-spacing: .02em; }
.card-big-num {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 3px;
}
.card-mid-num {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    margin-top: 3px;
}
.card-balance-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 20px; }
.card-frozen-banner {
    position: absolute; top: 16px; right: 16px;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-size: 10.5px; font-weight: 700;
    padding: 5px 12px; border-radius: 999px;
}
.card-action-bar { display: flex; gap: 8px; }
.card-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ---------- Notifications ---------- */
.notif-bell-wrap { position: relative; }
.notif-bell {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
}
.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--brand-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--glass-bg-strong);
}

/* Social-style dropdown panel, anchored under the bell */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: 440px;
    display: none;
    flex-direction: column;
    z-index: 70;
    padding: 8px;
}
.notif-dropdown.open { display: flex; }
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 12px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 4px;
}
.notif-dropdown-list { overflow-y: auto; max-height: 380px; }

.notif-row {
    display: flex;
    gap: 12px;
    padding: 12px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}
.notif-row:hover { background: rgba(108, 92, 231, 0.10); }
.notif-row-unread { background: rgba(108, 92, 231, 0.07); }

.notif-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.notif-avatar-lg { width: 44px; height: 44px; font-size: 17px; }

.notif-row-body { flex: 1; min-width: 0; }
.notif-row-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.notif-row-snippet {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notif-row-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 480px) {
    .notif-dropdown { position: fixed; top: 70px; right: 16px; left: 16px; width: auto; }
}
