/* Core Variables */
:root {
    --bg-primary: #0a0b10;
    --bg-secondary: #12131a;
    --accent-blue: #00d2ff;
    --accent-purple: #9d4edd;
    --accent-green: #00f5d4;
    --accent-red: #ff3366;
    --text-primary: #ffffff;
    --text-secondary: #8e92a2;
    --glass-bg: rgba(18, 19, 26, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 8px 32px 0 rgba(0, 210, 255, 0.15);
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 210, 255, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(157, 78, 221, 0.06) 0%, transparent 40%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Header Styling */
.app-header {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0 24px;
    margin-bottom: 20px;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.logo-icon {
    color: var(--accent-blue);
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.5));
    animation: rotateLogo 8s linear infinite;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-text .highlight {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Panel */
.status-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.status-dot.disconnected {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.status-dot.connecting {
    background-color: #ffd166;
    box-shadow: 0 0 8px #ffd166;
    animation: pulseGlow 1.5s infinite;
}

.status-dot.success {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Call Workspace Grid */
.call-workspace {
    flex: 1;
    display: flex;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    gap: 20px;
}

/* Video Wrapper */
.video-wrapper {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: var(--shadow-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 19px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.video-wrapper video.active {
    opacity: 1;
}

/* Remote Video Wrapper (Takes full space) */
.remote-wrapper {
    flex: 1;
    height: 100%;
}

/* Floating Local Video Wrapper (PiP) */
.local-wrapper {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 260px;
    height: 160px;
    z-index: 5;
    background: rgba(18, 19, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fadeInLocal 0.8s ease;
}

/* Video Labels */
.video-label {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(10, 11, 16, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    z-index: 3;
}

/* Video Placeholders */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: radial-gradient(circle at center, #1b1d2a, #0c0d15);
    z-index: 2;
    transition: opacity 0.5s ease;
}

.video-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.3));
}

.local-wrapper .placeholder-icon {
    width: 48px;
    height: 48px;
}

.placeholder-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Controls Dashboard Footer */
.call-controls {
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.controls-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 12px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Buttons */
.control-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-primary);
}

/* Connect / Call Button */
.call-action-btn.connect-btn {
    background: linear-gradient(135deg, var(--accent-green) 0%, #00bbf9 100%);
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.4);
}

.call-action-btn.connect-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(0, 245, 212, 0.6);
}

.call-action-btn.disconnect-btn {
    background: linear-gradient(135deg, var(--accent-red) 0%, #d81159 100%);
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.4);
    transform: rotate(135deg);
}

.call-action-btn.disconnect-btn:hover {
    transform: scale(1.1) rotate(135deg);
    box-shadow: 0 0 25px rgba(255, 51, 102, 0.6);
}

/* Mute / Secondary Buttons */
.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.secondary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.secondary-btn.muted {
    background: var(--accent-red);
    border-color: var(--accent-red);
    box-shadow: 0 0 12px rgba(255, 51, 102, 0.4);
}

.secondary-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

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

/* Loading Wave */
.loading-wave {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}

.loading-wave span {
    width: 4px;
    height: 10px;
    background-color: var(--accent-blue);
    border-radius: 4px;
    animation: wave 1.2s ease-in-out infinite;
}

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

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

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(2.5); }
}

/* Responsive UI Adjustments */
@media(max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .app-header {
        height: 60px;
        padding: 0 16px;
        margin-bottom: 12px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .local-wrapper {
        width: 140px;
        height: 90px;
        bottom: 12px;
        right: 12px;
        border-radius: 12px;
    }
    
    .local-wrapper video {
        border-radius: 11px;
    }
    
    .video-label {
        bottom: 8px;
        left: 8px;
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .controls-panel {
        padding: 10px 20px;
        gap: 15px;
    }
    
    .control-btn {
        width: 46px;
        height: 46px;
    }
}
