:root {
    --primary-blue: #007bff;
    --primary-blue-hover: #0069d9;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-radius: 12px;
    --header-height: 60px;
}

body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    height: var(--header-height);
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary-blue);
}

.logo-text {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary-blue) !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
    letter-spacing: -1px;
}

.logo:hover .logo-text {
    color: var(--primary-blue) !important;
}

.branding-container {
    text-align: center;
    margin-bottom: 30px;
}

.brand-main {
    font-size: 56px;
    font-weight: 900;
    /* Main Gradient: Cyan -> Blue -> Purple -> Orange */
    background: linear-gradient(90deg, #00c6ff 0%, #0072ff 30%, #9d00ff 60%, #ff7e29 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    margin: 0;
    line-height: 1;
    letter-spacing: -2px;
}

.brand-url {
    font-size: 18px;
    font-weight: 600;
    /* URL Gradient: Orange -> Pink/Purple */
    background: linear-gradient(90deg, #ff9966, #ff5e62);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    margin: 5px 0 10px 0;
    display: block;
}

.brand-tagline {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 8px;
    color: #555;
}

/* Brand Tagline Colors - Brighter */
.tag-connect { color: #06b6d4; text-shadow: 0 0 1px rgba(6,182,212,0.3); }
.tag-chat { color: #8b5cf6; text-shadow: 0 0 1px rgba(139,92,246,0.3); }
.tag-communicate { color: #f97316; text-shadow: 0 0 1px rgba(249,115,22,0.3); }

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.language-selector::after {
    content: '▾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    pointer-events: none;
    font-size: 12px;
    opacity: 0.9;
}

.language-selector select {
    background-color: var(--primary-blue) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 8px 28px 8px 12px !important;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    line-height: 1;
}

.language-selector select:focus {
    outline: 2px solid rgba(0, 123, 255, 0.35);
    outline-offset: 2px;
}

.language-selector select:hover {
    background-color: var(--primary-blue-hover) !important;
}

.online-counter {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.online-counter .dot {
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
}

.header-btn {
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.boost-btn {
    background-color: var(--primary-blue);
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}

.boost-btn:hover {
    background-color: var(--primary-blue-hover);
}

.header-icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.header-icon-btn:hover {
    color: var(--primary-blue);
}

.header-icon-btn.boosted {
    color: #d4af37; /* gold */
    text-shadow: 0 0 6px rgba(212,175,55,0.6);
}

/* App Container */
#app {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center; /* For login screen */
    position: relative;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Login Screen */
#login-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto; /* Allow scrolling for SEO content */
    padding-top: 40px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
    flex-shrink: 0; /* Prevent shrinking */
    margin-bottom: 20px;
}

.login-card h1 {
    color: var(--primary-blue);
    margin-bottom: 10px;
    font-style: italic;
}

.login-card input, .login-card select, .panel-content select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
}

.start-btn {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 15px;
    width: 100%;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
}

.start-btn:hover {
    background-color: var(--primary-blue-hover);
}

/* Chat Screen */
#chat-screen {
    width: 100%;
    height: 100%;
    max-width: 1000px; /* Talkly width limit */
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-container {
    flex-grow: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.system-status-bar {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    color: #555;
    background: #fff;
}

.status-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-flag {
    margin-inline-start: auto;
    cursor: pointer;
    color: #dc3545;
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 15px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.message.received {
    align-self: flex-start;
    background-color: #f1f0f0;
    color: #000;
    border-bottom-left-radius: 4px;
}

.message.sent {
    align-self: flex-end;
    background-color: var(--primary-blue);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.system {
    align-self: center;
    background-color: transparent;
    color: #888;
    font-size: 13px;
    font-style: italic;
    border: 1px solid #eee;
}

.username {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 2px;
    display: none; /* Hide username in bubbles for cleaner look usually */
}

/* Footer Controls */
.chat-controls {
    display: flex;
    gap: 0; /* No gap for seamless look */
    height: 60px; /* Reduced height */
    border-radius: 30px; /* Fully rounded container */
    overflow: hidden; /* Clip children */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background: white;
}

.control-btn {
    height: 100%;
    border: none;
    border-radius: 0; /* Remove individual radius */
    color: white;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
    min-width: 80px;
}

.stop-btn {
    background-color: var(--primary-blue);
}

.stop-btn:hover, .send-btn:hover {
    background-color: var(--primary-blue-hover);
}

.send-btn {
    background-color: var(--primary-blue);
}

.input-wrapper {
    flex-grow: 1;
    background: white;
    padding: 0;
    display: flex;
    border: none;
    box-shadow: none;
}

#message-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 0 15px; /* Side padding only */
    resize: none;
}

/* Small visual feedback when logo focuses the input */
@keyframes flash-border {
    0% { box-shadow: 0 0 0 0 rgba(0,123,255,0.6); }
    100% { box-shadow: 0 0 0 8px rgba(0,123,255,0); }
}
.focus-flash {
    animation: flash-border 0.5s ease-out;
}

/* Boost Panel Overlay */
.panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.panel-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.plans-grid {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

.boost-plan-btn {
    background: #f8f9fa;
    border: 2px solid var(--primary-blue);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.boost-plan-btn:hover {
    background: #e3f2fd;
}

.close-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--primary-blue);
    font-style: italic;
}

.account-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}



.setting-item {
    margin-bottom: 15px;
    text-align: start;
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.setting-item input[type="range"],
.setting-item select {
    width: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.primary-btn, .secondary-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.primary-btn {
    background-color: var(--primary-blue);
    color: #fff;
}

.primary-btn:hover {
    background-color: var(--primary-blue-hover);
}

.secondary-btn {
    background-color: #6c757d;
    color: #fff;
}

.secondary-btn:hover {
    background-color: #5a6268;
}

/* Notification Modal */
.notification-content {
    text-align: center;
    max-width: 400px;
}

.notification-content h3 {
    color: var(--primary-blue);
    margin-top: 0;
}

.notification-content p {
    font-size: 16px;
    color: #333;
    margin: 15px 0 25px 0;
}

.notification-content button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
}

/* Age Verification */
.age-verification {
    width: calc(100% - 20px);
    margin: 15px 0;
    text-align: start;
    font-size: 14px;
    background: #f9f9f9;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 12px; /* Matches other inputs */
    display: flex;
    align-items: center;
}

.age-verification label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 100%;
    margin: 0;
}

.age-verification input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-purple);
    cursor: pointer;
    margin: 0;
    flex-shrink: 0; /* Prevent shrinking */
}

.age-verification span {
    line-height: 1.4;
    color: #555;
}

.age-verification a {
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: bold;
}

.age-verification a:hover {
    text-decoration: underline;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #333;
    color: white;
    padding: 15px;
    text-align: center;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.cookie-banner p {
    margin: 0;
    font-size: 14px;
}

.cookie-banner button {
    background-color: var(--primary-purple);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.cookie-banner button:hover {
    background-color: var(--primary-purple-hover);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    html, body {
        height: 100%; /* Fallback */
        height: 100dvh; /* Dynamic viewport height */
        width: 100%;
        overflow: hidden; /* Prevent body scroll completely */
        position: fixed; /* Lock the body in place */
    }

    .main-header {
        padding: 8px 10px;
        height: auto;
        flex-shrink: 0;
        flex-wrap: wrap;
        gap: 8px;
    }

    .logo-text {
        font-size: 20px;
    }
    
    .online-counter {
        padding: 4px 10px;
        font-size: 12px;
        border-radius: 16px;
    }
    
    .header-controls {
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .boost-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .language-selector select {
        padding: 6px 26px 6px 10px !important;
        font-size: 12px;
    }

    /* App Container */
    #app {
        height: 100%; /* Fill the fixed body */
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    /* Adjust chat screen to fill remaining space exactly */
    #chat-screen {
        padding: 0;
        flex: 1; /* Take remaining space */
        display: flex;
        flex-direction: column;
        background: white; /* Full white background on mobile */
        height: auto; /* Allow flex to control height */
        max-height: 100%; /* Ensure it doesn't overflow */
    }

    .chat-container {
        flex: 1;
        border-radius: 0; /* Remove radius on mobile */
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Contain scrolling */
        min-height: 0; /* Important for flex child scrolling */
    }

    .chat-messages {
        padding: 10px;
        /* Ensure messages area takes all available space */
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* Fixed footer controls at bottom */
    .chat-controls {
        height: 60px;
        gap: 0;
        border-radius: 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        flex-shrink: 0; /* Prevent shrinking */
        z-index: 10;
        background: #fff;
        padding-bottom: env(safe-area-inset-bottom, 20px); /* iPhone X+ safe area with fallback */
        margin-bottom: 0; /* Ensure no margin pushes it up */
    }

    /* Fix for iOS Safari bottom bar issue */
    /* When keyboard is NOT open */
    @supports (-webkit-touch-callout: none) {
        #chat-screen {
             /* iOS specific height fix */
             height: -webkit-fill-available;
        }
    }

    .control-btn {
        min-width: 70px;
        border-radius: 0;
    }

    .input-wrapper {
        border-radius: 0;
    }
    
    #message-input {
        font-size: 16px; /* Prevent zoom on iOS input focus */
    }
}

/* =========================================
   Account Modal & Form Styles (New)
   ========================================= */

.account-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 0; /* Padding is handled by header/body/footer */
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px 10px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--primary-blue);
    font-weight: 700;
}

.account-status {
    margin-top: 5px;
    font-size: 13px;
    color: #6c757d;
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.form-control {
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    width: 100%;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--primary-blue);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* Input Group for Email */
.input-group {
    display: flex;
    gap: 8px;
}

.input-group .form-control {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
}

/* Checkbox Group */
.checkbox-group {
    margin-top: 5px;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.consent-label input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-text {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    background-color: #fafafa;
    border-top: 1px solid #f0f0f0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    flex: 1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}
.btn-primary:hover {
    background-color: var(--primary-blue-hover);
    border-color: var(--primary-blue-hover);
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}
.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-outline-danger {
    color: #dc3545;
    background-color: transparent;
    border-color: #dc3545;
}
.btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    background-color: transparent;
}

/* Adjust layout for footer buttons */
.modal-footer button {
    min-width: 0; /* Allow shrinking if needed */
}
