/**
 * Random Video Chat Styles
 * 
 * Light theme matching dating app design
 * 
 * @package DatingCore
 */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --rc-bg: #f8f9fa;
    --rc-surface: #ffffff;
    --rc-surface-hover: #f1f3f5;
    --rc-border: #e9ecef;
    --rc-border-hover: #dee2e6;
    --rc-text: #212529;
    --rc-text-secondary: #495057;
    --rc-text-muted: #868e96;
    --rc-primary: #ff6b6b;
    --rc-primary-hover: #ff5252;
    --rc-primary-light: #fff0f0;
    --rc-secondary: #4dabf7;
    --rc-danger: #fa5252;
    --rc-danger-hover: #e03131;
    --rc-warning: #fab005;
    --rc-success: #40c057;
    --rc-radius: 12px;
    --rc-radius-lg: 16px;
    --rc-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --rc-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --rc-transition: 0.2s ease;
}

/* ==========================================================================
   Container
   ========================================================================== */

.rc-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
    background: var(--rc-bg);
    min-height: calc(100vh - 100px);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--rc-text);
}

/* ==========================================================================
   Header
   ========================================================================== */

.rc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--rc-surface);
    border-radius: var(--rc-radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--rc-shadow);
}

.rc-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rc-logo-icon {
    font-size: 28px;
}

.rc-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--rc-primary);
}

.rc-online-count {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--rc-text-secondary);
    background: var(--rc-surface-hover);
    padding: 8px 16px;
    border-radius: 20px;
}

.rc-online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rc-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.rc-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   Video Container
   ========================================================================== */

.rc-video-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.rc-video-box {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--rc-surface);
    border-radius: var(--rc-radius-lg);
    overflow: hidden;
    box-shadow: var(--rc-shadow);
    border: 2px solid var(--rc-border);
    transition: all var(--rc-transition);
}

.rc-video-box:hover {
    border-color: var(--rc-border-hover);
    box-shadow: var(--rc-shadow-lg);
}

.rc-video-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a1a2e;
}

/* Agora SDK 4.x video player container */
.rc-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
}

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

/* Ensure Agora's video element fills container */
#rc-local-video,
#rc-remote-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

#rc-local-video video,
#rc-remote-video video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.rc-video-label {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rc-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
}

.rc-video-label.partner {
    background: linear-gradient(135deg, var(--rc-primary), #ff8787);
    color: white;
}

.rc-video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(135deg, #f1f3f5 0%, #e9ecef 100%);
    color: var(--rc-text-muted);
}

.rc-video-placeholder svg,
.rc-video-placeholder .dashicons {
    width: 64px;
    height: 64px;
    font-size: 64px;
    opacity: 0.4;
    color: var(--rc-text-muted);
}

.rc-video-placeholder span {
    font-size: 15px;
    font-weight: 500;
}

.rc-video-placeholder.hidden {
    display: none;
}

/* Video Controls */
.rc-video-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--rc-transition);
}

.rc-video-box:hover .rc-video-controls {
    opacity: 1;
}

.rc-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--rc-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--rc-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rc-control-btn:hover {
    background: var(--rc-primary);
    color: white;
    transform: scale(1.1);
}

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

.rc-control-btn svg,
.rc-control-btn .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Connecting Overlay */
.rc-connecting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--rc-text);
    backdrop-filter: blur(8px);
}

.rc-connecting-overlay.visible {
    display: flex;
}

.rc-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--rc-border);
    border-top-color: var(--rc-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Status Bar
   ========================================================================== */

.rc-status-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
    background: var(--rc-surface);
    border-radius: var(--rc-radius);
    box-shadow: var(--rc-shadow);
}

.rc-status-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--rc-text-secondary);
}

.rc-status-bar.searching .rc-status-text {
    color: var(--rc-warning);
}

.rc-status-bar.connected .rc-status-text {
    color: var(--rc-success);
}

.rc-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: var(--rc-text-muted);
    background: var(--rc-surface-hover);
    padding: 6px 12px;
    border-radius: 20px;
}

.rc-timer svg,
.rc-timer .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.rc-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px;
}

.rc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 50px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--rc-transition);
    text-decoration: none !important;
}

.rc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rc-btn svg,
.rc-btn .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.rc-btn-start {
    background: linear-gradient(135deg, var(--rc-primary), #ff8787);
    color: white;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

.rc-btn-start:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--rc-primary-hover), var(--rc-primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.rc-btn-start.searching {
    background: linear-gradient(135deg, var(--rc-warning), #fcc419);
    box-shadow: 0 4px 16px rgba(250, 176, 5, 0.4);
}

.rc-btn-next {
    background: var(--rc-surface);
    color: var(--rc-text);
    border: 2px solid var(--rc-border);
    min-width: 140px;
}

.rc-btn-next:hover:not(:disabled) {
    background: var(--rc-surface-hover);
    border-color: var(--rc-primary);
    color: var(--rc-primary);
}

.rc-btn-stop {
    background: linear-gradient(135deg, var(--rc-danger), #ff6b6b);
    color: white;
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(250, 82, 82, 0.4);
}

.rc-btn-stop:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--rc-danger-hover), var(--rc-danger));
    transform: translateY(-2px);
}

.rc-btn-primary {
    background: linear-gradient(135deg, var(--rc-primary), #ff8787);
    color: white;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

.rc-btn-primary:hover {
    background: linear-gradient(135deg, var(--rc-primary-hover), var(--rc-primary));
    transform: translateY(-2px);
}

.rc-btn-secondary {
    background: var(--rc-surface);
    color: var(--rc-text);
    border: 2px solid var(--rc-border);
}

.rc-btn-secondary:hover {
    background: var(--rc-surface-hover);
    border-color: var(--rc-primary);
}

/* ==========================================================================
   Text Chat (Optional Feature)
   ========================================================================== */

.rc-text-chat {
    background: var(--rc-surface);
    border-radius: var(--rc-radius-lg);
    overflow: hidden;
    box-shadow: var(--rc-shadow);
}

.rc-chat-messages {
    height: 200px;
    overflow-y: auto;
    padding: 16px;
    background: var(--rc-bg);
}

.rc-chat-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: var(--rc-radius);
    max-width: 80%;
    font-size: 14px;
}

.rc-chat-message.sent {
    background: linear-gradient(135deg, var(--rc-primary), #ff8787);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.rc-chat-message.received {
    background: var(--rc-surface);
    color: var(--rc-text);
    box-shadow: var(--rc-shadow);
    border-bottom-left-radius: 4px;
}

.rc-chat-input {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--rc-border);
    background: var(--rc-surface);
}

.rc-chat-input input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 50px;
    border: 2px solid var(--rc-border);
    background: var(--rc-bg);
    color: var(--rc-text);
    font-size: 14px;
    transition: all var(--rc-transition);
}

.rc-chat-input input:focus {
    outline: none;
    border-color: var(--rc-primary);
    background: var(--rc-surface);
}

.rc-btn-send {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rc-primary), #ff8787);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--rc-transition);
}

.rc-btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.rc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    margin-top: 24px;
    background: var(--rc-surface);
    border-radius: var(--rc-radius);
    box-shadow: var(--rc-shadow);
    color: var(--rc-text-muted);
    font-size: 13px;
}

.rc-rules {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rc-rules svg,
.rc-rules .dashicons {
    color: var(--rc-warning);
}

.rc-links a {
    color: var(--rc-primary);
    text-decoration: none !important;
    font-weight: 500;
}

.rc-links a:hover {
    text-decoration: underline !important;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.rc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.rc-modal-content {
    background: var(--rc-surface);
    border-radius: var(--rc-radius-lg);
    padding: 48px;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--rc-shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.rc-modal-icon {
    font-size: 56px;
    margin-bottom: 20px;
}

.rc-modal-content h3 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--rc-text);
}

.rc-modal-content p {
    margin: 0 0 28px;
    color: var(--rc-text-muted);
    line-height: 1.6;
    font-size: 15px;
}

/* ==========================================================================
   Login Required
   ========================================================================== */

.rc-login-required {
    max-width: 520px;
    margin: 80px auto;
    padding: 60px 48px;
    background: var(--rc-surface);
    border-radius: var(--rc-radius-lg);
    text-align: center;
    box-shadow: var(--rc-shadow-lg);
}

.rc-login-icon {
    font-size: 72px;
    margin-bottom: 24px;
}

.rc-login-required h2 {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 700;
    color: var(--rc-text);
}

.rc-login-required p {
    margin: 0 0 36px;
    color: var(--rc-text-muted);
    font-size: 16px;
    line-height: 1.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .rc-container {
        padding: 16px;
    }

    .rc-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .rc-video-container {
        grid-template-columns: 1fr;
    }

    .rc-video-box {
        aspect-ratio: 16/9;
    }

    .rc-actions {
        flex-wrap: wrap;
        padding: 16px;
    }

    .rc-btn {
        flex: 1;
        min-width: 100px;
        padding: 12px 20px;
        font-size: 14px;
    }

    .rc-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .rc-modal-content {
        margin: 20px;
        padding: 32px 24px;
    }

    .rc-video-controls {
        opacity: 1;
    }

    .rc-login-required {
        margin: 40px 16px;
        padding: 40px 24px;
    }

}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.rc-video-box {
    animation: fadeIn 0.3s ease;
}

/* Searching animation */
.rc-status-bar.searching .rc-status-text::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Connected pulse animation */
.rc-status-bar.connected .rc-status-text::before {
    content: '●';
    margin-right: 8px;
    color: var(--rc-success);
    animation: connectedPulse 2s infinite;
}

@keyframes connectedPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
