/* =====================================================
   SIIVORA PARTNER NETWORK — CORE DESIGN SYSTEM
   Premium fragrance-brand aesthetic. Mobile-first.
   ===================================================== */

:root {
    /* --- Brand palette --- */
    --siv-black: #0B0B0B;
    --siv-charcoal: #171717;
    --siv-gold: #C9A24B;
    --siv-gold-soft: #E4CD8E;
    --siv-gold-tint: rgba(201, 162, 75, 0.12);
    --siv-bg: #F7F7F7;
    --siv-card: #FFFFFF;
    --siv-border: #EAE7E0;

    /* --- Text --- */
    --siv-text-primary: #14140F;
    --siv-text-secondary: #6B6A63;
    --siv-text-muted: #9C9A91;
    --siv-text-on-dark: #F5F3ED;
    --siv-text-on-dark-muted: #B9B6AA;

    /* --- Status --- */
    --siv-success: #1E8E5A;
    --siv-success-bg: #E7F5EE;
    --siv-warning: #B6791F;
    --siv-warning-bg: #FBF1DF;
    --siv-danger: #C23A3A;
    --siv-danger-bg: #FBEAEA;
    --siv-info: #2D6CB0;
    --siv-info-bg: #E9F1FB;

    /* --- Elevation --- */
    --siv-shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.06);
    --siv-shadow-md: 0 6px 20px rgba(11, 11, 11, 0.08);
    --siv-shadow-gold: 0 8px 24px rgba(201, 162, 75, 0.25);

    /* --- Radius --- */
    --siv-radius-sm: 10px;
    --siv-radius-md: 16px;
    --siv-radius-lg: 22px;
    --siv-radius-pill: 999px;

    /* --- Spacing --- */
    --siv-space-1: 4px;
    --siv-space-2: 8px;
    --siv-space-3: 12px;
    --siv-space-4: 16px;
    --siv-space-5: 24px;
    --siv-space-6: 32px;

    /* --- Type --- */
    --siv-font-display: 'Manrope', 'Inter', -apple-system, sans-serif;
    --siv-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* --- Layout --- */
    --siv-header-h: 60px;
    --siv-bottomnav-h: 64px;
    --siv-safe-bottom: env(safe-area-inset-bottom, 0px);
    --siv-safe-top: env(safe-area-inset-top, 0px);
    --siv-max-width: 480px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--siv-bg);
    color: var(--siv-text-primary);
    font-family: var(--siv-font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--siv-font-display);
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 var(--siv-space-2);
    color: var(--siv-text-primary);
}

h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

p { margin: 0 0 var(--siv-space-3); color: var(--siv-text-secondary); }

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

img { max-width: 100%; display: block; }

button, input, select, textarea { font-family: inherit; }

::selection { background: var(--siv-gold-tint); }

/* Visible focus states for accessibility (Rule #46) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--siv-gold);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* =====================================================
   APP SHELL
   ===================================================== */

.siv-app {
    max-width: var(--siv-max-width);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--siv-bg);
    position: relative;
    padding-bottom: calc(var(--siv-bottomnav-h) + var(--siv-safe-bottom));
}

.siv-app--auth {
    padding-bottom: var(--siv-space-6);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sticky header */
.siv-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: calc(var(--siv-header-h) + var(--siv-safe-top));
    padding-top: var(--siv-safe-top);
    background: var(--siv-black);
    color: var(--siv-text-on-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--siv-space-4);
    padding-right: var(--siv-space-4);
}

.siv-header__left, .siv-header__right {
    display: flex;
    align-items: center;
    gap: var(--siv-space-2);
    min-width: 40px;
}

.siv-header__right { justify-content: flex-end; }

.siv-header__title {
    font-family: var(--siv-font-display);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
    text-align: center;
    flex: 1;
}

.siv-header__icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--siv-radius-pill);
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--siv-text-on-dark);
    cursor: pointer;
}

.siv-header__icon-btn:active { background: rgba(255,255,255,0.14); }

.siv-logo {
    font-family: var(--siv-font-display);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.14em;
    color: var(--siv-gold-soft);
}

.siv-badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--siv-gold);
    border: 2px solid var(--siv-black);
}

/* Content container */
.siv-content {
    padding: var(--siv-space-4);
}

/* =====================================================
   BOTTOM NAVIGATION
   ===================================================== */

.siv-bottomnav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--siv-max-width);
    height: calc(var(--siv-bottomnav-h) + var(--siv-safe-bottom));
    padding-bottom: var(--siv-safe-bottom);
    background: var(--siv-black);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.siv-navitem {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--siv-text-on-dark-muted);
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 600;
    flex: 1;
    height: 100%;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.siv-navitem svg { width: 22px; height: 22px; }

.siv-navitem.is-active { color: var(--siv-gold); }

/* =====================================================
   CARDS
   ===================================================== */

.siv-card {
    background: var(--siv-card);
    border: 1px solid var(--siv-border);
    border-radius: var(--siv-radius-md);
    padding: var(--siv-space-4);
    box-shadow: var(--siv-shadow-sm);
}

.siv-card + .siv-card { margin-top: var(--siv-space-3); }

.siv-card--dark {
    background: linear-gradient(155deg, var(--siv-black) 0%, var(--siv-charcoal) 100%);
    color: var(--siv-text-on-dark);
    border: none;
}

.siv-card--dark p { color: var(--siv-text-on-dark-muted); }

/* =====================================================
   BUTTONS
   ===================================================== */

.siv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--siv-space-2);
    width: 100%;
    min-height: 48px;
    padding: 0 var(--siv-space-5);
    border-radius: var(--siv-radius-sm);
    font-family: var(--siv-font-body);
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    -webkit-appearance: none;
}

.siv-btn:active { transform: scale(0.98); }

.siv-btn--primary {
    background: linear-gradient(135deg, var(--siv-gold-soft), var(--siv-gold));
    color: var(--siv-black);
    box-shadow: var(--siv-shadow-gold);
}

.siv-btn--secondary {
    background: transparent;
    color: var(--siv-black);
    border: 1.5px solid var(--siv-black);
}

.siv-btn--ghost {
    background: transparent;
    color: var(--siv-text-secondary);
}

.siv-btn--danger {
    background: var(--siv-danger);
    color: #fff;
}

.siv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.siv-btn--loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

.siv-btn--loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(0,0,0,0.25);
    border-top-color: var(--siv-black);
    animation: siv-spin 0.7s linear infinite;
}

.siv-btn--secondary.siv-btn--loading::after,
.siv-btn--danger.siv-btn--loading::after {
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
}

@keyframes siv-spin { to { transform: rotate(360deg); } }

/* =====================================================
   FORMS
   ===================================================== */

.siv-field { margin-bottom: var(--siv-space-4); }

.siv-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--siv-text-primary);
    margin-bottom: var(--siv-space-2);
}

.siv-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--siv-card);
    border: 1.5px solid var(--siv-border);
    border-radius: var(--siv-radius-sm);
    transition: border-color 0.15s ease;
}

.siv-input-wrap:focus-within {
    border-color: var(--siv-gold);
    box-shadow: 0 0 0 3px var(--siv-gold-tint);
}

.siv-input-wrap.has-error {
    border-color: var(--siv-danger);
}

.siv-input-prefix {
    padding-left: var(--siv-space-4);
    color: var(--siv-text-secondary);
    font-weight: 600;
    font-size: 15px;
}

.siv-input {
    flex: 1;
    width: 100%;
    min-height: 48px;
    border: none;
    background: transparent;
    padding: 0 var(--siv-space-4);
    font-size: 15px;
    color: var(--siv-text-primary);
    outline: none;
}

.siv-input-action {
    background: none;
    border: none;
    padding: 0 var(--siv-space-4);
    color: var(--siv-text-secondary);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.siv-field-error {
    color: var(--siv-danger);
    font-size: 12.5px;
    margin-top: var(--siv-space-1);
    display: none;
}

.siv-field-error.is-visible { display: block; }

.siv-field-hint {
    color: var(--siv-text-muted);
    font-size: 12.5px;
    margin-top: var(--siv-space-1);
}

/* Password strength meter */
.siv-strength {
    display: flex;
    gap: 4px;
    margin-top: var(--siv-space-2);
}
.siv-strength__bar {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: var(--siv-border);
    transition: background 0.2s ease;
}
.siv-strength__bar.is-weak { background: var(--siv-danger); }
.siv-strength__bar.is-medium { background: var(--siv-warning); }
.siv-strength__bar.is-strong { background: var(--siv-success); }

/* =====================================================
   OTP INPUT
   ===================================================== */

.siv-otp-group {
    display: flex;
    gap: var(--siv-space-2);
    justify-content: space-between;
}

.siv-otp-box {
    width: 46px;
    height: 54px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    border: 1.5px solid var(--siv-border);
    border-radius: var(--siv-radius-sm);
    background: var(--siv-card);
    color: var(--siv-text-primary);
}

.siv-otp-box:focus {
    outline: none;
    border-color: var(--siv-gold);
    box-shadow: 0 0 0 3px var(--siv-gold-tint);
}

.siv-otp-box.is-error {
    border-color: var(--siv-danger);
    animation: siv-shake 0.3s ease;
}

@keyframes siv-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.siv-otp-timer {
    text-align: center;
    color: var(--siv-text-secondary);
    font-size: 13.5px;
    margin-top: var(--siv-space-4);
}

.siv-otp-timer__resend {
    color: var(--siv-gold);
    font-weight: 700;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--siv-space-2);
    min-height: 44px;
}

.siv-otp-timer__resend:disabled {
    color: var(--siv-text-muted);
    cursor: not-allowed;
}

/* =====================================================
   TOAST
   ===================================================== */

.siv-toast-host {
    position: fixed;
    left: 50%;
    bottom: calc(var(--siv-bottomnav-h) + var(--siv-safe-bottom) + 12px);
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: calc(var(--siv-max-width) - 32px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.siv-app--auth ~ .siv-toast-host,
.siv-toast-host[data-no-nav="true"] {
    bottom: 24px;
}

.siv-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--siv-black);
    color: var(--siv-text-on-dark);
    border-radius: var(--siv-radius-sm);
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    font-size: 13.5px;
    font-weight: 500;
    animation: siv-toast-in 0.22s ease;
}

.siv-toast.is-leaving { animation: siv-toast-out 0.18s ease forwards; }

@keyframes siv-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes siv-toast-out {
    to { opacity: 0; transform: translateY(6px); }
}

.siv-toast__icon { flex-shrink: 0; margin-top: 1px; }
.siv-toast--success .siv-toast__icon { color: #59C994; }
.siv-toast--error .siv-toast__icon { color: #E4726F; }
.siv-toast--warning .siv-toast__icon { color: var(--siv-gold-soft); }
.siv-toast--info .siv-toast__icon { color: #7FB2E8; }

.siv-toast__msg { flex: 1; }
.siv-toast__close {
    background: none; border: none; color: var(--siv-text-on-dark-muted);
    cursor: pointer; padding: 2px; line-height: 1;
}

/* =====================================================
   SKELETON LOADERS
   ===================================================== */

.siv-skeleton {
    background: linear-gradient(90deg, #ECEAE4 25%, #F5F4F0 37%, #ECEAE4 63%);
    background-size: 400% 100%;
    animation: siv-shimmer 1.4s ease infinite;
    border-radius: var(--siv-radius-sm);
}

@keyframes siv-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.siv-skeleton--text { height: 14px; margin-bottom: 8px; width: 100%; }
.siv-skeleton--title { height: 20px; width: 60%; margin-bottom: 12px; }
.siv-skeleton--card { height: 84px; width: 100%; border-radius: var(--siv-radius-md); }

/* =====================================================
   EMPTY / ERROR STATES
   ===================================================== */

.siv-state {
    text-align: center;
    padding: var(--siv-space-6) var(--siv-space-4);
}

.siv-state__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--siv-space-4);
    border-radius: 50%;
    background: var(--siv-gold-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--siv-gold);
}

.siv-state__title {
    font-family: var(--siv-font-display);
    font-weight: 800;
    font-size: 17px;
    margin-bottom: 6px;
}

.siv-state__desc {
    color: var(--siv-text-secondary);
    font-size: 13.5px;
    margin-bottom: var(--siv-space-4);
}

/* =====================================================
   STATUS BADGES
   ===================================================== */

.siv-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--siv-radius-pill);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.siv-badge--success { background: var(--siv-success-bg); color: var(--siv-success); }
.siv-badge--warning { background: var(--siv-warning-bg); color: var(--siv-warning); }
.siv-badge--danger { background: var(--siv-danger-bg); color: var(--siv-danger); }
.siv-badge--info { background: var(--siv-info-bg); color: var(--siv-info); }
.siv-badge--neutral { background: #F0EFEA; color: var(--siv-text-secondary); }

/* =====================================================
   UTILITIES
   ===================================================== */

.siv-flex { display: flex; }
.siv-flex-col { display: flex; flex-direction: column; }
.siv-items-center { align-items: center; }
.siv-justify-between { justify-content: space-between; }
.siv-gap-2 { gap: var(--siv-space-2); }
.siv-gap-3 { gap: var(--siv-space-3); }
.siv-mt-2 { margin-top: var(--siv-space-2); }
.siv-mt-3 { margin-top: var(--siv-space-3); }
.siv-mt-4 { margin-top: var(--siv-space-4); }
.siv-mt-6 { margin-top: var(--siv-space-6); }
.siv-mb-4 { margin-bottom: var(--siv-space-4); }
.siv-text-center { text-align: center; }
.siv-text-muted { color: var(--siv-text-muted); }
.siv-text-gold { color: var(--siv-gold); }
.siv-text-sm { font-size: 13px; }
.siv-w-full { width: 100%; }

.siv-link {
    color: var(--siv-gold);
    font-weight: 700;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

.siv-divider {
    height: 1px;
    background: var(--siv-border);
    margin: var(--siv-space-4) 0;
}

@media (min-width: 768px) {
    .siv-app { max-width: 480px; box-shadow: 0 0 60px rgba(0,0,0,0.06); }
}
