/* ============================================
   THE MISHA VAULT - Warm Family Heritage UI
   ============================================ */

/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --cream:        #fdf6ee;
    --warm-white:  #fffaf4;
    --sand:         #f0e6d3;
    --tan:          #e2cdb0;
    --brown-light: #c4a882;
    --brown:        #8b6340;
    --brown-dark:  #5c3d1e;
    --text-dark:    #2d1f0e;
    --text-mid:     #6b4f35;
    --text-soft:    #9c7a5a;
    --green-soft:  #4a7c59;
    --red-soft:     #b94a48;
    --gold:         #c9952a;
    --accent-gold:  #c9952a; /* Mapped for slider and accent actions */
    --shadow-sm:    0 2px 8px rgba(90,50,10,0.08);
    --shadow-md:    0 4px 20px rgba(90,50,10,0.12);
    --radius:       16px;
    --radius-sm:    10px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--cream);
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3 { font-family: 'Playfair Display', serif; color: var(--brown-dark); }
h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h3 { font-size: 1.05rem; margin-bottom: 6px; }

/* ============================================
   AUTH WALL & SLIDER
   ============================================ */
#auth-wall {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #fdf6ee 0%, #f0e0c8 50%, #e8d0b0 100%);
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.auth-brand {
    text-align: center;
}

.auth-logo {
    font-size: 3.5rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
}

.auth-title {
    font-size: 2rem;
    color: var(--brown-dark);
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--text-soft);
    font-size: 0.95rem;
    font-style: italic;
}

/* --- Onboarding Slider & Dots Engine --- */
.slider-wrapper {
    position: relative;
    height: 200px;
    overflow: hidden;
    margin-bottom: 20px;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

/* Fixes initial dead space before JS slider loads */
.slide:first-child {
    opacity: 1;
    position: relative;
}

.slide.active {
    opacity: 1;
    position: relative;
}

.slide h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--brown-dark);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slide p {
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.5;
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--tan);
    border: 2px solid var(--brown-light, #c4a882);
    border-radius: 50%;
    transition: background-color 0.3s, border-color 0.3s;
}

.dot.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
}

/* --- Interactive Gate Controls --- */
.action-gate {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-card {
    background: var(--warm-white);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--tan);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-card h2 {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.auth-hint {
    color: var(--text-soft);
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-soft);
    font-size: 0.8rem;
    margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tan);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.text-input, .text-area, .pin-input, .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--tan);
    border-radius: var(--radius-sm);
    background: var(--warm-white);
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.text-input:focus, .text-area:focus, .pin-input:focus, .form-control:focus {
    border-color: var(--brown-light);
    box-shadow: 0 0 0 3px rgba(196,168,130,0.2);
}

.text-area { resize: vertical; min-height: 80px; }

.pin-input {
    width: auto;
    flex: 1;
    font-size: 1.4rem;
    letter-spacing: 0.4em;
    text-align: center;
    font-weight: 600;
    max-width: 160px;
}

.pin-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 1rem;
}

.form-label, .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-mid);
}

.label-hint {
    font-weight: 400;
    color: var(--text-soft);
    font-size: 0.8rem;
}

/* --- PIN PAD SPECIFICS --- */
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 20px 0; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--tan); background: transparent; transition: background 0.2s; }
.pin-dot.filled { background: var(--accent-gold); border-color: var(--accent-gold); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 240px; margin: 0 auto 20px auto; }
.pin-key { padding: 16px; background: var(--warm-white); border: 1px solid var(--tan); color: var(--text-dark); font-size: 18px; font-weight: bold; border-radius: 6px; cursor: pointer; transition: all 0.15s; text-align: center; }
.pin-key:hover { background: var(--sand); border-color: var(--brown-light); }
.pin-key.clear { color: var(--red-soft); border-color: var(--red-soft); }

/* ============================================
   BUTTONS (Refined Hierarchy)
   ============================================ */
.btn-primary, .btn-submit, .btn-gold {
    background: var(--brown-dark);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-primary:hover, .btn-submit:hover, .btn-gold:hover { 
    background: var(--brown); 
    box-shadow: 0 4px 12px rgba(92, 61, 30, 0.2);
}
.btn-primary:active, .btn-submit:active, .btn-gold:active { transform: scale(0.98); }
.btn-primary:disabled, .btn-submit:disabled { background: var(--brown-light); cursor: not-allowed; box-shadow: none; }
.btn-full, .btn-gate { width: 100%; padding: 14px; font-size: 1rem; }

.btn-secondary, .btn-outline {
    background: transparent;
    color: var(--brown-dark);
    border: 1.5px solid var(--brown-light);
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
    width: 100%;
    text-transform: uppercase;
}
.btn-secondary:hover, .btn-outline:hover { 
    background: var(--sand); 
    border-color: var(--brown);
    color: var(--text-dark);
}

.btn-logout {
    background: transparent;
    color: var(--text-soft);
    border: 1px solid var(--tan);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}
.btn-logout:hover { color: var(--red-soft); border-color: var(--red-soft); background: #fff5f5; }

.btn-mic {
    background: var(--sand);
    border: 1.5px solid var(--tan);
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.btn-mic:hover { background: var(--tan); }
.btn-mic.listening { background: #d4edda; border-color: var(--green-soft); }

/* ============================================
   TOP NAV
   ============================================ */
.vault-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(253,246,238,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--tan);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon { font-size: 1.4rem; }

.nav-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brown-dark);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vault-badge {
    background: #e8f5e9;
    color: var(--green-soft);
    border: 1px solid #c8e6c9;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.vault-badge.inquest {
    background: #fff3e0;
    color: #e65100;
    border-color: #ffe0b2;
}

/* ============================================
   INQUEST BANNER
   ============================================ */
.inquest-banner {
    background: #fff3e0;
    border-bottom: 2px solid #ffb74d;
    color: #bf360c;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-main, .vault-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 28px 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ============================================
   CARDS
   ============================================ */
.card-warm, .upload-section, .set-pin-section, .amisha-section, .master-panel {
    background: var(--warm-white);
    border: 1px solid var(--tan);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.master-panel {
    border: 1px dashed var(--red-soft);
    background: #fff5f5;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-desc {
    color: var(--text-soft);
    font-size: 0.9rem;
    margin-top: -6px;
}

.badge-master {
    background: var(--gold);
    color: #fff;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ============================================
   UPLOAD DROPZONE
   ============================================ */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed var(--brown-light);
    border-radius: var(--radius-sm);
    padding: 32px 20px;
    cursor: pointer;
    background: var(--cream);
    transition: background 0.2s, border-color 0.2s;
    text-align: center;
}

.upload-dropzone:hover {
    background: var(--sand);
    border-color: var(--brown);
}

.upload-dropzone.has-file {
    background: #e8f5e9;
    border-color: var(--green-soft);
    border-style: solid;
}

.upload-icon { font-size: 2rem; }
.upload-text { font-weight: 600; color: var(--brown-dark); font-size: 0.95rem; }
.upload-hint { color: var(--text-soft); font-size: 0.8rem; }

/* ============================================
   PIN SETUP (inside master panel)
   ============================================ */
.pin-setup {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--tan);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pin-setup p {
    color: var(--text-soft);
    font-size: 0.88rem;
}

/* ============================================
   AMISHA CHAT
   ============================================ */
.amisha-online-dot {
    width: 9px;
    height: 9px;
    background: var(--green-soft);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(74,124,89,0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(74,124,89,0.2); }
    50%       { box-shadow: 0 0 0 6px rgba(74,124,89,0.05); }
}

.chat-box, .response-box {
    background: var(--cream);
    border: 1px solid var(--tan);
    border-radius: var(--radius-sm);
    padding: 16px;
    min-height: 180px;
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 88%;
}

.chat-bubble.amisha {
    background: var(--sand);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chat-bubble.user {
    background: var(--brown-dark);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-bubble.error {
    background: #fff0f0;
    color: var(--red-soft);
    border: 1px solid #ffd5d5;
    align-self: flex-start;
}

.chat-input-row, .comm-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input { flex: 1; }

/* ============================================
   BLOODLINE GRID
   ============================================ */
.bloodline-grid, .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.profile-card {
    background: var(--cream);
    border: 1px solid var(--tan);
    border-radius: var(--radius-sm);
    padding: 18px 16px;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: default;
}

.profile-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.profile-name {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--brown-dark);
    margin-bottom: 4px;
}

.profile-relation {
    font-size: 0.8rem;
    color: var(--text-soft);
    font-weight: 500;
    text-transform: capitalize;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 36px 20px;
    color: var(--text-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-state span { font-size: 2.5rem; }
.empty-state p { font-size: 0.9rem; max-width: 260px; }

/* ============================================
   STATUS / ERROR MESSAGES
   ============================================ */
.status-msg {
    font-size: 0.85rem;
    min-height: 20px;
    color: var(--text-soft);
}

.status-msg.success { color: var(--green-soft); }
.status-msg.error   { color: var(--red-soft); }

.error-msg {
    color: var(--red-soft);
    font-size: 0.85rem;
    background: #fff0f0;
    border: 1px solid #ffd5d5;
    border-radius: 8px;
    padding: 8px 12px;
}

/* ============================================
   VAULT STATES
   ============================================ */
body.state-inquest .vault-nav {
    border-bottom-color: #ffb74d;
}

body.state-released .vault-nav {
    background: rgba(255,253,248,0.95);
}

body.state-released .nav-title::after {
    content: ' · Unlocked';
    color: var(--gold);
    font-size: 0.8em;
}

/* ============================================
   FOOTER
   ============================================ */
.vault-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-soft);
    font-size: 0.78rem;
    border-top: 1px solid var(--tan);
    background: var(--warm-white);
}

/* ============================================
   RESPONSIVE OVERRIDES
   ============================================ */
@media (max-width: 480px) {
    .auth-card { padding: 24px 18px; }
    .card-warm, .upload-section, .set-pin-section, .amisha-section, .master-panel { padding: 22px 18px; }
    .dashboard-main, .vault-container { padding: 20px 14px 60px; }
    .vault-nav { padding: 12px 16px; }
    .nav-title { font-size: 0.95rem; }
    .bloodline-grid, .grid { grid-template-columns: 1fr 1fr; }
    .pin-row { flex-wrap: wrap; }
    .pin-input { max-width: 100%; width: 100%; }
}
