:root {
    --bg-color: #050505;
    --card-bg: #0f0f0f;
    --input-bg: #151515;
    --accent-color: #3b82f6;
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(59, 130, 246, 0.3);
    --font-family: 'Poppins', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    overflow: hidden;
}

.app-wrapper {
    display: flex;
    justify-content: center;
    height: 100%;
}

.chat-interface {
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    position: relative;
}

/* Header - Shadowless Glassmorphism with Safe Area Support */
.glass-header {
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: 12px;
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(15px);
    background: rgba(5, 5, 5, 0.85);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
}

.bot-logo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border-light);
}

.bot-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-indicator {
    width: 13px;
    height: 13px;
    background: #4ade80;
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    right: 2px;
    border: 2px solid var(--bg-color);
    z-index: 2;
}

.status-indicator::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    70% { transform: scale(2.5); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

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

.credit-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.credit-display span {
    font-size: 0.8rem;
    font-weight: 700;
    color: #FFD700;
}

.bot-info h1 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
}

.bot-info span {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: block;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    padding: 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--text-main);
}

/* Chat Content Area */
.chat-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.hero-section {
    margin: auto;
    text-align: center;
    max-width: 320px;
    padding: 40px 0;
}

.hero-logo-large {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.hero-section p {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
}

/* Messages - Shadowless Depth */
.message {
    max-width: 85%;
    padding: 10px 14px 28px;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 18px;
    position: relative;
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.message-time {
    position: absolute;
    bottom: 6px;
    right: 12px;
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 500;
}

.message.ai .message-time {
    color: var(--text-dim);
    right: auto;
    left: 12px;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
    right: 12px;
    left: auto;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

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

.message.ai {
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

/* Input Section with Safe Area Support - Perfect Bottom Fit */
.input-container {
    padding: 12px 12px calc(8px + env(safe-area-inset-bottom));
    background: var(--bg-color);
    border-top: 1px solid var(--border-light);
}

.input-box-wrapper {
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    gap: 12px;
    transition: border-color 0.3s;
}

.input-box-wrapper:focus-within {
    border-color: var(--accent-color);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    padding: 10px 0;
    resize: none;
    outline: none;
    max-height: 150px;
}

.attach-btn,
.send-trigger {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-trigger {
    background: var(--accent-color);
    color: white;
    border-radius: 12px;
}

.send-trigger:hover {
    transform: scale(1.05);
}


/* WhatsApp Style Loading Bubble */
.typing-bubble {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 12px 18px !important;
    width: fit-content;
    height: auto;
    min-height: 40px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Bottom Sheet Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

.bottom-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-light);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 20px 0 env(safe-area-inset-bottom);
    z-index: 101;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    overflow-y: auto;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-header {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 1px;
    padding: 0 20px;
}

/* User Info Section */
.user-info {
    background: var(--input-bg);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-container {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
}

.user-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-fallback {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

.user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Action Items */
.action-item {
    padding: 16px 20px;
    background: var(--input-bg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.action-item:last-child {
    border-bottom: none;
}

.action-item.danger {
    color: #ff4d4d;
    border-color: rgba(255, 77, 77, 0.2);
}

.action-item.danger:hover {
    background: rgba(255, 77, 77, 0.05);
    border-color: #ff4d4d;
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.sheet-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.options-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.option-item {
    padding: 16px 20px;
    background: var(--input-bg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.option-item:last-child {
    border-bottom: none;
}

.option-item:hover {
    border-color: var(--accent-color);
}

.option-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-color);
}

.option-label {
    font-weight: 500;
    font-size: 0.95rem;
}

.option-check {
    color: var(--accent-color);
    display: none !important;
}

.option-item.active .option-check {
    display: block !important;
}

/* Credit Modal - Bottom Sheet Style */
.credit-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    opacity: 0;
}

.credit-modal.active {
    display: block;
    opacity: 1;
}

.credit-content {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-light);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: 20px 20px env(safe-area-inset-bottom);
    width: 100%;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.credit-modal.active .credit-content {
    transform: translateY(0);
}

.credit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.title-group h3 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-main);
}

.title-group p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.close-modal {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-dim);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.credit-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credit-card {
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    transition: transform 0.2s;
}

.credit-card.popular {
    background: rgba(59, 130, 246, 0.03);
    border-color: var(--accent-color);
    transform: scale(1.02);
}

.popular-tag {
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--accent-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.plan-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
}

.plan-icon.basic { color: #CD7F32; background: rgba(205, 127, 50, 0.1); }
.plan-icon.popular { color: #FFD700; background: rgba(255, 215, 0, 0.1); }
.plan-icon.ultimate { color: #E5E4E2; background: rgba(229, 228, 226, 0.1); }

.plan-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.credit-amount {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-main);
}

.credit-pricing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.discount-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.real-price {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-decoration: line-through;
    opacity: 0.6;
}

.buy-btn {
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

.buy-btn.premium-glow {
    background: var(--accent-color);
    border: none;
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.buy-btn.premium-glow::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(
        45deg,
        transparent 20%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 80%
    );
    animation: shimmer 3s infinite;
    transform: rotate(45deg);
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.secure-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    color: var(--text-dim);
    font-size: 0.75rem;
}

.secure-footer i {
    color: #4ade80;
}

/* Scrollbar Customization - Hidden */
::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    background: transparent;
}

* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Mobile Specifics */
@media (max-width: 600px) {
    .chat-interface {
        border: none;
    }

    .message {
        max-width: 90%;
    }

    .hero-section {
        padding: 60px 20px;
    }
}

/* Login Screen Styles */
.login-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    text-decoration: none;
    z-index: 100;
}

.login-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-light);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.login-card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 40px;
}

.age-verification {
    margin-bottom: 24px;
    background: rgba(59, 130, 246, 0.05);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.age-verification:focus-within {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.08);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    user-select: none;
    line-height: 1.4;
}

.checkbox-container input {
    display: none;
}

.custom-check {
    width: 24px;
    height: 24px;
    background: var(--input-bg);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    font-size: 0.75rem;
}

.checkbox-container input:checked + .custom-check {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.custom-check i {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-container input:checked + .custom-check i {
    opacity: 1;
    transform: scale(1);
}

.label-text {
    opacity: 0.8;
    transition: opacity 0.2s;
}

.checkbox-container input:checked ~ .label-text {
    opacity: 1;
    font-weight: 600;
}

.google-auth-btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: none;
    background: white;
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
}

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

.google-auth-btn svg {
    flex-shrink: 0;
}

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.login-footer i {
    color: #4ade80;
}

/* Terms & Conditions Styles */
.terms-scroll-area {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 10px;
    margin-top: 10px;
}

.terms-section {
    margin-bottom: 20px;
}

.terms-section h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.terms-section p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.label-text a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.label-text a:hover {
    color: #60a5fa;
    text-decoration: none;
}