* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #111827;
    color: #e5e7eb;
    overflow: hidden;
}

/* Status Message */
.status-message {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: rgba(34, 197, 94, 0.9);
    color: white;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.status-message.info {
    background: rgba(59, 130, 246, 0.9);
    color: white;
}

/* Pre-call Screen */
.pre-call-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.pre-call-screen.hidden {
    display: none;
}

.pre-call-container {
    width: 100%;
    max-width: 28rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.25rem;
    font-weight: bold;
    color: white;
    margin-bottom: 0.5rem;
}

.header p {
    color: #9ca3af;
}

.control-panel {
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(24px);
    border-radius: 1rem;
    border: 1px solid #374151;
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #d1d5db;
    margin-bottom: 0.5rem;
}

.peer-id-display {
    position: relative;
    background: rgba(59, 130, 246, 0.1);
    border: 2px solid #3b82f6;
    border-radius: 0.75rem;
    padding: 1rem;
    font-family: monospace;
    color: #60a5fa;
    text-align: center;
    word-break: break-all;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem;
    background: #374151;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #4b5563;
}

.copy-btn svg {
    width: 1rem;
    height: 1rem;
    color: #d1d5db;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(55, 65, 81, 0.5);
    border: 1px solid #4b5563;
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
}

input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
}

input[type="text"]::placeholder {
    color: #6b7280;
}

.btn-call {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-call:hover {
    transform: translateY(-1px);
}

.video-preview {
    margin-top: 1.5rem;
    position: relative;
    aspect-ratio: 16/9;
    background: #1f2937;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #374151;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
}

/* In-call Screen */
.in-call-screen {
    display: none;
    position: fixed;
    inset: 0;
    background: black;
}

.in-call-screen.active {
    display: block;
}

.remote-video-container {
    width: 100%;
    height: 100vh;
    position: relative;
}

.remote-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-label {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
}

/* Local Video PIP */
.local-video-pip {
    position: absolute;
    width: 12rem;
    height: 9rem;
    border-radius: 1rem;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
}

.local-video-pip:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.local-video-pip.top-right {
    top: 1.5rem;
    right: 1.5rem;
}

.local-video-pip.top-left {
    top: 1.5rem;
    left: 1.5rem;
}

.local-video-pip.bottom-right {
    bottom: 6rem;
    right: 1.5rem;
}

.local-video-pip.bottom-left {
    bottom: 6rem;
    left: 1.5rem;
}

.local-video-pip video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-off-overlay {
    position: absolute;
    inset: 0;
    background: #1f2937;
    display: none;
    align-items: center;
    justify-content: center;
}

.video-off-overlay.show {
    display: flex;
}

.video-off-overlay svg {
    width: 2rem;
    height: 2rem;
    color: #6b7280;
}

/* Control Bar */
.control-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.control-btn {
    padding: 1rem;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(55, 65, 81, 0.8);
}

.control-btn:hover {
    background: #4b5563;
}

.control-btn.active {
    background: rgba(239, 68, 68, 0.8);
}

.control-btn.active:hover {
    background: rgba(239, 68, 68, 0.9);
}

.control-btn svg {
    width: 1.5rem;
    height: 1.5rem;
    color: white;
    display: block;
}

.end-call-btn {
    padding: 1.25rem;
    background: #ef4444;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.end-call-btn:hover {
    background: #dc2626;
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.6);
}

.end-call-btn svg {
    width: 1.75rem;
    height: 1.75rem;
}

@media (max-width: 768px) {
    .local-video-pip {
        width: 7rem;
        height: 9rem;
    }

    .local-video-pip.top-right,
    .local-video-pip.top-left {
        top: 1rem;
    }

    .local-video-pip.bottom-right,
    .local-video-pip.bottom-left {
        bottom: 5rem;
    }

    .local-video-pip.top-right,
    .local-video-pip.bottom-right {
        right: 1rem;
    }

    .local-video-pip.top-left,
    .local-video-pip.bottom-left {
        left: 1rem;
    }
}