/* --- VANTAGE CORE LAYOUT --- */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    background-color: #000000 !important;
    background-image: radial-gradient(circle at 50% -20%, #111111 0%, #000000 50%) !important;
    background-attachment: fixed !important;
    min-height: 100vh !important;
    display: flex;
    justify-content: center;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    color: #ffffff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    
    /* CAPACITOR FIX: Respects top notch and adds to your 120px bottom buffer */
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important; 
}

/* --- LOADING SYSTEM --- */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- SECTION CONTROLS --- */
#loginSection, #paymentSection, #appSection, .tab-content {
    position: relative; 
    z-index: 10;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Adjusted padding to work with the body padding-top */
    padding: 40px 24px 40px 24px; 
    box-sizing: border-box;
    animation: geistFade 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes geistFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- TYPOGRAPHY --- */
.silver-title {
    background: linear-gradient(180deg, #FFFFFF 0%, #A1A1AA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: clamp(2.5rem, 12vw, 4.5rem) !important; 
    font-weight: 900;
    letter-spacing: -0.06em !important;
    text-transform: uppercase;
    text-align: center;
    margin: 0;
    line-height: 0.9;
    position: relative;
    z-index: 1;
}

.sub-header {
    color: #A1A1AA !important;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 12px;
}

/* --- CARDS & INPUTS --- */
.auth-card {
    background: #0A0A0A !important;
    border: 1px solid #27272A;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    margin-top: 32px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.workspace {
    background: #000000 !important;
    border: 1px solid #27272A !important;
    border-radius: 8px;
    padding: 14px 16px;
    width: 100% !important;
    color: white;
    font-size: 1rem;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.workspace:focus {
    border-color: #52525B !important;
}

/* --- BUTTONS --- */
.pill-button {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 1px solid #FFFFFF !important;
    border-radius: 8px;
    padding: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.pill-button:hover {
    background: transparent !important;
    color: #FFFFFF !important;
}

/* --- SLEEK COPY BUTTON --- */
.copy-wrapper {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-bottom: -24px;
    position: relative;
    z-index: 15;
}

.copy-action-btn {
    background: #18181b;
    border: 1px solid #27272a;
    color: #a1a1aa;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.copy-action-btn:hover {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
}

/* --- BOTTOM NAVIGATION BAR --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #0A0A0A;
    border-top: 1px solid #27272A;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
    z-index: 2000;
    /* CAPACITOR FIX: Ensures nav sits above the iPhone home bar */
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #52525B;
    cursor: pointer;
    flex: 1;
    transition: color 0.2s;
}

.nav-item.active { color: #FFFFFF; }
.nav-item span { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; }

/* --- PAYMENT MODAL SYSTEM --- */
#paymentModal {
    display: none;
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    background: #000000;
    border: 1px solid #27272A;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- AI IDENTITY & TYPING --- */
.ai-typing-container {
    display: none; 
    align-items: flex-end; 
    gap: 12px; 
    margin-top: 15px;
    width: 100%;
}

.typing-bubble {
    background: #18181b; 
    border: 1px solid #27272a; 
    padding: 10px 16px; 
    border-radius: 12px 12px 12px 4px; 
    display: flex; 
    gap: 4px;
}

.dot {
    width: 4px; 
    height: 4px; 
    background: #a1a1aa; 
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.logout-btn {
    position: fixed !important;
    /* CAPACITOR FIX: Top right logout stays clear of clock/battery */
    top: calc(10px + env(safe-area-inset-top));
    right: 20px;
    z-index: 100;
    font-size: 0.7rem;
    color: #71717A;
    background: #000;
    border: 1px solid #27272A;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
}

/* --- AI OUTPUT FORMATTING --- */
#aiOutput {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #d4d4d8;
}

/* --- CS FLOATING BUTTON --- */
#csButton {
    display: none;
    position: fixed;
    /* CAPACITOR FIX: Button floats safely above the nav bar */
    bottom: calc(100px + env(safe-area-inset-bottom));
    right: 24px;
    width: 56px;
    height: 56px;
    background: #000000;
    color: #FFFFFF;
    border: 1px solid #27272A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    touch-action: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    cursor: grab;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}

#csButton:active {
    cursor: grabbing;
    transform: scale(0.9);
    border-color: #52525B;
}

.material-symbols-outlined {
    font-size: 28px !important;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- RESPONSIVE FIXES --- */
@media (max-width: 480px) {
    #loginSection, #paymentSection, #appSection { padding-top: 40px; }
    .silver-title { font-size: 3rem !important; }
    }
    
