/* Main CSS for Voice Agent Kiosk SPA */

/* Camera Feed Display Styles */
.camera-feed {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 90px;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.1);
}

.camera-feed-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

/* Camera Feed Visual States */
.camera-feed.disabled {
    display: none; /* Hide camera feed when disabled */
}

.camera-feed.face-detected {
    border-color: #ffde1c;
    box-shadow: 0 0 15px rgba(255, 222, 28, 0.4);
}

.camera-feed.mouth-moving {
    border-color: #91cf00;
    box-shadow: 0 0 15px rgba(145, 207, 0, 0.4);
}

.camera-feed.error {
    border-color: #ff9400;
    box-shadow: 0 0 15px rgba(255, 148, 0, 0.4);
    position: relative;
}

.camera-feed.error::after {
    content: "⚠️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #ff9400;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Responsive Design */
/* Mobile (< 768px) */
@media (max-width: 767px) {
    .camera-feed {
        width: 60px;
        height: 45px;
        top: 15px;
        right: 15px;
        border: 2px solid transparent;
    }
}

/* Tablet (768px - 1920px) */
@media (min-width: 768px) and (max-width: 1919px) {
    .camera-feed {
        width: 120px;
        height: 90px;
        top: 20px;
        right: 20px;
        border: 3px solid transparent;
    }
}

/* Desktop/Kiosk (> 1920px) */
@media (min-width: 1920px) {
    .camera-feed {
        width: 160px;
        height: 120px;
        top: 30px;
        right: 30px;
        border: 3px solid transparent;
    }
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #E6F3FF; /* GS Battery light blue background */
    min-height: 100vh;
    color: #333;
    overflow: hidden;
}

/* App Container */
.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Voice Interface */
.voice-interface {
    flex: 1;
    display: flex !important;
    flex-direction: row !important;
    height: 100vh;
    position: relative;
}

/* Debug Panel - Hidden from end users (Admin Only) */
.debug-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 100vh;
    background: #1a1a1a;
    color: white;
    padding: 20px;
    z-index: 2000;
    overflow-y: auto;
    display: none; /* Hidden by default */
}

.debug-panel.visible {
    display: block;
}

/* Admin Controls */
.admin-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-btn {
    background: #005bb0;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-btn:hover {
    background: #003d7a;
    transform: translateY(-1px);
}

/* Kiosk Mode - Vertical Layout */
@media (orientation: portrait) and (min-height: 800px) {
    /* Hide scrollbars for kiosk mode */
    body {
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent text selection in kiosk mode */
    * {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Allow text selection for specific elements */
    .status-value, .state-indicator {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    .voice-interface {
        flex-direction: column;
        justify-content: space-between;
        padding: 10px;
    }
    
    .avatar-container {
        width: 1000px;
        height: 100%;
        max-width: 100%;
        max-height: 100vh;
        margin: 10px 0;
        border-radius: 15px;
    }
    
    .voice-controls {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
        margin: 10px 0;
    }
    
    .mic-button {
        width: 120px;
        height: 120px;
        border-radius: 60px;
        font-size: 16px;
        padding: 20px;
    }
    
    .status-panel {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        padding: 10px;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 10px;
        margin: 10px 0;
    }
    
    .status-item {
        text-align: center;
        flex: 1;
    }
}

/* Avatar Container */
.avatar-container {
    position: relative;
    width: 700px;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    background: #000;
    box-shadow: none;
    max-width: 100%;
    max-height: 100vh;
}

/* Seamless Video Elements */
.seamless-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain for portrait videos */
    border-radius: 0; /* Remove border radius for full-size display */
    pointer-events: none;
    /* NO TRANSITION - Instant opacity changes for seamless switching */
    max-width: 100%;
    max-height: 100%;
}

.avatar-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    pointer-events: none;
}

.state-indicator {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    text-align: center;
    align-self: flex-start;
}

.connection-status {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
    align-self: flex-end;
}

/* Voice Controls */
.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

/* Medium Screen Layout - Tablets */
@media (min-width: 768px) and (max-width: 1023px) {
    .voice-interface {
        flex-direction: column;
        justify-content: center;
        padding: 30px;
    }
    
    .avatar-container {
        width: 600px;
        height: 100%;
        margin-bottom: 40px;
        max-width: 100%;
        max-height: 100vh;
    }
    
    .voice-controls {
        flex-direction: row;
        justify-content: center;
        gap: 30px;
        margin-bottom: 30px;
    }
    
    .mic-button {
        width: 100px;
        height: 100px;
        border-radius: 50px;
        font-size: 14px;
    }
}

/* Horizontal Layout - Traditional Screens */
@media (orientation: landscape) and (min-width: 1024px) {
    .voice-interface {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 40px;
        gap: 60px;
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .avatar-container {
        width: 900px;
        height: 100%;
        margin: 0;
        flex-shrink: 0;
        max-width: 100%;
        max-height: 100vh;
    }
    
    .voice-controls {
        flex-direction: column;
        align-items: flex-start;
        margin: 0;
        min-width: 350px;
        gap: 30px;
    }
    
    .mic-button {
        width: 200px;
        height: 60px;
        border-radius: 30px;
        font-size: 16px;
        padding: 15px 30px;
    }
    
    .status-panel {
        margin-top: 40px;
        width: 100%;
        background: rgba(255, 255, 255, 0.1);
        padding: 20px;
        border-radius: 15px;
        backdrop-filter: blur(10px);
    }
    
    .status-panel .status-item {
        margin-bottom: 15px;
    }
    
    .status-panel .status-item:last-child {
        margin-bottom: 0;
    }
}

/* Microphone Status Indicator - Animated & Dynamic */
.mic-status {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.mic-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.mic-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #666;
    transition: all 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

.mic-indicator.ready {
    background: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    animation: pulse 1s infinite;
}

.mic-indicator.busy {
    background: #ff4757;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.5);
    animation: breathe 2s infinite;
}

.mic-indicator.inactive {
    background: #666;
    box-shadow: 0 0 10px rgba(102, 102, 102, 0.3);
}

/* Legacy styles for backward compatibility */
.mic-indicator.active {
    background: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    animation: pulse 1s infinite;
}

.mic-text {
    font-size: 18px;
    font-weight: 500;
    flex-shrink: 0;
}

.vad-confidence {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.confidence-bar {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    min-width: 100px;
}

.confidence-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00cc6a, #00ff88);
    background-size: 200% 100%;
    width: var(--confidence-width, 0%);
    transition: width 0.1s ease;
    animation: shimmer 1.5s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Threshold-based styling - DEPRECATED */
.confidence-bar.above-threshold::before {
    background: linear-gradient(90deg, #00ff88, #00cc6a, #00ff88);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.confidence-bar.below-threshold::before {
    background: linear-gradient(90deg, #ff4757, #ff3742, #ff4757);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

/* NEW: State-based styling */
.confidence-bar.listening-state::before {
    background: linear-gradient(90deg, #00ff88, #00cc6a, #00ff88);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.confidence-bar.idle-state::before,
.confidence-bar.thinking-state::before,
.confidence-bar.speaking-state::before {
    background: linear-gradient(90deg, #9E9E9E, #757575, #9E9E9E);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(158, 158, 158, 0.3);
}

.confidence-text {
    font-size: 0.9rem;
    color: #00ff88;
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

/* Legacy mic button (hidden in new layout) */
.mic-button {
    display: none;
}

.mic-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.mic-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mic-button.listening {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    animation: pulse 1.5s infinite;
}

.mic-button.speaking {
    background: linear-gradient(45deg, #2ed573, #1e90ff);
}

/* Activity Log */
.activity-log {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    width: 100%;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: #888;
    margin-right: 8px;
}

.log-message {
    color: #fff;
}

.log-message.state {
    color: #4CAF50;
    font-weight: bold;
}

.log-message.error {
    color: #f44336;
}

.log-message.warning {
    color: #ff9800;
}

.log-message.info {
    color: #2196F3;
}

/* Quit Button */
.quit-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.quit-button:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

/* Audio Visualizer (hidden in new layout) */
.audio-visualizer {
    display: none;
}

/* Horizontal layout audio visualizer adjustments */
@media (orientation: landscape) and (min-width: 1024px) {
    .audio-visualizer {
        width: 300px;
        height: 80px;
        margin-top: 20px;
    }
}

/* Status Panel */
.status-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.status-item:last-child {
    border-bottom: none;
}

/* Horizontal layout status panel adjustments */
@media (orientation: landscape) and (min-width: 1024px) {
    .status-panel {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .status-item {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    
    .status-label {
        min-width: 80px;
        text-align: left;
    }
    
    .status-value {
        text-align: left;
    }
}

.status-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.status-value {
    font-size: 16px;
    font-weight: bold;
    color: white;
    text-align: right;
    flex-shrink: 0;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.loading-content p {
    font-size: 16px;
    opacity: 0.8;
}

/* Error Screen */
.error-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.error-content {
    text-align: center;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.error-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.error-content p {
    font-size: 16px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.retry-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.8);
    }
}

@keyframes breathe {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 15px rgba(255, 71, 87, 0.5);
    }
    50% { 
        transform: scale(0.95);
        box-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Small Screen Layout - Mobile */
@media (max-width: 767px) {
    .voice-interface {
        padding: 15px;
    }
    
    .avatar-container {
        width: 500px;
        height: 100%;
        max-width: 100%;
        max-height: 100vh;
        margin-bottom: 20px;
    }
    
    .voice-controls {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .mic-button {
        width: 80px;
        height: 80px;
        border-radius: 40px;
        font-size: 12px;
    }
    
    .status-panel {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
}

/* Extra Small Screen Layout */
@media (max-width: 480px) {
    .avatar-container {
        width: 400px;
        height: 100%;
        max-width: 100%;
        max-height: 100vh;
    }
    
    .voice-interface {
        padding: 10px;
    }
    
    .mic-button {
        width: 70px;
        height: 70px;
        border-radius: 35px;
        font-size: 11px;
    }
} 