/* =============================================================================
   Deep Live Cam - Web UI Styles
   Modern Dark Theme
============================================================================= */

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --border: #2a2a3a;
    
    --text-primary: #ffffff;
    --text-secondary: #8888aa;
    --text-muted: #555566;
    
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-yellow: #eab308;
    --accent-purple: #a855f7;
    
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* =============================================================================
   App Container
============================================================================= */
.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =============================================================================
   Header
============================================================================= */
.header {
    text-align: center;
    padding: 10px 0 20px;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* =============================================================================
   Video Section - Side by Side
============================================================================= */
.video-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .video-section {
        grid-template-columns: 1fr;
    }
}

.video-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.video-label {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-container {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.video-overlay.hidden {
    display: none;
}

.fps-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent-green);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* =============================================================================
   Controls Section
============================================================================= */
.controls-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .controls-section {
        grid-template-columns: 1fr;
    }
}

.control-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border);
}

.panel-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* =============================================================================
   Upload Area
============================================================================= */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.upload-area.drag-over {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

.upload-placeholder {
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 2rem;
}

.source-preview {
    max-width: 100%;
    max-height: 120px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* =============================================================================
   Buttons
============================================================================= */
.button-row {
    display: flex;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-success {
    background: var(--accent-green);
    color: white;
    flex: 1;
}

.btn-success:hover:not(:disabled) {
    background: #16a34a;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* =============================================================================
   Form Elements
============================================================================= */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-select {
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* =============================================================================
   Settings Grid
============================================================================= */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: var(--bg-hover);
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
}

.checkbox-item span {
    font-size: 0.85rem;
}

/* =============================================================================
   Status Box
============================================================================= */
.status-box {
    padding: 10px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.status-box.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.status-box.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* =============================================================================
   Status Bar
============================================================================= */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.status-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
}

.dot.connected {
    background: var(--accent-green);
}

.dot.connecting {
    background: var(--accent-yellow);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-item {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.status-right {
    display: flex;
    gap: 10px;
}

/* =============================================================================
   Modal
============================================================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow: auto;
}

.modal-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* =============================================================================
   Footer
============================================================================= */
.footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =============================================================================
   Scrollbar
============================================================================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
