:root {
    --bg-color: #080b11;
    --card-bg: #0c101b;
    --border-color: rgba(255, 255, 255, 0.05);
    
    --matrix-green: #38bdf8; /* Elegant sky blue/cyan from the image */
    --matrix-green-glow: rgba(56, 189, 248, 0.25);
    
    --cyan-glow: rgba(0, 229, 255, 0.35);
    --cyan-color: #00e5ff;
    
    --text-primary: #f3f4f6;
    --text-secondary: #94a3b8; /* Slate gray secondary text */
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.35);
    
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    height: 100vh;
}

/* Star background overlay - disabled for clean dashboard look */
#stars-container {
    display: none;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* Glassmorphism styling helper */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Main Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    height: 70px;
    flex-shrink: 0;
    border-color: rgba(0, 255, 102, 0.15);
}

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

.matrix-glow-icon {
    font-size: 24px;
    color: var(--matrix-green);
    text-shadow: 0 0 10px var(--matrix-green-glow);
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.logo-text .highlight {
    color: var(--matrix-green);
    text-shadow: 0 0 10px var(--matrix-green-glow);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.disconnected {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.status-dot.connected {
    background-color: var(--matrix-green);
    box-shadow: 0 0 8px var(--matrix-green);
}

/* Main Grid Layout */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
    flex-grow: 1;
    min-height: 0; /* Important for scroll sizing in flexboxes */
}

/* Left Panel */
.control-panel {
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    overflow-y: auto;
    border-color: rgba(255, 255, 255, 0.05);
}

.card-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-section h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-section h3 i {
    font-size: 16px;
    color: var(--matrix-green);
}

.control-panel .card-section:last-of-type h3 i {
    color: var(--cyan-color);
}

.section-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.panel-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0) 100%);
    margin: 10px 0;
}

/* Tu Código de Acceso display */
.id-display-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.id-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

.id-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 10px 16px;
}

#my-id-text {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--matrix-green);
    text-shadow: 0 0 8px rgba(0, 255, 102, 0.2);
}

/* Input Styles */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.input-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-size: 14px;
}

.input-with-icon input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 12px 12px 42px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 0.05em;
    outline: none;
    transition: all 0.3s ease;
}

.input-with-icon input:focus {
    border-color: var(--cyan-color);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

/* Button UI */
.btn-primary {
    width: 100%;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-glow-green {
    background-color: var(--matrix-green);
}

.btn-glow-green:hover {
    box-shadow: 0 0 16px var(--matrix-green);
    transform: translateY(-1px);
}

.btn-glow-cyan {
    background-color: var(--cyan-color);
}

.btn-glow-cyan:hover {
    box-shadow: 0 0 16px var(--cyan-color);
    transform: translateY(-1px);
}

.btn-danger {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--danger);
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: var(--danger);
    color: #000;
    box-shadow: 0 0 16px var(--danger-glow);
    transform: translateY(-1px);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

/* Connection Details Card */
.connection-details-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 14px;
    margin-top: auto;
}

.connection-details-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    row-gap: 6px;
    column-gap: 16px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.details-grid strong, .details-grid span {
    text-align: right;
}

.details-grid strong {
    color: var(--matrix-green);
}

.text-green {
    color: var(--matrix-green) !important;
}

/* Right Viewport Panel */
.viewer-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border-color: rgba(255, 255, 255, 0.05);
}

.viewport-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 40px;
    text-align: center;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 480px;
}

.pulse-icon {
    font-size: 48px;
    color: rgba(255,255,255,0.15);
    animation: placeholder-pulse 2.5s infinite ease-in-out;
}

.placeholder-content h2 {
    font-size: 20px;
    font-weight: 600;
}

.placeholder-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Video streaming elements */
.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.video-container video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: crosshair;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto; /* Catch events on this element instead of raw video */
}

/* Stats Badge */
.stats-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    background: rgba(11, 15, 25, 0.85);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    pointer-events: none;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--matrix-green);
}

.badge-item i {
    color: var(--text-secondary);
}

/* Notification Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: rgba(16, 24, 40, 0.9);
    border-left: 4px solid var(--matrix-green);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 8px 8px 0;
    padding: 12px 20px;
    color: var(--text-primary);
    min-width: 250px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--cyan-color);
}

/* Animations */
@keyframes placeholder-pulse {
    0% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.05); opacity: 0.95; text-shadow: 0 0 15px rgba(255,255,255,0.2); }
    100% { transform: scale(1); opacity: 0.4; }
}

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Utility Hidden */
.hidden {
    display: none !important;
}

/* Responsive Rules */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .app-container {
        height: auto;
    }
    body {
        height: auto;
        overflow-y: auto;
    }
    .viewer-panel {
        height: 500px;
    }
}

/* App Footer / CEO Branding */
.app-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    text-shadow: 0 0 5px rgba(0, 255, 102, 0.1);
    flex-shrink: 0;
    margin-top: 4px;
}

.app-footer span {
    color: var(--matrix-green);
    font-family: var(--font-mono);
}

/* File Transfer Card Styling */
.file-transfer-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.file-select-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(0, 255, 102, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    text-align: center;
}

.file-select-label i {
    font-size: 24px;
    color: var(--matrix-green);
    text-shadow: 0 0 8px var(--matrix-green-glow);
}

.file-select-label:hover {
    background: rgba(0, 255, 102, 0.04);
    border-color: var(--matrix-green);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.05);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 11.5px;
}

.progress-bar-wrapper {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--matrix-green) 0%, var(--cyan-color) 100%);
    border-radius: 3px;
    transition: width 0.1s ease;
}

/* Record Screen Button inside Stats Badge */
.record-btn {
    background: rgba(255, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto; /* Allow clicks since stats-badge has pointer-events: none */
    transition: all 0.3s ease;
}

.record-btn:hover {
    background: #ef4444;
    color: #000;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.record-btn.recording i {
    animation: recording-blink 1.2s infinite ease-in-out;
}

@keyframes recording-blink {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Screen Selector Modal for Electron */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 10, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: all 0.3s ease;
}

.modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-color: rgba(0, 229, 255, 0.25);
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.15);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h3 i {
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.modal-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 10px;
}

.source-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.source-item:hover {
    background: rgba(0, 229, 255, 0.05);
    border-color: var(--cyan-color);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
    transform: translateY(-2px);
}

.source-thumbnail {
    width: 100%;
    aspect-ratio: 16/10;
    background: rgba(0,0,0,0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.04);
}

.source-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.source-thumbnail i {
    font-size: 28px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.source-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 100%;
}

