/**
 * ESTILOS - VIDEO WEBRTC SYSTEM
 *
 * Diseño limpio estilo Zoom/Meet
 * Responsive y minimalista
 */

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

:root {
    --primary: #2d8cff;
    --primary-hover: #1a75e8;
    --danger: #ea4335;
    --danger-hover: #d33426;
    --success: #34a853;
    --text: #202124;
    --text-light: #5f6368;
    --bg: #ffffff;
    --bg-dark: #1a1a1a;
    --border: #dadce0;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg-dark);
    overflow: hidden;
}

/* ====================================
   LANDING PAGE
   ==================================== */

.landing-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.landing-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.landing-card h1 {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--text);
}

.landing-card p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.landing-footer {
    margin-top: 30px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

/* ====================================
   ROOM PAGE
   ==================================== */

.room-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}

/* Header */
.room-header {
    height: 60px;
    background: #202124;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #3c4043;
}

.room-title {
    color: white;
    font-size: 18px;
    font-weight: 500;
}

.room-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.info-badge {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
}

.btn-copy {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: var(--primary-hover);
}

/* Video Grid */
.video-grid {
    flex: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

.main-video-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.local-video-container {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 675px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
}

/* Remote Videos */
.remote-videos-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.remote-video-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

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

/* Controls */
.controls-bar {
    height: 80px;
    background: #202124;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 0 20px;
    border-top: 1px solid #3c4043;
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #3c4043;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.control-btn:hover {
    background: #5f6368;
    transform: scale(1.05);
}

.control-btn.disabled {
    background: var(--danger);
}

.control-btn.disabled:hover {
    background: var(--danger-hover);
}

.control-btn.active {
    background: var(--primary);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.btn-label {
    font-size: 11px;
    margin-top: 4px;
}

.btn-hangup {
    background: var(--danger);
}

.btn-hangup:hover {
    background: var(--danger-hover);
}

.btn-recording.recording {
    background: var(--danger);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Chat */
.chat-panel {
    position: fixed;
    right: 0;
    top: 60px;
    bottom: 80px;
    width: 350px;
    background: white;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
    z-index: 100;
}

.chat-panel.hidden {
    transform: translateX(100%);
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f1f3f4;
}

.chat-message.own {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.message-author {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-light);
}

.chat-message.own .message-author {
    color: rgba(255, 255, 255, 0.8);
}

.message-text {
    font-size: 14px;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary);
}

#sendMessage {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendMessage:hover {
    background: var(--primary-hover);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    font-size: 14px;
}

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

.notification.error {
    background: var(--danger);
}

.notification.success {
    background: var(--success);
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .video-grid {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }

    .remote-videos-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
    }

    .remote-video-container {
        min-width: 200px;
    }

    .room-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        height: auto;
        padding: 12px;
    }

    .room-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .room-title {
        font-size: 16px;
    }

    .controls-bar {
        flex-wrap: wrap;
        padding: 12px;
        gap: 10px;
        height: auto;
    }

    .control-btn {
        width: 48px;
        height: 48px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }

    .chat-panel {
        width: 100%;
        top: 0;
        bottom: 0;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .chat-panel.hidden {
        transform: translateY(100%);
    }

    .controls-bar {
        gap: 10px;
    }

    .control-btn {
        width: 44px;
        height: 44px;
    }

    .btn-label {
        display: none;
    }
}

@media (max-width: 540px) {
    body {
        overflow: auto;
    }

    .room-container {
        height: auto;
        min-height: 100vh;
    }

    .local-video-container {
        max-height: none;
        aspect-ratio: 16 / 9;
    }

    .remote-video-container {
        min-width: 160px;
    }

    .chat-messages {
        padding: 12px;
    }

    .chat-input-area {
        padding: 12px;
    }

    .notification {
        left: 50%;
        right: 12px;
        width: calc(100% - 24px);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
