/* Base Variables */
:root {
    --bg-color: #0f172a; /* Slate 900 */
    --panel-bg: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #3b82f6; /* Blue 500 */
    --primary-hover: #2563eb;
    --success-color: #10b981; /* Emerald 500 */
    --success-hover: #059669;
    --danger-color: #ef4444; /* Red 500 */
    --danger-hover: #dc2626;
    --warn-color: #f59e0b;
    --surface-color: #1e293b;
    
    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
}

.app-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Video Area */
.video-area {
    flex: 1;
    position: relative;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
    transition: var(--transition);
}

.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #0f172a;
    z-index: 1;
    color: var(--text-secondary);
}

.video-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.badge {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Remote Video (Main) */
.remote-video-wrapper {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Local Video (PiP) */
.local-video-wrapper {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 180px;
    height: 240px;
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.local-video-wrapper:hover {
    transform: scale(1.05);
}

.local-video-wrapper video {
    transform: scaleX(-1); /* Mirror effect */
}

/* Controls Area */
.controls-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 2rem;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Glassmorphism Panel */
.connection-panel, .action-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.connection-panel {
    flex-wrap: wrap;
    justify-content: center;
}

.id-section, .call-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

input {
    background: var(--surface-color);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Inter', monospace;
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
    width: 220px;
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-btn {
    background: var(--surface-color);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
}

.icon-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

.action-panel {
    border-radius: 100px; /* Pill shape */
    padding: 0.75rem 1.5rem;
}

.media-controls {
    display: flex;
    gap: 1rem;
    border-right: 1px solid var(--panel-border);
    padding-right: 1.5rem;
}

.circle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    font-size: 1.5rem;
}

.circle-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.circle-btn[data-state="off"] {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.3);
}

.danger-btn, .success-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    color: white;
    font-size: 0.875rem;
}

.danger-btn { background: var(--danger-color); }
.danger-btn:hover:not(:disabled) { background: var(--danger-hover); }

.success-btn { background: var(--success-color); }
.success-btn:hover:not(:disabled) { background: var(--success-hover); }

.status-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 20px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface-color);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: var(--transition);
    max-width: 400px;
    width: 90%;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-icon {
    width: 80px;
    height: 80px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.modal-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .local-video-wrapper {
        width: 120px;
        height: 160px;
        bottom: 120px; /* Above controls */
        right: 1rem;
    }
    
    .controls-area {
        padding: 1rem;
    }
    
    .connection-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    input {
        width: 100%;
    }
}
