﻿/* ==========================================================================
   DVR TV - Estilos para Samsung Smart TV e PC (1080p Nativo)
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0b0f17;
    color: #e2e8f0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    display: flex;
    flex-direction: column;
}

/* Header Superior */
.app-header {
    height: 56px;
    min-height: 56px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(15, 20, 30, 0.9) 100%);
    border-bottom: 2px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.5);
}

.dvr-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f8fafc;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.7);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #94a3b8;
}

.status-dot.connected {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-dot.connecting {
    background-color: #f59e0b;
    animation: pulse 1s infinite alternate;
}

.status-dot.error {
    background-color: #ef4444;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Botão de Configurações no Header */
.btn-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #e2e8f0;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.btn-settings:hover, .btn-settings.focused {
    background: #0284c7;
    color: #ffffff;
    border-color: #00d2ff;
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.85), inset 0 0 6px rgba(0, 210, 255, 0.4);
    transform: scale(1.05);
}

.icon-gear {
    font-size: 15px;
}

.clock-widget {
    text-align: right;
}

.clock-time {
    font-size: 22px;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 1px;
}

.clock-date {
    font-size: 12px;
    color: #94a3b8;
    text-transform: capitalize;
}

/* Área Principal (Grid de Câmeras) */
.main-container {
    flex: 1;
    padding: 8px 12px;
    overflow: hidden;
    position: relative;
    display: flex;
}

.camera-grid {
    display: grid;
    gap: 6px;
    width: 100%;
    height: 100%;
}

.camera-grid.layout-1x1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.camera-grid.layout-2x2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
}

.camera-grid.layout-3x3 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
}

.camera-grid.layout-4x4 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 6px;
}

.camera-card {
    background-color: #101622;
    border-radius: 6px;
    border: 2px solid #1e293b;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    display: flex;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.camera-card.focused {
    border: 3.5px solid #00f0ff !important;
    box-shadow: 0 0 22px rgba(0, 240, 255, 0.95), inset 0 0 8px rgba(0, 240, 255, 0.5);
    transform: scale(1.035);
    z-index: 25;
}

.camera-card.focused .camera-overlay-top {
    border-left: 3px solid #00f0ff;
    background: rgba(0, 240, 255, 0.25);
    backdrop-filter: blur(4px);
}

.camera-card.focused .cam-badge-id {
    color: #ffffff;
    background: #0284c7;
    padding: 1px 5px;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.8);
}

.card-video-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #05080f;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.camera-img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.camera-overlay-top {
    position: absolute;
    top: 4px;
    left: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    padding: 2px 6px;
    border-radius: 4px;
    border-left: 3px solid #0284c7;
    pointer-events: none;
}

.cam-badge-id {
    font-size: 11px;
    font-weight: 800;
    color: #38bdf8;
}

.cam-name {
    font-size: 11px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.camera-overlay-bottom {
    position: absolute;
    bottom: 4px;
    left: 6px;
    right: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.cam-status {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.cam-status.online {
    background-color: rgba(16, 185, 129, 0.85);
    color: #ffffff;
}

.cam-status.offline {
    background-color: rgba(239, 68, 68, 0.85);
    color: #ffffff;
}

.cam-res {
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
}
/* Modo Visualização Individualizada (Estrutura Vertical: Vídeo Proporcional Acima, Menu Discreto Abaixo) */
.fullscreen-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #06090f;
    z-index: 100;
    display: none;
    flex-direction: column;
}

.fullscreen-video-wrapper {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px 6px 16px;
    overflow: hidden;
    box-sizing: border-box;
}

.fullscreen-player-container {
    position: relative;
    background: #000000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avplay-fallback-img {
    width: 100%;
    height: 100%;
    object-fit: fill; /* Proporção 16:9 paisagem idêntica à grade de câmeras */
    display: block;
}

/* Barra Inferior Discreta (Abaixo da imagem - NUNCA fica por cima do vídeo) */
.fullscreen-bottom-bar {
    height: 54px;
    min-height: 54px;
    background: linear-gradient(180deg, #0d1422 0%, #070b13 100%);
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 10;
    box-sizing: border-box;
}

.fs-bottom-left {
    display: flex;
    align-items: center;
}

.fs-cam-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.fs-cam-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.3px;
}

.fs-quality-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 12px;
    line-height: 1;
}

.fs-quality-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

/* Cores Diferenciadas para Fluido e HD logo após a legenda */
.fs-quality-tag.quality-fluido {
    color: #10b981; /* Verde esmeralda */
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.45);
}
.fs-quality-tag.quality-fluido .fs-quality-dot {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.fs-quality-tag.quality-hd {
    color: #38bdf8; /* Azul ciano */
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.45);
}
.fs-quality-tag.quality-hd .fs-quality-dot {
    background-color: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
}

.fs-bottom-right {
    display: flex;
    align-items: center;
    gap: 22px;
}

.fs-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.fs-hint-key {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    color: #cbd5e1;
    font-size: 11px;
}

.fs-hint-key.key-yellow {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.4);
}

/* Spinner de Buffering */
.player-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.75);
    padding: 20px 32px;
    border-radius: 10px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #38bdf8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   MODAL DE CONFIGURAÇÕES
   ========================================================================== */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(8px);
}

.settings-card {
    position: relative;
    width: 720px;
    max-width: 90vw;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(2, 132, 199, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.settings-header {
    padding: 18px 24px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-icon {
    font-size: 24px;
}

.settings-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
}

.btn-close-modal {
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    line-height: 1;
    outline: none;
    transition: all 0.15s ease;
}

.btn-close-modal:hover, .btn-close-modal.focused {
    color: #ffffff;
    background: #ef4444;
    border-color: #f87171;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.settings-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 72vh;
    overflow-y: auto;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 {
    flex: 1;
}

.form-input {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 16px;
    color: #ffffff;
    outline: none;
    font-family: inherit;
    transition: all 0.15s ease;
}

.form-input:focus, .form-input.focused {
    border-color: #00d2ff;
    background: #0b1329;
    box-shadow: 0 0 14px rgba(0, 210, 255, 0.65);
}

.input-hint {
    font-size: 12px;
    color: #64748b;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-input {
    width: 100%;
    padding-right: 42px;
}

.password-lock-icon {
    position: absolute;
    right: 14px;
    font-size: 16px;
    color: #64748b;
    pointer-events: none;
    user-select: none;
}

/* Seção Avançada */
.advanced-section {
    background: #131c2e;
    border: 1px dashed #334155;
    border-radius: 8px;
    padding: 12px;
    margin-top: 4px;
}

.btn-toggle-advanced {
    width: 100%;
    background: transparent;
    border: none;
    color: #38bdf8;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    outline: none;
    transition: all 0.15s ease;
}

.btn-toggle-advanced:hover, .btn-toggle-advanced.focused {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.advanced-arrow {
    font-size: 11px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.advanced-arrow.open {
    transform: rotate(90deg);
}

.advanced-fields {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 10px;
}

.settings-footer {
    padding: 18px 24px;
    background: #111827;
    border-top: 1px solid #1f2937;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
}

.modal-btn.btn-primary {
    background: #0284c7;
    color: #ffffff;
    border-color: #0369a1;
}

.modal-btn.btn-primary:hover, .modal-btn.btn-primary.focused {
    background: #0369a1;
    border-color: #00d2ff;
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.75);
    transform: scale(1.02);
}

.modal-btn.btn-secondary {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}

.modal-btn.btn-secondary:hover, .modal-btn.btn-secondary.focused {
    background: #475569;
    border-color: #94a3b8;
    box-shadow: 0 0 12px rgba(148, 163, 184, 0.55);
    transform: scale(1.02);
}

.modal-btn.btn-cancel {
    background: transparent;
    color: #94a3b8;
    border-color: #334155;
}

.modal-btn.btn-cancel:hover, .modal-btn.btn-cancel.focused {
    background: #1f2937;
    color: #f1f5f9;
    border-color: #64748b;
    transform: scale(1.02);
}

/* Rodapé com Legenda do Controle Remoto Samsung */
.remote-legend-footer {
    height: 44px;
    min-height: 44px;
    background-color: #0f141f;
    border-top: 2px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 0 20px;
    z-index: 10;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
}

.btn-pill {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.btn-pill.red { background-color: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
.btn-pill.green { background-color: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.btn-pill.yellow { background-color: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.6); }
.btn-pill.blue { background-color: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.6); }

.key-badge {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
}

/* Toast de Notificação */
.toast-notification {
    position: fixed;
    top: 70px;
    right: 30px;
    background: rgba(15, 23, 42, 0.95);
    border-left: 4px solid #38bdf8;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transform: translateY(-40px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 600;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   TELA DE LOGIN DO SISTEMA (COMPATÍVEL COM GOOGLE CHROME PASSWORD MANAGER)
   ========================================================================== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.login-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(30, 41, 59, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 14px;
    padding: 36px 32px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.15);
    animation: loginCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #38bdf8;
    margin-bottom: 14px;
}

.login-badge-dot {
    width: 8px;
    height: 8px;
    background: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 8px #38bdf8;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 6px 0;
}

.login-header p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.login-card .form-input {
    width: 100%;
    box-sizing: border-box;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 15px;
    color: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card .form-input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.password-toggle-btn:hover {
    opacity: 1;
}

.login-error-msg {
    background: rgba(239, 68, 68, 0.15);
    border-left: 3px solid #ef4444;
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 18px;
}

.btn-login-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn-login-submit:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
    transform: translateY(-1px);
}

.btn-login-submit:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(51, 65, 85, 0.6);
    font-size: 12px;
    color: #64748b;
}

/* Botão Sair no Cabeçalho */
.btn-logout {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
    border-color: #ef4444;
}
