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

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

body {
    background-color: #01050e;
    color: #ffffff;
    font-family: 'Cairo', 'Outfit', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background effects */
.ambient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 20%, rgba(0, 240, 255, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(0, 85, 255, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(1, 5, 15, 0.6) 0%, transparent 100%);
    z-index: 1;
}

.grid-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 40px 40px;
    background-image: 
        linear-gradient(to right, rgba(0, 240, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 240, 255, 0.02) 1px, transparent 1px);
    z-index: 2;
}

.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to bottom, rgba(0, 240, 255, 0) 0%, rgba(0, 240, 255, 0.25) 50%, rgba(0, 240, 255, 0) 100%);
    animation: scan 8s linear infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes scan {
    0% { top: 0%; }
    100% { top: 100%; }
}

/* HUD Container */
.hud-container {
    position: relative;
    width: 96vw;
    height: 94vh;
    border: 1px solid rgba(0, 240, 255, 0.15);
    background: rgba(2, 8, 20, 0.75);
    backdrop-filter: blur(25px);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 
        0 0 50px rgba(0, 0, 0, 0.8),
        inset 0 0 30px rgba(0, 240, 255, 0.03);
    z-index: 5;
}

/* Corner Accents */
.corner-accent {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: #00f0ff;
    border-style: solid;
    pointer-events: none;
}
.top-left { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-top-left-radius: 12px; }
.top-right { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-top-right-radius: 12px; }
.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-bottom-left-radius: 12px; }
.bottom-right { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-bottom-right-radius: 12px; }

/* Header */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.hud-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 3px;
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.hud-title span {
    font-size: 0.85rem;
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 2px 10px;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    margin-right: 10px;
}

.hud-status {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.disconnected {
    background-color: #ff4a4a;
    box-shadow: 0 0 10px #ff4a4a;
}

.status-dot.connecting {
    background-color: #00f0ff;
    box-shadow: 0 0 10px #00f0ff;
    animation: blink 1s infinite;
}

.status-dot.connected {
    background-color: #4af2a1;
    box-shadow: 0 0 12px #4af2a1;
    animation: pulse 1.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

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

/* HUD Body */
.hud-body {
    flex: 1;
    display: flex;
    gap: 24px;
    min-height: 0;
}

/* Sia Core & Waveform Container (Right Top) */
.sia-core-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(2, 8, 20, 0.55);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 16px;
    padding: 16px 20px;
    position: relative;
    flex-shrink: 0; /* Prevents Sia container from shrinking, keeps it stable */
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.03);
}

.ai-core-container {
    width: 220px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.ai-core {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.5s ease;
}

/* Concentric Rings Base Styles */
.ring {
    position: absolute;
    border-radius: 50%;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    transform-origin: center;
}

/* Outer Ring (Dashed/Techy Accent) */
.ring-outer {
    width: 170px;
    height: 170px;
}
.ai-core.idle .ring-outer {
    border: 3.5px dashed rgba(0, 240, 255, 0.4);
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.45));
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
    animation: rotate-clockwise 20s linear infinite;
}
.ai-core.listening .ring-outer {
    border: 4.5px dashed rgba(0, 240, 255, 0.85);
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.9));
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
    animation: rotate-clockwise 8s linear infinite;
}
.ai-core.speaking .ring-outer {
    border: 4.5px dashed rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 0 14px rgba(0, 240, 255, 1));
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.6);
    animation: rotate-clockwise 4s linear infinite;
}

/* Middle Ring (Dotted & Solid Portions for Cyber Look) */
.ring-middle {
    width: 130px;
    height: 130px;
}
.ai-core.idle .ring-middle {
    border: 3.5px dotted rgba(0, 85, 255, 0.45);
    border-top: 3.5px solid rgba(0, 240, 255, 0.5);
    border-bottom: 3.5px solid rgba(0, 240, 255, 0.5);
    filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.4));
    animation: rotate-counter 25s linear infinite;
}
.ai-core.listening .ring-middle {
    border: 4.5px dotted rgba(0, 85, 255, 0.8);
    border-top: 4.5px solid rgba(0, 240, 255, 0.95);
    border-bottom: 4.5px solid rgba(0, 240, 255, 0.95);
    filter: drop-shadow(0 0 9px rgba(0, 240, 255, 0.8));
    animation: rotate-counter 10s linear infinite;
}
.ai-core.speaking .ring-middle {
    border: 4.5px dotted rgba(0, 240, 255, 0.9);
    border-top: 4.5px solid rgba(255, 255, 255, 0.98);
    border-bottom: 4.5px solid rgba(255, 255, 255, 0.98);
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.9));
    animation: rotate-counter 5s linear infinite;
}

/* Inner Ring (Slightly Thinner, High Contrast) */
.ring-inner {
    width: 90px;
    height: 90px;
}
.ai-core.idle .ring-inner {
    border: 2px dashed rgba(0, 240, 255, 0.5);
    border-left: 3.5px solid rgba(0, 85, 255, 0.6);
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.4));
    animation: rotate-clockwise 15s linear infinite;
}
.ai-core.listening .ring-inner {
    border: 3px dashed rgba(0, 240, 255, 0.85);
    border-left: 3.5px solid rgba(0, 240, 255, 0.95);
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.75));
    animation: rotate-clockwise 6s linear infinite;
}
.ai-core.speaking .ring-inner {
    border: 3px dashed rgba(255, 255, 255, 0.85);
    border-left: 3.5px solid rgba(0, 240, 255, 0.98);
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.85));
    animation: rotate-clockwise 3s linear infinite;
}

/* Core Inner (The Central Glowing Engine) */
.core-inner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: absolute;
    z-index: 2;
    transition: all 0.5s ease;
}
.ai-core.idle .core-inner {
    border: 3px solid rgba(0, 240, 255, 0.6);
    background: radial-gradient(circle, rgba(0, 240, 255, 0.25) 0%, #01050e 80%);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.45);
    animation: pulse-idle 4s ease-in-out infinite;
}
.ai-core.listening .core-inner {
    border: 3px solid rgba(0, 240, 255, 0.95);
    background: radial-gradient(circle, rgba(0, 240, 255, 0.55) 0%, #010c1a 80%);
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.8), 0 0 10px rgba(0, 240, 255, 0.4);
    animation: pulse-listening 1.5s ease-in-out infinite;
}
.ai-core.speaking .core-inner {
    border: 3px solid #ffffff;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, #002b4d 85%);
    box-shadow: 0 0 45px rgba(0, 240, 255, 0.95), 0 0 25px #ffffff;
    animation: pulse-speaking 0.8s ease-in-out infinite;
}

/* Animations */
@keyframes rotate-clockwise {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-counter {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

@keyframes pulse-idle {
    0%, 100% { transform: scale(1); opacity: 0.9; box-shadow: 0 0 20px rgba(0, 240, 255, 0.35); }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 30px rgba(0, 240, 255, 0.6); }
}

@keyframes pulse-listening {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(0, 240, 255, 0.65), 0 0 10px rgba(0, 240, 255, 0.3); }
    50% { transform: scale(1.12); box-shadow: 0 0 50px rgba(0, 240, 255, 0.95), 0 0 20px rgba(0, 240, 255, 0.5); }
}

@keyframes pulse-speaking {
    0%, 100% { transform: scale(1); box-shadow: 0 0 45px rgba(0, 240, 255, 0.95), 0 0 15px #ffffff; }
    50% { transform: scale(1.25); box-shadow: 0 0 70px rgba(0, 240, 255, 1), 0 0 30px #ffffff; }
}

.waveform-container {
    width: 100%;
    height: 100px;
    margin-bottom: 24px;
}

#waveform-canvas {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.8));
}

.controls {
    display: flex;
    gap: 16px;
}

/* Button Styling (Neon Cyber Theme) */
.hud-btn {
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 8px;
    background: rgba(0, 240, 255, 0.05);
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.05);
}

.hud-btn:hover:not(:disabled) {
    background: #00f0ff;
    color: #01050e;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
    transform: translateY(-2px);
}

.hud-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    background: transparent;
}

.hud-btn.danger {
    background: rgba(255, 74, 74, 0.1);
    color: #ff4a4a;
    border-color: rgba(255, 74, 74, 0.4);
}

.hud-btn.danger:hover:not(:disabled) {
    background: #ff4a4a;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 74, 74, 0.35);
}

.hud-btn.mini {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Right Column (Sia Control and Transcript) */
.sia-panel {
    flex: 1; /* Takes 50% width */
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

/* Left Column (Interactive Display) */
.display-panel {
    flex: 1; /* Takes 50% width */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.console-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(5, 5, 10, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    min-height: 0;
}

.box-header {
    background: rgba(0, 240, 255, 0.04);
    border-bottom: 1px solid rgba(0, 240, 255, 0.12);
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #00f0ff;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.3);
}

.box-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Transcript styling */
.sys-msg {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    text-align: center;
    margin-top: 20px;
}

.user-transcript {
    background: rgba(0, 240, 255, 0.05);
    border-right: 3px solid #00f0ff;
    padding: 6px 12px;
    border-radius: 4px 0 0 4px;
    margin-bottom: 12px;
    animation: fadeIn 0.4s ease-out;
}

.bot-text {
    background: rgba(0, 85, 255, 0.06);
    border-right: 3px solid #0055ff;
    padding: 6px 12px;
    border-radius: 4px 0 0 4px;
    margin-bottom: 12px;
    animation: fadeIn 0.4s ease-out;
}

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

/* Web Action/Iframe styling */
.web-iframe-container {
    position: relative;
    padding: 0 !important;
}

.web-placeholder {
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

#web-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.web-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
}

#web-url-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
    direction: ltr;
    text-align: left;
}

/* Footer */
.hud-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0, 240, 255, 0.1);
    padding-top: 14px;
    margin-top: 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

#time-display {
    color: #00f0ff;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.3);
}
