@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;500;700;900&family=Space+Grotesk:wght@300;400;500;700&display=swap');

:root {
  --primary-color: #002d61;
  --primary-glow: #3a6090;
  --accent-color: #5a6a8a;
  --secondary-color: #1e1f2e;
  --background-color: #0a0b1e;
  --surface-color: rgba(16, 18, 39, 0.85);
  --chat-bg-color: rgba(20, 22, 44, 0.6);
  --text-color: #f0f0f5;
  --input-bg-color: rgba(74, 124, 181, 0.05);
  --button-hover-color: #5a8cc5;
  --shadow-color: rgba(74, 124, 181, 0.25);
  --gradient-1: linear-gradient(135deg, #3a5a8a 0%, #4a6a9a 100%);
  --gradient-2: linear-gradient(135deg, #002d61 0%, #5a6a8a 100%);
  --gradient-dark: linear-gradient(180deg, #0a0b1e 0%, #1a1b3a 100%);
}

* {
  box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Inter', 'Space Grotesk', 'Orbitron', 'Segoe UI', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 10px env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 5px) env(safe-area-inset-left);
    position: relative;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(74, 124, 181, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(90, 106, 138, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(58, 90, 138, 0.08) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    z-index: -2;
}

/* Animated Grid Background */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(74, 124, 181, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 124, 181, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 30s linear infinite;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-20px, -20px) scale(1.1); }
    66% { transform: translate(20px, -10px) scale(1.05); }
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Language Button - Enhanced */
.language-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-glow));
    border: none;
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    color: var(--background-color);
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(74, 124, 181, 0.25);
}

.language-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 25px rgba(74, 124, 181, 0.4);
    filter: brightness(1.2);
}

/* Placeholder */
.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85em;
    font-weight: 300;
}

/* Iframe Container */
.iframe-container {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 10px auto;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 300px;
    max-height: 60vh;
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    border: none;
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.6),
      inset 0 0 8px rgba(0, 0, 0, 0.6);
}

/* NO glow behind iframe now */
.iframe-container::before,
.iframe-container::after {
    content: none;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 23px;
    background-color: transparent;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 720px;
    background: linear-gradient(
        135deg,
        rgba(20, 22, 44, 0.9),
        rgba(30, 32, 54, 0.7)
    );
    border-radius: 24px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(74, 124, 181, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin: 10px auto;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(74, 124, 181, 0.15);
    max-height: calc(50vh - 20px);
    position: relative;
    overflow: hidden;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(74, 124, 181, 0.06),
        transparent
    );
    animation: shimmer 8s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    100% { left: 100%; }
}

.container-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

/* Chat Response */
.chat-response-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    height: 75px;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    padding-bottom: 10px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(74, 124, 181, 0.015)
    );
}

.chat-response {
    padding: 15px;
    overflow-y: auto;
    font-size: 1.15em;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    display: block;
    word-wrap: break-word;
    box-sizing: border-box;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(74, 124, 181, 0.2);
    line-height: 1.7;
    font-weight: 400;
    font-family: 'Inter', 'Space Grotesk', sans-serif;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Input */
.chat-input {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: linear-gradient(
        135deg,
        rgba(30, 32, 54, 0.9),
        rgba(20, 22, 44, 0.9)
    );
    gap: 12px;
    border-top: 1px solid rgba(74, 124, 181, 0.08);
}

.chat-input input {
    flex-grow: 1;
    width: auto;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: rgba(74, 124, 181, 0.05);
    color: var(--text-color);
    font-size: 1em;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(74, 124, 181, 0.08);
    box-shadow: 
        0 0 20px rgba(74, 124, 181, 0.15),
        inset 0 0 20px rgba(74, 124, 181, 0.03);
}

/* Send Button */
.chat-input button {
    padding: 12px 24px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-glow));
    color: #ffffff;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(74, 124, 181, 0.2);
}

.chat-input button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.chat-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 124, 181, 0.35);
}

.chat-input button:active {
    transform: translateY(0);
}

.chat-input button:hover::before {
    width: 300px;
    height: 300px;
}

/* Voice Input */
.voice-input {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: rgba(20, 22, 44, 0.5);
    position: relative;
    border-top: 1px solid rgba(74, 124, 181, 0.08);
}

/* Voice Button */
#voice-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #ffffff;
    margin: 0 20px;
    box-shadow: 
        0 8px 25px rgba(74, 124, 181, 0.25),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

#voice-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(0, 0, 0, 0.3),
        transparent
    );
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    opacity: 0;
}

#voice-button:hover::before {
    opacity: 1;
}

@keyframes pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

#voice-button:hover {
    transform: scale(1.1);
    box-shadow: 
        0 12px 35px rgba(74, 124, 181, 0.4),
        0 0 20px rgba(90, 106, 138, 0.25);
}

#voice-button:active {
    transform: scale(0.95);
}

#voice-button.pressed {
    animation: recording 1s ease-in-out infinite;
    background: linear-gradient(135deg, #ff0080, #ff8c00);
}

@keyframes recording {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Equalizer Bars */
#equalizer-left, #equalizer-right {
    width: 6px;
    height: 20px;
    background: linear-gradient(to top, var(--primary-color), var(--accent-color));
    margin: 0 8px;
    transition: height 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(74, 124, 181, 0.3);
}

/* History Button */
.history-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(74, 124, 181, 0.08);
    border: 1px solid rgba(74, 124, 181, 0.2);
    font-size: 1.5em;
    cursor: pointer;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-btn:hover {
    background: rgba(74, 124, 181, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(74, 124, 181, 0.25);
}

/* Click Hold Text */
.click-hold-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75em;
    margin-top: 8px;
    padding-bottom: 6px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Loading */
.loading {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 300px;
    height: 3px;
    background: rgba(74, 124, 181, 0.08);
    border-radius: 3px;
    overflow: hidden;
    display: none;
}

.loading .loading-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent,
        var(--primary-color),
        var(--accent-color),
        transparent
    );
    animation: loading 1.5s linear infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Chat History */
.chat-history {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-width: 350px;
    background: linear-gradient(
        135deg,
        rgba(20, 22, 44, 0.95),
        rgba(30, 32, 54, 0.95)
    );
    box-shadow: 
        -10px 0 30px rgba(0, 0, 0, 0.3),
        0 0 50px rgba(74, 124, 181, 0.06);
    overflow-y: auto;
    display: none;
    padding: 20px;
    z-index: 20;
    backdrop-filter: blur(20px) saturate(1.5);
    border-left: 1px solid rgba(74, 124, 181, 0.15);
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.chat-history div {
    margin-bottom: 20px;
    font-size: 0.95em;
    border-bottom: 1px solid rgba(74, 124, 181, 0.08);
    padding-bottom: 15px;
    animation: fadeIn 0.5s ease-out;
}

/* History Buttons */
.close-btn, .download-btn, .brochure-btn, .more-info-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-glow));
    border: none;
    padding: 12px 20px;
    border-radius: 16px;
    cursor: pointer;
    color: #ffffff;
    width: 100%;
    margin-bottom: 12px;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(74, 124, 181, 0.2);
}

.close-btn:hover, .download-btn:hover, .brochure-btn:hover, .more-info-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 124, 181, 0.35);
}

/* Scrollbar */
.chat-response::-webkit-scrollbar,
.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-response::-webkit-scrollbar-track,
.chat-history::-webkit-scrollbar-track {
    background: rgba(74, 124, 181, 0.03);
    border-radius: 3px;
}

.chat-response::-webkit-scrollbar-thumb,
.chat-history::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--accent-color));
    border-radius: 3px;
}
.chat-response::-webkit-scrollbar-thumb,
.chat-history::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--accent-color));
    border-radius: 3px;
}

/* Queue Overlay - Spectacular Design */
.queue-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(10, 11, 30, 0.95),
        rgba(0, 0, 0, 0.98)
    );
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px) saturate(1.5);
}

/* Animated Background for Queue */
.queue-overlay::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at 30% 50%,
        rgba(74, 124, 181, 0.06),
        transparent 40%
    );
    animation: queueGlow 10s ease-in-out infinite;
}

@keyframes queueGlow {
    0%, 100% { transform: translate(-25%, -25%) scale(1); }
    50% { transform: translate(-25%, -25%) scale(1.2); }
}

.queue-message {
    background: linear-gradient(
        135deg,
        rgba(20, 22, 44, 0.95),
        rgba(30, 32, 54, 0.95)
    );
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(74, 124, 181, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(74, 124, 181, 0.15);
    position: relative;
    overflow: hidden;
    max-width: 500px;
    animation: queueMessageEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes queueMessageEntrance {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.queue-message h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.queue-message p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
    margin-bottom: 30px;
    line-height: 1.6;
}

.queue-position {
    font-size: 3.5em;
    font-weight: 900;
    margin: 30px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Orbitron', sans-serif;
    animation: queuePulse 2s ease-in-out infinite;
}

@keyframes queuePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

#estimated-wait-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95em;
    margin-top: 15px;
}

#more-info {
    font-size: 0.9em;
    margin-top: 15px;
    padding: 15px;
    background: rgba(74, 124, 181, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(74, 124, 181, 0.12);
    animation: fadeIn 0.5s ease-out;
}

#more-info ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

#more-info li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: rgba(255, 255, 255, 0.8);
}

#more-info li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

#time-left {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75em;
    padding: 8px;
    color: var(--primary-color);
    font-weight: 500;
    letter-spacing: 0.5px;
    background: rgba(74, 124, 181, 0.03);
    border-radius: 8px;
    margin-top: 5px;
}

/* Rejoin Button - Ultra Modern */
.rejoin-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #ffffff;
    border: none;
    padding: 16px 32px;
    font-size: 1.1em;
    font-weight: 700;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 25px rgba(74, 124, 181, 0.25),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    outline: none;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
}

.rejoin-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.5s;
}

.rejoin-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 35px rgba(74, 124, 181, 0.4),
        0 0 20px rgba(90, 106, 138, 0.25);
}

.rejoin-button:hover::before {
    left: 100%;
}

.rejoin-button:active {
    transform: translateY(-1px);
}

/* Disabled State */
.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(74, 124, 181, 0.2);
}

/* Selection Style */
::selection {
    background-color: var(--primary-color);
    color: var(--background-color);
}

/* Enhanced Animations */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes slideIn {
    0% { transform: translateY(100%); }
    100% { transform: translateY(0); }
}

@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Mobile Responsive - Premium Mobile Experience */
@media (max-width: 768px) {
    body {
        height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
    }

    .iframe-container {
        max-width: 90%;
        height: 50vh;
        min-height: 150px;
        margin: 5px auto;
        border-radius: 20px;
    }

    .chat-container {
        max-width: 90%;
        margin: 5px auto 10px;
        flex-shrink: 0;
        max-height: calc(70vh - 25px);
        border-radius: 20px;
    }

    .chat-response-container {
        height: 100px;
        max-height: calc(100% - 120px);
        overflow-y: auto;
    }

    .chat-input {
        padding: 10px;
        gap: 10px;
    }

    .chat-input input {
        padding: 10px 14px;
        font-size: 1em;
    }

    .chat-input button {
        padding: 10px 16px;
        font-size: 0.95em;
    }

    .chat-response {
        padding: 12px;
        font-size: 0.95em;
    }

    .chat-history {
        width: 100%;
        max-width: 100%;
        height: 100%;
        left: 0;
        border-radius: 0;
    }

    .voice-input {
        padding: 10px;
    }

    #voice-button {
        width: 50px;
        height: 50px;
    }

    .click-hold-text {
        font-size: 0.7em;
        margin-top: 5px;
    }

    .queue-message {
        padding: 30px 20px;
        margin: 20px;
    }

    .queue-message h2 {
        font-size: 1.5em;
    }

    .queue-position {
        font-size: 2.5em;
    }
}

@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

@media screen and (max-height: 600px) {
    .iframe-container {
        height: 25vh;
        min-height: 120px;
    }

    .chat-container {
        max-height: calc(75vh - 25px);
        margin-bottom: 10px;
    }

    .chat-response-container {
        height: 80px;
        max-height: calc(100% - 100px);
        overflow-y: auto;
    }
}

/* Bottom Gap */
.bottom-gap {
    height: 10px;
    width: 100%;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth Transitions for Theme Changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}