:root {
    /* Professional Light Theme */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --accent-color: #3b82f6;

    --bg-base: #f1f5f9;

    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: #e2e8f0;
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);

    --text-main: #0f172a;
    --text-muted: #64748b;

    --bot-msg-bg: #f8fafc;
    --user-msg-bg: #2563eb;
    --user-text: #ffffff;

    --font-main: 'Outfit', sans-serif;
    --font-header: 'Montserrat', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    background: #f1f5f9;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    overflow: hidden;
    position: relative;
}

/* Attractive Abstract Vector Background via Pseudo-element only */
body::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.5;
    background-color: #f1f5f9;
    /* Clean Professional Dot Grid Pattern */
    background-image: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
    background-size: 24px 24px;
}

#neuro-canvas {
    display: none;
}

.app-container {
    width: 100%;
    max-width: 400px;
    /* Slightly wider for better proportion */
    height: 96vh;
    /* Incrice Height: fill more of the screen */
    max-height: 900px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
    /* Zoom effect: Scale everything down slightly by reducing base font size in container? 
       No, CSS zoom is non-standard. Better to use smaller font-sizes manually. */
    font-size: 0.85rem;
}

/* Header */
.app-header {
    padding: 18px 24px;
    /* Attractive Gradient: Royal Blue to Deep Ocean */
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    /* Removed Radius as requested */
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
    /* Glowy shadow */
}

.logo-section {
    display: flex;
    align-items: center;
}

.title-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.title-container h1 {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    /* White text pops on blue */
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.title-container .subtitle {
    font-size: 0.7rem;
    color: #86efac;
    /* Bright Green Online Status */
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 0;
    margin-top: 4px;
    /* Slight gap */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    align-self: flex-start;
    backdrop-filter: blur(4px);
}

.header-actions {
    display: flex;
    align-items: center;
}

.restart-btn {
    background: rgba(255, 255, 255, 0.2);
    /* Glassmorphism */
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.restart-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.restart-btn i {
    transition: transform 0.4s ease;
}

.restart-btn:hover i {
    transform: rotate(180deg);
}

/* Chat Area */
.chat-container {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: #ffffff;
    /* Subtle Paper Texture / Geometry inside chat */
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 24px 24px;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 85%;
    opacity: 0;
    animation: slideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    flex-direction: row-reverse;
    align-self: flex-end;
}

/* Avatars */
.avatar {
    width: 32px;
    /* Reduced from 38px (approx 80%) */
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    /* Reduced icon size */
    flex-shrink: 0;
    transition: transform 0.2s;
}

.message:hover .avatar {
    transform: scale(1.05);
}

.bot-avatar {
    background: white;
    color: var(--primary-color);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.user-avatar {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.message-content {
    padding: 10px 14px;
    /* Reduced padding (was 14px 18px) */
    font-size: 0.85rem;
    /* Smaller font (was 0.95rem) */
    line-height: 1.5;
    border-radius: 14px;
    /* Slightly tighter radius */
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.bot-message .message-content {
    background: #f8fafc;
    color: var(--text-main);
    border: 1px solid #f1f5f9;
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.25);
}

/* Typing & Options */
.typing-cursor::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--primary-color);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-start infinite;
}

/* Typing Dots Animation */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
}

.option-btn {
    padding: 12px 20px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    /* Flex grow */
    flex: 1 1 auto;
    min-width: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

/* Attractive Button Animations */
.option-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.option-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.15);
}

.option-btn:hover::after {
    opacity: 1;
}

.option-btn:active {
    transform: translateY(0);
    background: #eff6ff;
}

/* Input Area */
.input-area {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #f1f5f9;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.input-area.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    /* Take out of flow to avoid gap? Or just hide visually? */
    bottom: 0;
    width: 100%;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    background: #f8fafc;
    padding: 8px 8px 8px 16px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    align-items: center;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.icon-btn-small {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    border-radius: 8px;
}

.icon-btn-small:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.icon-btn-small.recording {
    color: #ef4444;
    animation: pulseRed 1s infinite;
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: var(--font-main);
    color: var(--text-main);
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 8px 12px -2px rgba(37, 99, 235, 0.3);
}

/* File Message */
.file-message {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-weight: 500;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile Fixes - MOVED TO BOTTOM TO OVERRIDE */
@media (max-width: 480px) {
    .app-container {
        height: 100dvh;
        border-radius: 0;
        border: none;
        max-width: 100%;
    }

    .input-area {
        padding: 12px 16px;
        /* Smaller padding on mobile */
    }

    .input-wrapper {
        padding: 6px 6px 6px 12px;
        gap: 8px;
    }

    .send-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        /* Force override */
        border-radius: 50%;
        /* Rounded on mobile? Or keep square? Keep squircle but smaller */
        border-radius: 10px;
    }

    .icon-btn-small {
        font-size: 1.1rem;
        padding: 4px;
    }

    #user-input {
        font-size:10px;
        /* Prevent IOS zoom */
    }

    /* Ensure Header title isn't too big */
    .title-container h1 {
        font-size: 0.95rem;
    }
}

/* Credit Text */
.credit-text {
    text-align: center;
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding-bottom: 4px;
}

/* Loader Animation */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Call Overlay - Mobile Call Style */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Dark gradient background like iOS call screen */
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 60px 20px 80px 20px;
    transition: all 0.4s ease;
}

.call-overlay::before {
    /* Subtle noise texture */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    pointer-events: none;
}

.call-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    /* Slide down/up effect */
}

/* Info Section */
.call-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.call-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.01em;
}

.call-timer {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Content Section */
.call-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    flex: 1;
    justify-content: center;
    z-index: 2;
    margin-bottom: 0;
}

.call-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: white;
    box-shadow: 0 0 40px rgba(37, 99, 235, 0.4);
    position: relative;
    border: 4px solid rgba(255, 255, 255, 0.1);
    animation: breathe 3s infinite ease-in-out;
}

.call-status {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.call-waves span {
    background: white;
    /* White waves on dark bg */
}

/* Actions Section */
.call-actions {
    z-index: 2;
    display: flex;
    gap: 40px;
    align-items: center;
}

.end-call-btn {
    width: 72px;
    height: 72px;
    background: #ef4444;
    font-size: 2rem;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.end-call-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.call-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.95);
}

.call-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
}

.call-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
    position: relative;
    /* Breathing animation when active */
    animation: breathe 3s infinite ease-in-out;
}

.call-avatar::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.5);
    animation: ripple 2s infinite linear;
    z-index: -1;
}

.call-status {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

.call-waves {
    display: flex;
    gap: 6px;
    height: 30px;
    align-items: center;
}

.call-waves span {
    width: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    animation: wave 1s infinite ease-in-out;
}

.call-waves span:nth-child(1) {
    height: 20%;
    animation-delay: -0.4s;
}

.call-waves span:nth-child(2) {
    height: 40%;
    animation-delay: -0.2s;
}

.call-waves span:nth-child(3) {
    height: 20%;
    animation-delay: 0s;
}

/* End Call Button */
.end-call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.end-call-btn:hover {
    transform: scale(1.1);
    background: #dc2626;
}

.icon-btn-header {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    /* Header text is white now */
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    position: relative;
    overflow: hidden;
}

.icon-btn-header:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.icon-btn-header i {
    z-index: 2;
}



.icon-btn-header:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 40px rgba(37, 99, 235, 0.5);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes wave {

    0%,
    100% {
        height: 20%;
    }

    50% {
        height: 100%;
    }
}