/* ════════════════════════════════════════════════════════════
   NITECAP — Stylesheet
   ════════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────── */
:root {
    --bg:             #110B1C;
    --bg-card:        #1E1530;
    --bg-card-hover:  #2A1F40;
    --primary:        #E85D75;
    --primary-glow:   rgba(232, 93, 117, 0.30);
    --secondary:      #B8A0E8;
    --secondary-dim:  rgba(184, 160, 232, 0.50);
    --accent:         #F5C26B;
    --text:           #F2EFF8;
    --text-dim:       rgba(242, 239, 248, 0.55);
    --text-mid:       rgba(242, 239, 248, 0.75);
    --success:        #6ECF97;
    --success-glow:   rgba(110, 207, 151, 0.20);
    --radius:         14px;
    --radius-lg:      20px;
    --font-display:   'DM Serif Display', Georgia, serif;
    --font-body:      'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    max-width: 420px;
    min-height: 100vh;
    margin: 0 auto;
    position: relative;
    overflow-x: hidden;
}

/* ── Screen layouts ───────────────────────────────────────── */
.screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 32px 24px 100px;
}
.screen--center {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-bottom: 60px;
}
.screen--form {
    padding-top: 48px;
}

/* ── Animation ────────────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ───────────────────────────────────────────── */
.brand {
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 400;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--text);
}
.heading {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 400;
    color: var(--text);
}
.subtitle {
    font-size: 15px;
    color: var(--text-dim);
    margin-top: 12px;
    max-width: 260px;
    line-height: 1.5;
    letter-spacing: 0.3px;
}
.text-xs  { font-size: 12px; }
.text-sm  { font-size: 14px; }
.text-dim { color: var(--text-dim); }
.text-mid { color: var(--text-mid); }

/* ── Welcome pulse ────────────────────────────────────────── */
.pulse-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 280px;
    height: 280px;
    margin-bottom: 48px;
}
.pulse-ring {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    border: 1.5px solid var(--secondary);
    opacity: 0;
    animation: pulseOut 3s ease-out var(--delay) infinite;
}
@keyframes pulseOut {
    0%   { transform: scale(0.5); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 0; }
}
.pulse-dot {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    z-index: 2;
    box-shadow: 0 0 60px var(--primary-glow);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    letter-spacing: 0.3px;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn--primary {
    background: linear-gradient(135deg, var(--primary), #D14A6A);
    color: #fff;
    box-shadow: 0 4px 24px var(--primary-glow);
}
.btn--primary:hover { box-shadow: 0 6px 32px var(--primary-glow); }

.btn--outline {
    background: transparent;
    color: var(--text-mid);
    border: 1.5px solid var(--secondary-dim);
}

.btn--full  { width: 100%; }
.btn--lg    { padding: 16px 48px; font-size: 16px; font-weight: 700; border-radius: 50px; }
.btn--sm    { padding: 8px 16px; font-size: 12px; }

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.btn-row .btn { flex: 1; }

/* ── Inputs ───────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}
.input {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--text);
    background: var(--bg-card);
    border: 1.5px solid var(--secondary-dim);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: rgba(242, 239, 248, 0.3); }
.input--textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* ── Chips ─────────────────────────────────────────────────── */
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    background: transparent;
    color: var(--text-mid);
    border: 1.5px solid var(--secondary-dim);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.chip--active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Progress bar ─────────────────────────────────────────── */
.progress-bar { display: flex; gap: 6px; margin-bottom: 32px; }
.progress-seg {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--bg-card);
    transition: background 0.4s;
}
.progress-seg--active { background: var(--primary); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid rgba(184, 160, 232, 0.12);
    margin-bottom: 16px;
}
.card--success {
    background: var(--success-glow);
    border-color: rgba(110, 207, 151, 0.2);
}
.card--glow {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-card-hover));
    border-color: var(--primary-glow);
    box-shadow: 0 8px 40px var(--primary-glow);
}
.card__eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.card__eyebrow--accent { color: var(--accent); }
.card__title {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 4px;
}

/* ── Dashboard header ─────────────────────────────────────── */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

/* ── Avatar ────────────────────────────────────────────────── */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.avatar--lg  { width: 64px; height: 64px; font-size: 26px; box-shadow: 0 4px 20px var(--primary-glow); }
.avatar--xl  { width: 80px; height: 80px; font-size: 32px; margin: 0 auto; box-shadow: 0 4px 24px var(--primary-glow); }

/* ── Stat cards ────────────────────────────────────────────── */
.stat-row  { display: flex; gap: 12px; }
.stat-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 18px 16px;
    border: 1px solid rgba(184, 160, 232, 0.1);
    text-align: center;
}
.stat-icon  { font-size: 20px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ── Match profile ─────────────────────────────────────────── */
.match-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 18px 0;
}
.match-bio {
    font-size: 15px;
    color: var(--text-mid);
    font-style: italic;
    padding-left: 12px;
    border-left: 2px solid var(--secondary-dim);
    margin: 12px 0 0;
    line-height: 1.6;
}

/* ── Detail list ───────────────────────────────────────────── */
.detail-list { margin-top: 18px; }
.detail-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(184, 160, 232, 0.08);
}
.detail-item:last-child { border-bottom: none; }
.detail-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* ── Safety page ───────────────────────────────────────────── */
.safety-list { }
.safety-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-mid);
    border-bottom: 1px solid rgba(184, 160, 232, 0.08);
}
.safety-item:last-child { border-bottom: none; }
.safety-item span { font-size: 18px; flex-shrink: 0; }

.contact-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(184, 160, 232, 0.08);
}
.contact-row:last-child { border-bottom: none; }

/* ── Bottom nav ────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: space-around;
    padding: 12px 0 max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(184, 160, 232, 0.1);
    background: var(--bg);
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    padding: 4px 12px;
    -webkit-tap-highlight-color: transparent;
}
.nav-icon { font-size: 20px; }
.nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
}
.nav-item--active .nav-label { color: var(--primary); }

/* ── Misc ──────────────────────────────────────────────────── */
.link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
}
.link:hover { text-decoration: underline; }

.back-link {
    display: inline-block;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
}

.welcome-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.loading-dots {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    padding: 20px;
}

/* ── Spinner ───────────────────────────────────────────────── */
.spinner-rings {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 48px;
}
.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}
.spinner-ring--outer {
    inset: 0;
    border-top-color: var(--primary);
    border-right-color: var(--secondary);
    animation: spin 1.2s linear infinite;
}
.spinner-ring--inner {
    inset: 16px;
    border-bottom-color: var(--accent);
    border-left-color: var(--primary);
    animation: spin 1.8s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-emoji {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--bg-card-hover);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-body);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-width: 340px;
    text-align: center;
}
.toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast--error {
    border: 1px solid var(--primary);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 420px) {
    .screen { padding-left: 20px; padding-right: 20px; }
}

/* ════════════════════════════════════════════════════════════
   NATIVE APP (Capacitor) overrides
   ════════════════════════════════════════════════════════════ */

/* ── Safe areas ────────────────────────────────────────────── */
#app {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    max-width: 100%;
}

/* ── Disable text selection, long-press, callouts ──────────── */
body.native-app {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}
body.native-app input,
body.native-app textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

/* ── Screen sizing for native ──────────────────────────────── */
body.native-app #app {
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}
body.native-app .screen {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Keyboard open adjustments ─────────────────────────────── */
body.keyboard-open .bottom-nav {
    display: none;
}
body.keyboard-open .screen {
    padding-bottom: var(--keyboard-height, 0px);
}

/* ── Native in-app notification banner ─────────────────────── */
.native-notif {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card-hover);
    border: 1px solid rgba(184, 160, 232, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}
.native-notif--visible {
    opacity: 1;
    transform: translateY(0);
}
.native-notif__icon {
    font-size: 24px;
    flex-shrink: 0;
}
.native-notif__content {
    flex: 1;
    min-width: 0;
}
.native-notif__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.native-notif__body {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Pull-to-refresh indicator area ────────────────────────── */
body.native-app .screen--center {
    padding-top: calc(env(safe-area-inset-top, 0px) + 40px);
}
