/* ============================================
   Cung Katon - AI Virtual Assistant
   White Glassmorphism + Techie Theme
   ============================================ */

:root {
    /* Techie gradient palette */
    --grad-1: #6366F1;
    /* Indigo */
    --grad-2: #8B5CF6;
    /* Violet */
    --grad-3: #06B6D4;
    /* Cyan */
    --grad-4: #10B981;
    /* Emerald */
    --grad-5: #F43F5E;
    /* Rose */

    /* Surfaces */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);

    --text-primary: #1E1B4B;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --success: #10B981;
    --warning: #F59E0B;

    --radius: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
    background:
        radial-gradient(circle, rgba(99, 102, 241, 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
        #FAFBFF;
}

/* Subtle gradient orbs in background */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

body::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--grad-1), var(--grad-3));
    top: -100px;
    right: -100px;
}

body::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--grad-2), var(--grad-5));
    bottom: -80px;
    left: -80px;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   Glassmorphism Utility
   ============================================ */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ============================================
   Header
   ============================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    box-shadow: var(--glass-shadow);
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding-left: 12px;
    border-left: 2px solid var(--grad-3);
    font-weight: 500;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.status-badge[data-status="listening"] {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}

.status-badge[data-status="listening"] .status-dot {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
    animation: pulse 0.5s infinite;
}

.status-badge[data-status="speaking"] {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.2);
}

.status-badge[data-status="speaking"] .status-dot {
    background: var(--grad-3);
    box-shadow: 0 0 6px rgba(6, 182, 212, 0.5);
    animation: pulse 0.3s infinite;
}

.status-badge[data-status="thinking"] {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
}

.status-badge[data-status="thinking"] .status-dot {
    background: var(--grad-2);
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
    animation: pulse 0.8s infinite;
}

.status-badge[data-status="error"] {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.2);
}

.status-badge[data-status="error"] .status-dot {
    background: var(--grad-5);
    box-shadow: 0 0 6px rgba(244, 63, 94, 0.5);
    animation: none;
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    gap: 20px;
    overflow: hidden;
}

/* Avatar Area */
.avatar-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.avatar-3d-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mascot GIF */
.mascot-gif {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.avatar-3d-container.speaking .mascot-gif {
    animation: mascotBounce 0.6s ease-in-out infinite;
}

@keyframes mascotBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.02);
    }
}

/* Floating Icons */
.floating-icons {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.float-icon {
    position: absolute;
    font-size: 1.2rem;
    padding: 10px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.06);
    animation: float 4s ease-in-out infinite;
}

.icon-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.icon-2 {
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.icon-3 {
    bottom: 25%;
    left: 5%;
    animation-delay: 2s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

/* ============================================
   Transcript Panel
   ============================================ */
.transcript-panel {
    width: 400px;
    max-width: 38%;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.transcript-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.reset-btn {
    background: none;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.2s;
}

.reset-btn:hover {
    opacity: 1;
}

.transcript-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transcript-messages::-webkit-scrollbar {
    width: 3px;
}

.transcript-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.15);
    border-radius: 2px;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 8px;
    max-width: 100%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--grad-3), var(--grad-4));
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.message-content {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: calc(100% - 40px);
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}

.message.assistant .message-content {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom-left-radius: 4px;
}

/* ============================================
   Controls
   ============================================ */
.controls {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    justify-content: center;
}

.mic-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    border: none;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.mic-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.mic-btn.listening {
    background: linear-gradient(135deg, var(--grad-5), #FB923C);
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35);
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.3);
    }

    50% {
        box-shadow: 0 0 0 12px transparent;
    }
}

.mic-icon {
    width: 20px;
    height: 20px;
}

.mic-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
}

.mic-btn.listening .mic-ripple {
    animation: ripple 1.5s ease-out infinite;
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

.text-input-wrap {
    flex: 1;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 18px;
    border-radius: var(--radius-full);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input-wrap:focus-within {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08), 0 8px 32px rgba(99, 102, 241, 0.08);
}

.text-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}

.text-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--grad-3), var(--grad-4));
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

.send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}

.send-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   Animations
   ============================================ */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .avatar-area {
        flex: none;
        height: 35vh;
    }

    .transcript-panel {
        width: 100%;
        max-width: 100%;
        flex: 1;
    }

    .floating-icons {
        display: none;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 10px 14px;
    }

    .logo-subtitle {
        display: none;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .text-input-wrap {
        max-width: 100%;
        width: 100%;
    }
}

/* ============================================
   Start Overlay
   ============================================ */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    transition: opacity 0.5s ease;
}

.overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.2s ease;
}

.overlay-content:hover {
    transform: scale(1.05);
}

.overlay-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--grad-1);
}

.overlay-content h3 {
    margin-bottom: 8px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}
