/* Estilos Personalizados - Theme Claro y Sobrio - AMC TVads */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --accent-blue: #0284c7;
    --accent-indigo: #4338ca;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism / Clean Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Sidebar Styling */
@media (min-width: 992px) {
    .sidebar {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
        flex-shrink: 0;
        background: var(--sidebar-bg);
        border-right: 1px solid var(--sidebar-border);
        min-height: 100vh;
        z-index: 1045;
        overflow-x: hidden;
        box-sizing: border-box;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        width: 280px;
        max-width: 85vw;
        border-right: none;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        background: var(--sidebar-bg);
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .main-wrapper main {
        max-height: calc(100vh - 54px) !important;
        padding: 0.85rem !important;
    }
    
    .table-responsive {
        border-radius: 0.5rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}

.sidebar-logo {
    height: 42px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.sidebar .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar .nav-link:hover {
    color: var(--accent-blue);
    background-color: #f1f5f9;
}

.sidebar .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.sidebar .nav-link i {
    font-size: 1.2rem;
}

/* Status Badges Claro */
.badge-status {
    padding: 0.35em 0.75em;
    font-weight: 600;
    border-radius: 9999px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-online {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-online::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 6px #16a34a;
}

.badge-offline {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-offline::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #dc2626;
    border-radius: 50%;
}

.badge-unpaired {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-unpaired::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #d97706;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

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

/* Tablas en Theme Claro */
.table-dark-custom {
    color: var(--text-primary);
}

.table-dark-custom th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    background-color: #f8fafc;
}

.table-dark-custom td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

/* Botones Gradientes Sobrios */
.btn-gradient-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    border: none;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
    transition: all 0.2s ease;
}

.btn-gradient-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.3);
}

/* Modals y Formularios */
.modal-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.form-control, .form-select {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
    border-radius: 0.5rem;
    font-weight: 400;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff;
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(2, 132, 199, 0.15);
}

/* Code Badge */
code {
    color: #0369a1 !important;
    background-color: #e0f2fe !important;
    border: 1px solid #bae6fd !important;
}

/* Text Overrides for Visibility */
.text-dark-custom {
    color: var(--text-primary) !important;
}

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

/* Smart TV Screen Layout Simulator (16:9 Aspect Ratio - Fondo Negro Total Sin Líneas Divisorias) */
.tv-screen-simulator {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000000;
    border: none;
    border-radius: 0 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

.tv-screen-top {
    height: 82%;
    width: 100%;
    display: flex;
    background-color: #000000;
}

.tv-screen-bottom {
    height: 18%;
    width: 100%;
    display: flex;
    background-color: #000000;
    border-top: none;
}

/* Zone 1: Main Media (Images / Video - 78% width) */
.tv-zone-main {
    width: 78%;
    height: 100%;
    position: relative;
    background-color: #000000;
    border-right: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tv-zone-main img, .tv-zone-main video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv-zone-main iframe, iframe.tv-fullscreen-media, #tvPreviewFsMainZone iframe, #tvPreviewMainZone iframe {
    width: 106% !important;
    height: 106% !important;
    position: absolute !important;
    top: -3% !important;
    left: -3% !important;
    border: none !important;
    transform: scale(1.05);
    transform-origin: center;
    object-fit: cover;
}

/* Zone 2: Columna Derecha Vertical (22% width - Fecha/Hora Top + Clima Detallado 3 Días Responsivo) */
.tv-zone-right-col {
    width: 22%;
    height: 100%;
    background-color: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.2rem;
    color: #ffffff;
    overflow: hidden;
}

/* Sub-zona: Fecha y Hora (Top de la columna derecha - Ajustado para 1 renglón) */
.tv-subzone-clock {
    width: 98%;
    background-color: transparent;
    padding: 0.2rem 0.1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.tv-clock-time {
    font-size: clamp(0.9rem, 1.5vw, 1.45rem);
    font-weight: 900;
    color: #ffffff;
    line-height: 1.1;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-clock-date {
    font-size: clamp(0.6rem, 0.8vw, 0.8rem);
    font-weight: 600;
    color: #cbd5e1; /* Gris claro */
    margin-top: 0.15rem;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sub-zona: Clima Detallado Responsivo (Encaja todo el pronóstico de 3 días) */
.tv-subzone-weather {
    width: 98%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    text-align: center;
    padding: 0.2rem 0.1rem;
    overflow: hidden;
}

.tv-subzone-weather .display-4 {
    font-size: clamp(1.2rem, 1.8vw, 1.8rem) !important;
    margin-bottom: 0.1rem !important;
}

.tv-weather-temp {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.tv-weather-condition {
    color: #ffffff;
    font-weight: 700;
    font-size: clamp(0.65rem, 0.85vw, 0.85rem);
    margin-top: 0.1rem;
    white-space: nowrap;
}

.tv-weather-details {
    font-size: clamp(0.55rem, 0.7vw, 0.72rem);
    color: #e2e8f0;
    font-weight: 500;
    margin-top: 0.1rem;
    white-space: nowrap;
}

.tv-weather-city {
    font-size: clamp(0.6rem, 0.75vw, 0.75rem);
    font-weight: 600;
    color: #cbd5e1;
    margin-top: 0.1rem;
}

.tv-weather-forecast-box {
    margin-top: 0.2rem;
    padding-top: 0.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    width: 98%;
}

.tv-forecast-title {
    font-size: clamp(0.5rem, 0.65vw, 0.65rem);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 0.15rem;
    font-weight: 700;
}

.tv-forecast-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: clamp(0.55rem, 0.7vw, 0.72rem);
    font-weight: 600;
    color: #ffffff;
    padding: 0.15rem 0.35rem;
    margin-bottom: 0.15rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.35rem;
}

.tv-forecast-item i {
    font-size: clamp(0.65rem, 0.8vw, 0.85rem);
}

/* Zone 3: Noticias Expandidas (80% width - Efecto Fade Out / Fade In) */
.tv-zone-news {
    width: 80%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background-color: #000000;
    overflow: hidden;
}

.tv-news-fade-container {
    position: relative;
    flex-grow: 1;
    height: 100%;
    display: flex;
    align-items: center;
}

.tv-news-fade-item {
    font-size: 1.15rem;
    font-weight: 500;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    position: absolute;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-news-fade-item.active {
    opacity: 1;
}

/* Zone 4: Logo Empresa Responsivo (20% width) */
.tv-zone-logo {
    width: 20%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    background-color: #000000;
}

.tv-zone-logo img {
    max-height: 90%;
    width: 90%;
    max-width: 90%;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

/* Smart TV Fullscreen Simulator (Pantalla Completa 100% con Superposición) */
.tv-screen-simulator-fullscreen {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000000;
    border: none;
    border-radius: 0 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

.tv-fullscreen-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Superposición de Hora/Fecha en Pantalla Completa (Esquina Inferior Izquierda) */
.tv-overlay-clock {
    position: absolute;
    bottom: 1.25rem;
    left: 1.25rem;
    background: transparent;
    padding: 0;
    border: none;
    text-align: left;
    z-index: 20;
    pointer-events: none;
}

.tv-overlay-clock-time {
    font-size: 2rem;
    font-weight: 900;
    color: #ffffff !important;
    line-height: 1;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.tv-overlay-clock-date {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff !important;
    margin-top: 0.25rem;
    text-transform: capitalize;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

/* Superposición de Logo en Pantalla Completa (Esquina Superior Derecha) */
.tv-overlay-logo {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    padding: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.9));
}

.tv-overlay-logo img {
    max-height: 75px;
    max-width: 240px;
    width: 90%;
    object-fit: contain;
}

/* MODO 3: SIMULADOR VERTICAL MULTIZONA (9:16 Aspect Ratio) */
.tv-screen-simulator-vertical-multizone {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    background-color: #000000;
    border: none;
    border-radius: 0 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

.tv-v3-top-news-bar {
    height: 9%;
    width: 100%;
    background-color: #000000;
    border-bottom: 2px solid #ffffff;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    overflow: hidden;
    z-index: 10;
}

.tv-v3-middle-media {
    height: 77%;
    width: 100%;
    position: relative;
    background-color: #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tv-v3-middle-media img, .tv-v3-middle-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv-v3-bottom-bar {
    height: 14%;
    width: 100%;
    background-color: #0b0f19;
    border-top: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5rem;
}

/* MODO 4: SIMULADOR VERTICAL FULLSCREEN (9:16 Aspect Ratio) */
.tv-screen-simulator-vertical-fullscreen {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    background-color: #000000;
    border: none;
    border-radius: 0 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

.tv-v4-top-left-clock {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.tv-v4-top-right-logo {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 20;
    pointer-events: none;
    max-width: 80px;
    max-height: 40px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.9));
}

.tv-v4-bottom-news {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 11%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 20;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
}
