/* ==========================================================================
   1. GLOBAL RESET & BASE LAYOUT (MOBILE FIX)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* FIX: Forces the baseline HTML frame to stay locked inside actual visible mobile browser borders */
html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    /* Prevents background page bouncing scrolling on iOS Safari */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f6f9;
    color: #1a1a1a;
}

/* FIX: Replaced rigid 100vh with dynamic viewport properties + device edge safe area tracking */
.app-viewport {
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Enforces strict actual dynamic screen rendering bounds on modern phones */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    /* Protects top bar from cutting behind camera notch notches */
    padding-bottom: env(safe-area-inset-bottom);
    /* Pins input panel safely above bottom indicator swipe bars */
}

.scrollable-page {
    overflow-y: auto !important;
    height: auto !important;
    position: relative !important;
}

/* ==========================================================================
   2. UNBYPASSABLE IDENTITY INTERCEPTOR MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f4f6f9;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    padding: 35px 30px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

.login-card h2 {
    color: #28a745;
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.5px;
}

.login-card p {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.4;
}

.login-card label {
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -4px;
}

.login-card select,
.login-card input {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 16px;
    /* Block mobile Safari auto-zoom issues on focus events */
    background: #f8fafc;
    outline: none;
}

.login-card select:focus,
.login-card input:focus {
    border-color: #32cd32;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(50, 205, 50, 0.15);
}

.error-msg {
    color: #ff3b30;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    min-height: 18px;
}

/* ==========================================================================
   3. STRUCTURAL GLASSMORPHISM NAVBAR LAYOUTS
   ========================================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e9f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.nav-logo {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #28a745;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #4a5568;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: #28a745;
}

.nav-status {
    font-size: 11px;
    font-weight: 700;
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-status.connected {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

/* ==========================================================================
   4. STICKY HEADERS & PULSING CROWN VERIFICATIONS
   ========================================================================== */
#sticky-profile-bar {
    width: 100%;
    z-index: 9;
    background: #ffffff;
    transition: all 0.2s ease;
}

.profile-sticky-note {
    background: rgba(40, 167, 69, 0.06);
    color: #1e7e34;
    border-bottom: 1px solid rgba(40, 167, 69, 0.12);
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    animation: slideDown 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

.vip-crown-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #1a1a1a;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    margin-right: 4px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    animation: crownPulse 1.5s infinite ease-in-out;
}

@keyframes crownPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.7);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    }
}

/* ==========================================================================
   5. TIMELINE MESSAGE TRACKS & MEDIA BUBBLES
   ========================================================================== */
#chat-box {
    height: 100%;
    width: 100%;
    padding: 20px;
    overflow-y: auto;
    background: #f4f6f9;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.bubble {
    max-width: 75%;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

.my-msg {
    align-self: flex-start;
    background: #ffffff;
    color: #2d3748;
    border-radius: 20px 20px 20px 4px;
    border: 1px solid #e2e8f0;
    transform-origin: left bottom;
}

.peer-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    color: #ffffff;
    border-radius: 20px 20px 4px 20px;
    transform-origin: right bottom;
    box-shadow: 0 4px 14px rgba(50, 205, 50, 0.22);
}

.image-bubble {
    padding: 6px;
    border-radius: 14px;
    overflow: hidden;
}

.image-bubble img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 10px;
    display: block;
    object-fit: cover;
}

/* ==========================================================================
   6. ABSOLUTE DEAD-CENTER BLURRED TYPING GRAPHICS
   ========================================================================== */
#typing-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15px;
    color: #1e7e34;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
    width: auto;
}

.pulsing-text {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(40, 167, 69, 0.2);
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
    display: inline-block;
    animation: pulse 1.2s infinite ease-in-out;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   7. INPUT PANEL AND PREMIUM MEDIA TRIGGERS
   ========================================================================== */
.controls {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    background: #ffffff;
    border-top: 1px solid #e5e9f0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.02);
    align-items: center;
}

.controls input[type="text"] {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    outline: none;
    font-size: 16px;
    background: #f8fafc;
    transition: all 0.2s ease;
    -webkit-appearance: none;
}

.controls input[type="text"]:focus {
    border-color: #32cd32;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(50, 205, 50, 0.15);
}

#image-loader {
    display: none;
}

.attach-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    display: none;
    /* Controlled dynamically via main.js token check */
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

.attach-btn:active {
    transform: scale(0.92);
    background: #e2e8f0;
}

button {
    padding: 14px 26px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-chat-btn {
    padding: 15px 0;
}

button:active {
    transform: scale(0.96);
    background: #1e7e34;
}

/* ==========================================================================
   8. VIP & CONTACT PAGE LAYOUTS
   ========================================================================== */
.content-wrapper {
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.content-wrapper h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    color: #1a202c;
    letter-spacing: -0.5px;
}

.content-wrapper p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 24px;
    font-size: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
    text-transform: uppercase;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 15px;
    background: #ffffff;
    outline: none;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #32cd32;
    box-shadow: 0 0 0 3px rgba(50, 205, 50, 0.15);
}

.form-group button {
    padding: 14px 0;
    margin-top: 10px;
}

.vip-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vip-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    position: relative;
    overflow: hidden;
}

.vip-card.popular {
    border-color: #28a745;
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.08);
}

.vip-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #28a745;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.vip-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
}

.vip-price {
    font-size: 32px;
    font-weight: 800;
    color: #1a1a1a;
}

.vip-price span {
    font-size: 14px;
    font-weight: 500;
    color: #718096;
}

.vip-features {
    list-style: none;
    margin: 8px 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vip-features li {
    font-size: 14px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vip-features li::before {
    content: "✅";
    font-size: 12px;
}

.vip-card button {
    width: 100%;
    padding: 14px 0;
}

/* ==========================================================================
   9. TRANSITIONS MOTION MECHANICS
   ========================================================================== */
@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }

    100% {
        opacity: 0.6;
        transform: scale(0.98);
    }
}