/* Greenwood Family Medicine - AI Receptionist Demo
 * Styles for the doctor's office appointment booking demo
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    /* Background colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;

    /* Text colors */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    /* Accent colors */
    --accent-green: #10b981;
    --accent-green-dim: rgba(16, 185, 129, 0.15);
    --accent-purple: #8b5cf6;
    --accent-purple-dim: rgba(139, 92, 246, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-yellow: #f59e0b;
    --accent-yellow-dim: rgba(245, 158, 11, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);

    /* Border */
    --border-color: #30363d;
    --border-subtle: #21262d;

    /* Gradients */
    --gradient-purple-blue: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #059669 100%);

    /* Spacing - optimized for large TV display */
    --header-height: 80px;
    --panel-gap: 24px;

    /* Font sizes - enlarged for TV visibility */
    --font-xs: 13px;
    --font-sm: 15px;
    --font-base: 17px;
    --font-lg: 20px;
    --font-xl: 24px;
    --font-2xl: 28px;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ============================================
   Background Animation
   ============================================ */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 70%);
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-pulse 8s ease-in-out infinite;
}

@keyframes grid-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Floating orbs */
.bg-animation::before,
.bg-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float-orb 20s ease-in-out infinite;
}

.bg-animation::before {
    width: 400px;
    height: 400px;
    background: var(--accent-green);
    top: -200px;
    left: -100px;
}

.bg-animation::after {
    width: 300px;
    height: 300px;
    background: var(--accent-purple);
    bottom: -150px;
    right: -100px;
    animation-delay: -10s;
    animation-direction: reverse;
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, 20px) scale(1.05); }
    50% { transform: translate(0, 40px) scale(1); }
    75% { transform: translate(-30px, 20px) scale(0.95); }
}

/* Scan lines via grid pseudo-element */
.bg-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.02) 2px,
        rgba(0, 0, 0, 0.02) 4px
    );
    pointer-events: none;
}

/* ============================================
   Header
   ============================================ */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: relative;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-green-dim);
    border-radius: 8px;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-green);
}

.logo-text h1 {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.logo-text .title-accent {
    color: var(--accent-green);
}

.logo-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.logo-subtitle svg {
    stroke: var(--accent-purple);
}

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

/* Scenario Select */
.scenario-select-wrapper {
    position: relative;
}

.scenario-select {
    appearance: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 36px 10px 14px;
    border-radius: 8px;
    font-size: var(--font-sm);
    font-family: inherit;
    cursor: pointer;
    min-width: 200px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.scenario-select:hover {
    border-color: var(--text-muted);
}

.scenario-select:focus {
    outline: none;
    border-color: var(--accent-purple);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: var(--font-sm);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--gradient-green);
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

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

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary:disabled:hover {
    transform: none;
    filter: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    position: relative;
}

.connection-status.connected {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.connection-status.connected .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: status-pulse 2s ease-in-out infinite;
}

.connection-status.connected .status-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent-green);
    opacity: 0;
    animation: status-ring 2s ease-out infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes status-ring {
    0% { transform: scale(0.5); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

.connection-status.connected .status-label {
    color: var(--accent-green);
}

/* ============================================
   Main Layout - 3 Panel
   ============================================ */
.main {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--panel-gap);
    padding: var(--panel-gap);
    height: calc(100vh - var(--header-height) - var(--panel-gap) * 2);
    overflow: hidden;
}

/* Panel Base */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.4s ease, border-color 0.4s ease, transform 0.3s ease;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    z-index: 1;
}

.panel::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
}

/* Panel glow states */
.conversation-panel.active {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow:
        0 0 40px rgba(16, 185, 129, 0.15),
        0 0 80px rgba(16, 185, 129, 0.05),
        inset 0 0 40px rgba(16, 185, 129, 0.03);
    transform: translateY(-2px);
}

.workflow-panel.active {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow:
        0 0 40px rgba(139, 92, 246, 0.15),
        0 0 80px rgba(139, 92, 246, 0.05),
        inset 0 0 40px rgba(139, 92, 246, 0.03);
    transform: translateY(-2px);
}

.result-panel.active {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow:
        0 0 40px rgba(59, 130, 246, 0.15),
        0 0 80px rgba(59, 130, 246, 0.05),
        inset 0 0 40px rgba(59, 130, 246, 0.03);
    transform: translateY(-2px);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-title svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
}

.panel-title.purple svg {
    stroke: var(--accent-purple);
}

.panel-title.green svg {
    stroke: var(--accent-green);
}

/* ============================================
   Conversation Panel (Left)
   ============================================ */
.conversation-panel {
    display: flex;
    flex-direction: column;
}

.call-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 6px 14px;
    border-radius: 14px;
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.idle {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.status-badge.ringing {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
    animation: pulse-badge 1s infinite;
}

.status-badge.connected {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.status-badge.ended {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Incoming Call Banner */
.incoming-call {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-bottom: 1px solid var(--accent-green-dim);
    animation: incoming-pulse 1.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.incoming-call::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.1), transparent);
    animation: incoming-sweep 2s ease-in-out infinite;
}

@keyframes incoming-sweep {
    0% { left: -50%; }
    100% { left: 100%; }
}

.incoming-call.visible {
    display: flex;
}

@keyframes incoming-pulse {
    0%, 100% {
        background-color: rgba(16, 185, 129, 0.1);
        box-shadow: inset 0 0 30px rgba(16, 185, 129, 0);
    }
    50% {
        background-color: rgba(16, 185, 129, 0.18);
        box-shadow: inset 0 0 30px rgba(16, 185, 129, 0.1);
    }
}

.incoming-call-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-green);
    border-radius: 50%;
    animation: ring 1s infinite;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    position: relative;
}

.incoming-call-icon::before,
.incoming-call-icon::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid var(--accent-green);
    opacity: 0;
    animation: ring-wave 1.5s ease-out infinite;
}

.incoming-call-icon::after {
    animation-delay: 0.5s;
}

@keyframes ring-wave {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.incoming-call-icon svg {
    width: 26px;
    height: 26px;
    stroke: white;
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-10deg); }
    20%, 40% { transform: rotate(10deg); }
    50% { transform: rotate(0deg); }
}

.incoming-call-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.incoming-label {
    font-size: var(--font-xs);
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.incoming-number {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

/* Conversation Messages */
.conversation-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.conversation-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--border-color);
}

.conversation-empty p {
    font-size: 13px;
    max-width: 200px;
}

/* Message Bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: message-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
        filter: blur(4px);
    }
    40% {
        opacity: 1;
        filter: blur(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.message.ai {
    align-self: flex-start;
}

.message.caller {
    align-self: flex-end;
}

.message-speaker {
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message.ai .message-speaker {
    color: var(--accent-purple);
}

.message.caller .message-speaker {
    color: var(--text-muted);
    justify-content: flex-end;
}

.message-bubble {
    padding: 16px 20px;
    border-radius: 16px;
    font-size: var(--font-base);
    line-height: 1.6;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message.ai .message-bubble {
    background: linear-gradient(135deg, var(--accent-purple-dim) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

.message.caller .message-bubble {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(48, 54, 61, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--accent-purple-dim) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
    animation: typing-pulse 2s ease-in-out infinite;
}

@keyframes typing-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1); }
    50% { box-shadow: 0 4px 30px rgba(139, 92, 246, 0.2); }
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-purple);
    border-radius: 50%;
    animation: typing 1.2s ease-in-out infinite;
    box-shadow: 0 0 8px var(--accent-purple);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
        box-shadow: 0 0 4px var(--accent-purple);
    }
    30% {
        transform: translateY(-8px) scale(1.2);
        opacity: 1;
        box-shadow: 0 0 12px var(--accent-purple);
    }
}

/* Call Footer */
.call-footer {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.call-footer.visible {
    display: flex;
}

.call-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-lg);
    color: var(--text-secondary);
}

.call-timer svg {
    stroke: var(--accent-green);
}

/* ============================================
   Workflow Panel (Center)
   ============================================ */
.workflow-steps {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

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

.workflow-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--border-color);
}

.workflow-empty p {
    font-size: 13px;
    max-width: 220px;
}

/* Workflow Step */
.workflow-step {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    position: relative;
    animation: step-slide-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes step-slide-in {
    0% {
        opacity: 0;
        transform: translateX(-30px) scale(0.9);
        filter: blur(4px);
    }
    40% {
        opacity: 1;
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

.workflow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 36px;
    bottom: -12px;
    width: 2px;
    background: var(--border-color);
}

.workflow-step.complete:not(:last-child)::after {
    background: var(--accent-green);
}

.workflow-step.active:not(:last-child)::after {
    background: linear-gradient(to bottom, var(--accent-purple), var(--border-color));
}

.step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.workflow-step.complete .step-icon {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    animation: step-complete 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.workflow-step.active .step-icon {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
    animation: step-pulse 1.5s ease-in-out infinite;
}

@keyframes step-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5),
                    0 0 20px rgba(139, 92, 246, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(139, 92, 246, 0),
                    0 0 30px rgba(139, 92, 246, 0.5);
        transform: scale(1.1);
    }
}

@keyframes step-complete {
    0% { transform: scale(1) rotate(0deg); }
    30% { transform: scale(1.3) rotate(-10deg); }
    60% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.workflow-step.failed .step-icon {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-label {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.workflow-step.pending .step-label {
    color: var(--text-muted);
}

.step-detail {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.workflow-step.pending .step-detail {
    color: var(--text-muted);
}

/* Processing state for step details */
.step-detail.processing {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--accent-purple);
}

.processing-text {
    opacity: 0.8;
}

.processing-dots {
    display: inline-flex;
}

.processing-dots span {
    animation: dot-pulse 1.4s ease-in-out infinite;
    opacity: 0.3;
}

.processing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.processing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.processing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Step spinner animation */
.step-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: 100%;
}

.step-spinner span {
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: spinner-bounce 1s ease-in-out infinite;
}

.step-spinner span:nth-child(1) {
    animation-delay: 0s;
}

.step-spinner span:nth-child(2) {
    animation-delay: 0.15s;
}

.step-spinner span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes spinner-bounce {
    0%, 60%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Detail reveal animation */
.detail-reveal {
    display: inline-block;
    animation: detail-reveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes detail-reveal {
    0% {
        opacity: 0;
        transform: translateX(-10px);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

/* Intent cycling animation */
.intent-cycle {
    display: inline-block;
}

.intent-candidate {
    display: inline-block;
    animation: intent-cycle-in 0.2s ease-out;
    color: var(--text-secondary);
}

@keyframes intent-cycle-in {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Intent matched animation */
.workflow-step.matched .step-icon {
    animation: intent-matched-icon 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes intent-matched-icon {
    0% { transform: scale(1); }
    30% { transform: scale(1.5); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.intent-matched {
    display: inline-block;
    animation: intent-matched-text 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--accent-green);
    font-weight: 500;
}

@keyframes intent-matched-text {
    0% {
        opacity: 0;
        transform: scale(0.8) translateX(-10px);
        filter: blur(4px);
    }
    50% {
        transform: scale(1.1) translateX(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
        filter: blur(0);
    }
}

/* ============================================
   Result Panel (Right)
   ============================================ */
.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Analyzing Placeholder */
.analyzing-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 16px;
    animation: analyzing-fade 1.5s ease-in-out infinite;
}

@keyframes analyzing-fade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.analyzing-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-purple-dim);
    border-radius: 50%;
    animation: analyzing-spin 3s linear infinite;
}

@keyframes analyzing-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.analyzing-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--accent-purple);
}

.analyzing-text {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.analyzing-subtext {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

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

.result-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--border-color);
}

.result-empty p {
    font-size: 13px;
    max-width: 200px;
}

/* Appointment Card */
.appointment-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(28, 33, 40, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: card-appear 0.5s ease-out;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.appointment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.appointment-type {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.appointment-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.appointment-badge.new-patient {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.appointment-badge.existing {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.appointment-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.appointment-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.appointment-field.highlight {
    background: var(--accent-green-dim);
    padding: 12px;
    margin: -4px -4px;
    border-radius: 8px;
}

.field-label {
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.field-value {
    font-size: var(--font-base);
    color: var(--text-primary);
}

.field-value.pending {
    color: var(--text-muted);
}

.field-value.datetime {
    font-weight: 600;
    color: var(--accent-green);
}

.appointment-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Confirmation Footer */
.appointment-footer {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    color: white;
    font-size: var(--font-base);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.appointment-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

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

.appointment-footer.visible {
    display: flex;
    animation: confirm-in 0.6s ease-out;
    box-shadow: 0 -4px 30px rgba(16, 185, 129, 0.4);
}

@keyframes confirm-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    50% {
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.appointment-footer svg {
    width: 20px;
    height: 20px;
    animation: checkmark-pop 0.4s ease-out 0.3s both;
}

@keyframes checkmark-pop {
    from {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Result Cards for Non-Booking Outcomes */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.result-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.result-card-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.result-card-icon.emergency {
    background: var(--accent-red-dim);
}

.result-card-icon.emergency svg {
    stroke: var(--accent-red);
}

.result-card-icon.info {
    background: var(--accent-blue-dim);
}

.result-card-icon.info svg {
    stroke: var(--accent-blue);
}

.result-card-icon.callback {
    background: var(--accent-yellow-dim);
}

.result-card-icon.callback svg {
    stroke: var(--accent-yellow);
}

.result-card-icon.refill {
    background: var(--accent-purple-dim);
}

.result-card-icon.refill svg {
    stroke: var(--accent-purple);
}

.result-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.result-message.emergency {
    color: var(--accent-red);
    font-weight: 500;
}

/* ============================================
   Share Actions
   ============================================ */
.share-actions {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    animation: share-appear 0.4s ease-out;
}

@keyframes share-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.share-label {
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.share-buttons {
    display: flex;
    gap: 8px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.share-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.share-btn:hover svg {
    stroke: var(--accent-purple);
}

.share-btn:active {
    transform: scale(0.97);
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast svg {
    width: 20px;
    height: 20px;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.toast.success svg {
    stroke: var(--accent-green);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(239, 68, 68, 0.1) 100%);
}

.toast.error svg {
    stroke: var(--accent-red);
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .main {
        grid-template-columns: 1fr 1fr;
    }

    .result-panel {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
        flex-wrap: wrap;
        height: auto;
        gap: 12px;
        padding: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .main {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }

    .panel {
        min-height: 300px;
    }

    .result-panel {
        grid-column: span 1;
    }
}

/* ============================================
   Hidden Panel State
   ============================================ */
.panel.hidden {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel:not(.hidden) {
    animation: panel-reveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panel-reveal {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* ============================================
   Larger Workflow Items
   ============================================ */
.workflow-step {
    padding: 18px 0;
}

.step-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

.step-label {
    font-size: var(--font-base);
    font-weight: 600;
    margin-bottom: 6px;
}

.step-detail {
    font-size: var(--font-sm);
}

.workflow-step:not(:last-child)::after {
    left: 17px;
    top: 52px;
}

/* ============================================
   Pause Button
   ============================================ */
.btn-pause {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.btn-pause:hover {
    color: var(--text-primary);
    border-color: var(--accent-yellow);
    background: var(--accent-yellow-dim);
}

.btn-pause.paused {
    background: var(--accent-yellow-dim);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.btn-pause.paused:hover {
    background: var(--accent-yellow);
    color: var(--bg-primary);
}

/* ============================================
   Explainer Row
   ============================================ */
.explainer-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(22, 27, 34, 0.8) 100%);
    border-bottom: 1px solid var(--border-color);
    min-height: 70px;
    position: relative;
    overflow: hidden;
}

.explainer-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}

.explainer-row::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.05), transparent);
    animation: explainer-sweep 4s ease-in-out infinite;
}

@keyframes explainer-sweep {
    0% { left: -50%; }
    100% { left: 150%; }
}

.explainer-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-purple-dim);
    border-radius: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.explainer-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--accent-purple);
}

.explainer-content {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.explainer-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.explainer-description {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.explainer-row.visible .explainer-content {
    animation: explainer-content-in 0.4s ease-out;
}

@keyframes explainer-content-in {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Adjust main height for explainer row */
.main {
    height: calc(100vh - var(--header-height) - 70px - var(--panel-gap) * 2);
}
