/* ==========================================================================
   ScreenVision IA - Stylesheet (Cyberpunk Glass & Responsive Desktop Studio)
   ========================================================================== */

:root {
    --sv-primary: #38bdf8;
    --sv-primary-glow: rgba(56, 189, 248, 0.4);
    --sv-secondary: #818cf8;
    --sv-accent: #c084fc;
    --sv-pink: #f43f5e;
    --sv-green: #10b981;
    --sv-amber: #f59e0b;
    --sv-bg: #030712;
    --sv-panel-bg: rgba(15, 23, 42, 0.78);
    --sv-card-bg: rgba(30, 41, 59, 0.7);
    --sv-border: rgba(56, 189, 248, 0.2);
    --sv-border-bright: rgba(56, 189, 248, 0.45);
    --sv-text: #f8fafc;
    --sv-text-muted: #94a3b8;
    --sv-radius: 14px;
    --sv-font: 'Inter', system-ui, -apple-system, sans-serif;
    --sv-title-font: 'Outfit', var(--sv-font);
}

* {
    box-sizing: border-box;
}

body.screen-body {
    margin: 0;
    padding: 0;
    background-color: var(--sv-bg);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(192, 132, 252, 0.07) 0%, transparent 40%),
        linear-gradient(180deg, #030712 0%, #0b1120 100%);
    color: var(--sv-text);
    font-family: var(--sv-font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--sv-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.btn-back-brand:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--sv-primary);
}

.btn-back-brand img {
    height: 28px;
    width: auto;
}

.screen-module-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(129, 140, 248, 0.15));
    border: 1px solid var(--sv-border-bright);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--sv-primary);
    letter-spacing: 0.3px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sv-primary);
    box-shadow: 0 0 10px var(--sv-primary);
    animation: svPulse 2s infinite;
}

@keyframes svPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Selector de Modos */
.mode-tabs-container {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    gap: 4px;
}

.mode-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--sv-text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-tab-btn:hover {
    color: var(--sv-text);
    background: rgba(255, 255, 255, 0.05);
}

.mode-tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #0284c7, #4f46e5);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

/* Header Controls */
.lang-badge-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 18px;
}

.lang-select-sv {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.lang-select-sv option {
    background: #0f172a;
    color: #fff;
}

/* Main Studio Layout */
.screen-studio-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 16px;
    padding: 16px 20px 24px;
    flex: 1;
    max-width: 1720px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 1100px) {
    .screen-studio-layout {
        grid-template-columns: 1fr;
    }
}

/* Left Column: Screen Display */
.screen-viewport-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.viewport-stage {
    position: relative;
    background: #000;
    border-radius: var(--sv-radius);
    border: 1px solid var(--sv-border);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    min-height: 480px;
    max-height: 78vh;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
}

.screen-live-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.screen-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Empty Prompt Banner */
.screen-empty-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.9) 0%, rgba(3, 7, 18, 0.98) 100%);
    text-align: center;
    padding: 30px;
    z-index: 10;
}

.empty-icon-wrap {
    width: 74px;
    height: 74px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(129, 140, 248, 0.2));
    border: 1px solid var(--sv-border-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--sv-primary);
    margin-bottom: 18px;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

.empty-title {
    font-family: var(--sv-title-font);
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 8px;
    color: #fff;
}

.empty-sub {
    font-size: 0.95rem;
    color: var(--sv-text-muted);
    max-width: 480px;
    line-height: 1.5;
    margin: 0 0 24px;
}

.btn-big-capture {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #0284c7, #6366f1);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4);
    transition: all 0.2s ease;
}

.btn-big-capture:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(2, 132, 199, 0.6);
}

.btn-big-capture:active {
    transform: translateY(0);
}

/* Floating HUD on Screen */
.stage-hud-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 18px;
    z-index: 5;
}

.stage-hud-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stage-hud-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #38bdf8;
    pointer-events: auto;
}

.stage-hud-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.hud-btn {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hud-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--sv-primary);
}

.hud-btn.active, .hud-btn.frozen {
    background: #e11d48;
    border-color: #f43f5e;
    color: #fff;
}

/* Stage Bottom Tooltip */
.stage-bottom-tip {
    align-self: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--sv-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--sv-text-muted);
    pointer-events: auto;
}

/* Bar of Actions Below Video */
.stage-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sv-panel-bg);
    backdrop-filter: blur(14px);
    border: 1px solid var(--sv-border);
    border-radius: 12px;
    padding: 10px 16px;
    gap: 12px;
}

.action-bar-left, .action-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ctrl:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--sv-primary);
}

.btn-ctrl.btn-primary-action {
    background: linear-gradient(135deg, #0284c7, #6366f1);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-ctrl.btn-primary-action:hover {
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

.btn-ctrl:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Auto-analysis interval toggle */
.auto-interval-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--sv-text-muted);
}

.auto-interval-wrap select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-family: inherit;
    font-size: 0.8rem;
    padding: 5px 8px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

/* Right Column: AI Analysis Inspector Panel */
.screen-panel-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-card {
    background: var(--sv-panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.panel-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--sv-title-font);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.panel-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon-tiny {
    background: transparent;
    border: none;
    color: var(--sv-text-muted);
    font-size: 0.9rem;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Analysis Body & Markdown Results */
.panel-card-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 68vh;
}

.analysis-state-empty {
    text-align: center;
    color: var(--sv-text-muted);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.analysis-state-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
    color: var(--sv-primary);
    text-align: center;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(56, 189, 248, 0.15);
    border-top-color: var(--sv-primary);
    border-radius: 50%;
    animation: svSpin 0.9s linear infinite;
}

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

.analysis-result-content {
    font-size: 0.92rem;
    line-height: 1.65;
    color: #e2e8f0;
}

.analysis-result-content h1, 
.analysis-result-content h2, 
.analysis-result-content h3 {
    font-family: var(--sv-title-font);
    color: #fff;
    margin: 14px 0 6px;
}

.analysis-result-content h2 { font-size: 1.15rem; }
.analysis-result-content h3 { font-size: 1.02rem; }

.analysis-result-content p {
    margin: 0 0 10px;
}

.analysis-result-content ul, 
.analysis-result-content ol {
    margin: 0 0 12px;
    padding-left: 20px;
}

.analysis-result-content li {
    margin-bottom: 6px;
}

.analysis-result-content code {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.88em;
    color: #38bdf8;
}

.analysis-result-content pre {
    background: #020617;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.85rem;
    margin: 10px 0;
}

.analysis-result-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #f1f5f9;
}

/* Prompt Quick Input Box */
.panel-prompt-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.prompt-input-row {
    display: flex;
    gap: 8px;
}

.prompt-input-text {
    flex: 1;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.prompt-input-text:focus {
    border-color: var(--sv-primary);
}

.btn-send-prompt {
    background: var(--sv-primary);
    color: #000;
    border: none;
    padding: 0 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-send-prompt:hover {
    background: #7dd3fc;
}

/* Touch Focus Indicator */
.touch-ping-marker {
    position: absolute;
    width: 32px;
    height: 32px;
    margin-left: -16px;
    margin-top: -16px;
    border-radius: 50%;
    border: 2px solid var(--sv-primary);
    box-shadow: 0 0 14px var(--sv-primary);
    pointer-events: none;
    animation: pingMarkerAnim 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pingMarkerAnim {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Toast Notification */
.sv-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--sv-border-bright);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.88rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999;
}

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

/* Herramienta de Selección de Recuadro (Region Selector) */
.viewport-stage.is-selecting-box {
    cursor: crosshair !important;
}

.screen-selection-box {
    position: absolute;
    border: 2px dashed #38bdf8;
    background: rgba(56, 189, 248, 0.18);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 15px rgba(56, 189, 248, 0.4);
    pointer-events: none;
    z-index: 15;
    border-radius: 4px;
    display: none;
}

.btn-ctrl.btn-toggle-active {
    background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
    color: #030712 !important;
    font-weight: 800;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.6) !important;
    border-color: #38bdf8 !important;
}

.selection-box-label {
    position: absolute;
    bottom: -28px;
    left: 0;
    background: #0284c7;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Web Search Active State */
.btn-ctrl.web-active {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.4) !important;
}

/* Web Sources Card List */
.web-sources-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 10px;
    padding: 12px;
    margin-top: 14px;
}

.web-sources-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #34d399;
    margin-bottom: 8px;
}

.web-source-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.web-source-item:last-child {
    margin-bottom: 0;
}

.web-source-title {
    font-weight: 600;
    color: #38bdf8;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 3px;
}

.web-source-title:hover {
    text-decoration: underline;
}

.web-source-snippet {
    color: var(--sv-text-muted);
    font-size: 0.78rem;
}

/* OCR Text Box Copiable & Seleccionable */
.ocr-interactive-box {
    position: relative;
    background: #020617;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin: 12px 0;
}

.ocr-box-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    font-weight: 700;
    color: #38bdf8;
}

.ocr-box-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ocr-copy-btn {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ocr-copy-btn:hover {
    background: rgba(56, 189, 248, 0.35);
    color: #fff;
}

.ocr-selectable-textarea {
    width: 100%;
    min-height: 140px;
    max-height: 360px;
    background: transparent;
    border: none;
    padding: 12px;
    font-family: 'Consolas', 'Fira Code', monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #f8fafc;
    resize: vertical;
    outline: none;
    user-select: text !important;
    -webkit-user-select: text !important;
}

.ocr-selectable-textarea:focus {
    box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.2);
}


