/* Basic Setup */
:root {
    --primary-gradient: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    --bg-color: #fcebfa;
    --header-bg: #ffffff;
    --msg-gabriela: #ffffff;
    --msg-user: #e0b0ff;
    /* Light purple */
    --text-primary: #333;
    --text-secondary: #666;
    --accent-pink: #ff69b4;
    --accent-purple: #9370db;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
    --border-radius-lg: 18px;
    --border-radius-md: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    /* Prevent body scroll, handle in chat-area */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Loading Screen Animation */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #ff9a9e, #fad0c4, #fecfef, #a18cd1);
    background-size: 400% 400%;
    animation: gradientBG 6s ease infinite;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 85%;
    max-width: 320px;
    position: relative;
    z-index: 2;
    transform: translateY(0);
    animation: float-card 3s ease-in-out infinite;
}

@keyframes float-card {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Avatar Styling */
.avatar-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

.loading-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.avatar-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    animation: pulse-glow 2s infinite;
    z-index: -1;
}

@keyframes pulse-glow {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.4;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

/* Text & Progress */
.loading-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 25px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #fff;
    width: 0%;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: load-progress 3s linear forwards;
    /* Matches exactly 3s timeout */
}

@keyframes load-progress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* Floating Particles */
#particles {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* App Container */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 480px;
    /* Simulate mobile on desktop */
    margin: 0 auto;
    background: #fff;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

/* Header */
#chat-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #4cd137;
    border: 2px solid #fff;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 209, 55, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(76, 209, 55, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 209, 55, 0);
    }
}

.user-info {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.status-text {
    font-size: 0.8rem;
    color: #4cd137;
    font-weight: 500;
}

.brand-logo {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-pink);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Chat Area */
#chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    background: linear-gradient(135deg, #fff0f5 0%, #fae6fa 100%);
    /* Soft matching gradient */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Message Styles */
.message-row {
    display: flex;
    width: 100%;
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(10px);
    animation: fade-in-up 0.4s ease forwards;
}

@keyframes fade-in-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gabriela-row {
    justify-content: flex-start;
}

.user-row {
    justify-content: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--border-radius-lg);
    max-width: 80%;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    box-shadow: var(--shadow-soft);
    word-wrap: break-word;
}

.gabriela-bubble {
    background: var(--msg-gabriela);
    color: #333;
    border-bottom-left-radius: 4px;
    /* Distinctive shape */
}

.user-bubble {
    background: var(--msg-user);
    color: #4a148c;
    /* Darker purple text for contrast */
    border-bottom-right-radius: 4px;
}

/* Media Queries for Bubbles */
.video-bubble {
    padding: 0;
    /* Remove padding for video */
    background: transparent;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 16px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.audio-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff0f5;
    /* Light pink as requested */
    border-radius: 18px;
    border: 1px solid rgba(255, 105, 180, 0.2);
    width: 260px;
    /* Fixed width for consistency */
}

/* Audio Player */
.play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-pink);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.play-btn:active {
    transform: scale(0.95);
}

.waveform-container {
    flex: 1;
    display: flex;
    align-items: center;
    height: 24px;
    gap: 2px;
}

.waveform-bar {
    width: 3px;
    background: #FFB6C1;
    border-radius: 2px;
    height: 100%;
    animation: none;
}

.playing .waveform-bar {
    animation: wave 1s infinite ease-in-out;
}

@keyframes wave {

    0%,
    100% {
        height: 10%;
    }

    50% {
        height: 100%;
    }
}

.duration {
    font-size: 0.75rem;
    color: #888;
    margin-left: auto;
}

/* Typography Helpers */
.timestamp {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* Typing Indicator */
.typing-bubble,
.recording-bubble {
    padding: 10px 16px;
    background: white;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-soft);
    border-bottom-left-radius: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Recording Animation */
.recording-text {
    font-size: 0.85rem;
    color: #666;
    margin-right: 8px;
}

/* Input Area */
#input-area {
    background: #fff;
    padding: 10px 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 24px;
    padding: 8px 16px;
}

#user-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    padding: 8px 0;
}

#send-btn {
    background: none;
    border: none;
    color: var(--accent-pink);
    cursor: pointer;
    padding: 4px;
}

/* CTA Button */
#cta-container {
    padding: 0 20px 20px 20px;
    background: transparent;
    text-align: center;
    position: sticky;
    bottom: 70px;
    /* Above input area */
    z-index: 90;
    pointer-events: none;
    /* Let clicks pass through if covered */
}

#cta-button {
    pointer-events: auto;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    /* Vibrant gradient */
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    animation: pulse-button 2s infinite;
    text-transform: uppercase;

    /* Anchor tag specifics */
    display: block;
    text-decoration: none;
    text-align: center;
}

@keyframes pulse-button {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

/* Utilities */
.bottom-spacer {
    height: 80px;
    /* Ensure content isn't hidden behind fixed footer */
}

.avatar-small {
    width: 30px;
    height: 30px;
    margin-right: 8px;
    align-self: flex-end;
    /* Align with bottom of bubble */
}

.avatar-small img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Video specific styles */
vturb-smartplayer {
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    width: 100% !important;
    display: block;
}