/* Global Reset and Typography */
:root {
    --bg-primary: hsl(222, 20%, 7%);
    --bg-panel: hsla(222, 20%, 12%, 0.45);
    --border-glass: hsla(222, 20%, 25%, 0.35);
    --border-glass-focus: hsla(190, 90%, 55%, 0.6);
    
    --text-primary: hsl(210, 20%, 95%);
    --text-secondary: hsl(215, 15%, 70%);
    --text-muted: hsl(215, 10%, 45%);
    
    --glow-cyan: hsl(190, 90%, 55%);
    --glow-magenta: hsl(330, 90%, 60%);
    --glow-purple: hsl(260, 85%, 60%);
    
    --color-success: hsl(145, 80%, 45%);
    --color-warning: hsl(40, 90%, 55%);
    --color-danger: hsl(355, 80%, 55%);
    --color-info: hsl(195, 85%, 50%);
    
    --font-display: 'Outfit', 'Noto Sans SC', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-display);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Animated Glows */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
    animation: drift 25s infinite alternate ease-in-out;
}

.bg-glow-1 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--glow-purple) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.bg-glow-2 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--glow-cyan) 0%, transparent 70%);
    bottom: -15%;
    right: -10%;
    animation-delay: -5s;
}

.bg-glow-3 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--glow-magenta) 0%, transparent 70%);
    top: 30%;
    left: 40%;
    animation-delay: -12s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    50% {
        transform: translate(8%, 5%) scale(1.1) rotate(90deg);
    }
    100% {
        transform: translate(-5%, -8%) scale(0.95) rotate(180deg);
    }
}

/* App Container Layout */
.app-container {
    width: 100vw;
    height: 100vh;
    max-width: 1600px;
    max-height: 950px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    z-index: 10;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-glass);
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo-text-gradient {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--glow-cyan), var(--glow-purple), var(--glow-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtext {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: -2px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    font-size: 13px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-idle { background-color: var(--text-muted); box-shadow: 0 0 8px var(--text-muted); }
.status-dot-connecting { 
    background-color: var(--color-warning); 
    box-shadow: 0 0 10px var(--color-warning);
    animation: pulse 1.5s infinite;
}
.status-dot-calling { 
    background-color: var(--color-success); 
    box-shadow: 0 0 10px var(--color-success);
    animation: pulse 1.5s infinite;
}
.status-dot-error { background-color: var(--color-danger); box-shadow: 0 0 8px var(--color-danger); }

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

.status-text {
    color: var(--text-secondary);
}

/* Main Workspace Grid */
.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: 340px 1fr 380px;
    gap: 20px;
    height: calc(100% - 80px);
}

/* Glassmorphism Panel styles */
.panel {
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-subheader {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Left Panel: Settings */
.settings-panel {
    padding: 0;
    gap: 0;
}

.settings-group {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-group:last-child {
    border-bottom: none;
    flex: 1;
}

.setting-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Provider Selector Cards */
.provider-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.provider-selector input[type="radio"] {
    display: none;
}

.provider-card {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.provider-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

.provider-selector input[type="radio"]:checked + .provider-card {
    border-color: var(--glow-cyan);
    background: rgba(190, 243, 255, 0.04);
    box-shadow: 0 0 15px rgba(190, 243, 255, 0.1);
}

.provider-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.provider-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-warning {
    background-color: rgba(230, 162, 60, 0.2);
    color: var(--color-warning);
    border: 1px solid rgba(230, 162, 60, 0.3);
}

/* Form inputs styling */
.glass-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s;
}

.glass-select:focus {
    border-color: var(--border-glass-focus);
}

.glass-textarea {
    width: 100%;
    flex: 1;
    min-height: 120px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
}

.glass-textarea:focus {
    border-color: var(--border-glass-focus);
}

/* Middle Panel: Call Console */
.console-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.console-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    max-width: 500px;
}

/* Glowing Call Button and Rings */
.call-sphere-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
}

.call-ring-outer, .call-ring-inner {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
    pointer-events: none;
    transition: all 0.5s ease;
}

.call-ring-outer {
    width: 240px;
    height: 240px;
    opacity: 0.15;
}

.call-ring-inner {
    width: 210px;
    height: 210px;
    opacity: 0.3;
}

/* Call Button States styling */
.btn-call {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
}

.btn-call:active {
    transform: scale(0.95);
}

.phone-icon {
    width: 44px;
    height: 44px;
    transition: transform 0.5s ease;
}

/* Idle State: Green Call */
.btn-call-idle {
    background: linear-gradient(135deg, hsl(145, 80%, 45%), hsl(155, 85%, 35%));
    box-shadow: 0 0 25px rgba(46, 204, 113, 0.4);
}

.btn-call-idle:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(46, 204, 113, 0.6);
}

/* Connecting State: Amber Pulse */
.btn-call-connecting {
    background: linear-gradient(135deg, hsl(40, 90%, 55%), hsl(30, 85%, 45%));
    animation: float-breath 2s infinite ease-in-out;
    box-shadow: 0 0 25px rgba(230, 126, 34, 0.4);
}

/* Calling State: Active (Red Hangup) */
.btn-call-active {
    background: linear-gradient(135deg, hsl(355, 80%, 55%), hsl(345, 85%, 45%));
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.4);
}

.btn-call-active:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(231, 76, 60, 0.7);
}

.btn-call-active .phone-icon {
    transform: rotate(135deg);
}

/* Outer Rings status-dependent styling */
.state-idle .call-ring-outer {
    border-color: var(--text-muted);
}
.state-idle .call-ring-inner {
    border-color: var(--text-muted);
}

.state-connecting .call-ring-outer {
    border-color: var(--color-warning);
    animation: ripple 2s infinite linear;
}
.state-connecting .call-ring-inner {
    border-color: var(--color-warning);
    animation: ripple 2s infinite linear 0.7s;
}

.state-active .call-ring-outer {
    border-color: var(--glow-cyan);
    animation: ripple 3s infinite linear;
}
.state-active .call-ring-inner {
    border-color: var(--glow-magenta);
    animation: ripple 3s infinite linear 1s;
}

@keyframes ripple {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes float-breath {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Waveforms Panel UI */
.waveforms-container {
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.glass-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.wave-track {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wave-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wave-canvas {
    width: 100%;
    height: 50px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* Right Panel: Transcript Log */
.transcript-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.transcript-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.transcript-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    gap: 16px;
    text-align: center;
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}

.transcript-placeholder p {
    font-size: 14px;
}

/* Chat bubble aesthetics */
.bubble {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: bubble-appear 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes bubble-appear {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.bubble-user {
    align-self: flex-end;
    background: linear-gradient(135deg, hsla(190, 90%, 55%, 0.15), hsla(190, 95%, 45%, 0.05));
    border: 1px solid hsla(190, 90%, 55%, 0.2);
    border-bottom-right-radius: 4px;
    color: var(--text-primary);
}

.bubble-ai {
    align-self: flex-start;
    background: linear-gradient(135deg, hsla(260, 85%, 60%, 0.12), hsla(260, 90%, 50%, 0.03));
    border: 1px solid hsla(260, 85%, 60%, 0.2);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.bubble-sender {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.bubble-user .bubble-sender {
    color: var(--glow-cyan);
}

.bubble-ai .bubble-sender {
    color: var(--glow-purple);
}

.transcript-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
}

/* Custom general glass button styles */
.glass-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive adjustment */
@media (max-width: 1200px) {
    .app-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
        overflow-y: auto;
    }
    .app-container {
        height: auto;
        max-height: none;
        overflow-y: auto;
    }
    .transcript-panel {
        grid-column: span 1;
        height: 600px;
    }
}

/* Extracted Info Card Styling */
.extracted-info-container {
    scrollbar-width: thin;
}

.extracted-field-card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.extracted-field-card:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(190, 243, 255, 0.2) !important;
    transform: translateY(-1px);
}

#extracted-status-badge {
    animation: badge-pulse 2s infinite ease-in-out;
}

@keyframes badge-pulse {
    0% { transform: scale(1); box-shadow: 0 0 4px rgba(46, 204, 113, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 0 10px rgba(46, 204, 113, 0.4); }
    100% { transform: scale(1); box-shadow: 0 0 4px rgba(46, 204, 113, 0.2); }
}

