@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Playfair+Display:wght@700;800&display=swap');

:root {
    --bg-color: #f0f3f7;
    --panel-bg: #ffffff;
    --primary: #1e3a5f;       /* Deep navy from Zielo logo */
    --primary-light: #2d5a8e;
    --primary-dark: #122740;
    --accent: #c9a84c;        /* Warm gold accent */
    --secondary: #3a4f6a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #dce3ed;
    
    /* Room Status Colors */
    --status-libre: #22c55e;
    --status-ocupada: #ef4444;
    --status-sucia: #f59e0b;
    --status-mantenimiento: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(30,58,95,0.15);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: white;
    padding: 3px;
}

.sidebar-header .brand-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.nav-links {
    list-style: none;
    padding: 0.8rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-links li a {
    display: block;
    padding: 0.85rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s;
    border-left: 3px solid transparent;
}

.nav-links li a:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    border-left-color: rgba(255,255,255,0.3);
}

.nav-links li a.active {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    border-left-color: var(--accent);
    font-weight: 700;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-bar h1 {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 800;
}

.panel {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(30,58,95,0.06);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

/* Room Rack Grid */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}

.room-card {
    border-radius: 10px;
    padding: 1rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}

.room-card.libre { background: linear-gradient(135deg, #22c55e, #16a34a); }
.room-card.ocupada { background: linear-gradient(135deg, #ef4444, #dc2626); }
.room-card.sucia, .room-card.limpieza { background: linear-gradient(135deg, #f59e0b, #d97706); }
.room-card.mantenimiento { background: linear-gradient(135deg, #94a3b8, #64748b); }

.room-number {
    font-size: 2rem;
    font-weight: 800;
}

.room-type {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.room-guest {
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(0,0,0,0.2);
    padding: 0.3rem;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(30,58,95,0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 15px rgba(34,197,94,0.3);
    transform: translateY(-1px);
}

.btn:hover {
    opacity: 0.95;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(18,39,64,0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--panel-bg);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(18,39,64,0.3);
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Badges R (Reserva) y S (Salida) */
.room-badges-container {
    position: absolute;
    bottom: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
}

.room-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 900;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    text-transform: uppercase;
}

.room-badge.badge-r {
    background: #fbbf24;
    color: #78350f;
    border: 1.5px solid #f59e0b;
}

.room-badge.badge-s {
    background: #0284c7;
    color: #ffffff;
    border: 1.5px solid #38bdf8;
}

/* Sidebar Submenu for Gobernancia */
.nav-submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.nav-submenu {
    list-style: none;
    padding-left: 1rem;
    background: rgba(0, 0, 0, 0.15);
    display: none;
}

.nav-submenu.open {
    display: block;
}

.nav-submenu li a {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    border-left: 2px solid transparent;
}

.nav-submenu li a:hover {
    border-left-color: var(--accent);
}

/* Table Responsive Container */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Toggle Bar */
.mobile-topbar {
    display: none;
    background: var(--primary-dark);
    color: white;
    padding: 0.8rem 1rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-menu-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Tablet & Mobile Responsiveness */
@media (max-width: 900px) {
    body {
        flex-direction: column;
    }

    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 270px;
        height: 100vh;
        z-index: 1200;
        transition: left 0.3s ease;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(3px);
        z-index: 1150;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
    }

    .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .header-bar h1 {
        font-size: 1.4rem;
    }

    .room-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 0.8rem;
    }

    .room-card {
        padding: 0.8rem;
    }

    .room-number {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .room-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 0.5rem;
    }
    
    .room-number {
        font-size: 1.1rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* --- KuDE SIFEN (Comprobante Electrónico Oficial) --- */
.kude-paper {
    background: white;
    width: 850px;
    max-width: 95vw;
    max-height: 92vh;
    overflow-y: auto;
    padding: 2.2rem;
    border-radius: 6px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    font-family: 'Inter', sans-serif;
    color: #111827;
}
.kude-header {
    border: 2px solid #000;
    padding: 1rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.kude-cdc-box {
    background: #f3f4f6;
    border: 1px dashed #6b7280;
    padding: 0.6rem;
    text-align: center;
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin: 1rem 0;
}
.kude-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.kude-table th, .kude-table td {
    border: 1px solid #000;
    padding: 6px 8px;
}
.kude-table th { background: #f3f4f6; text-align: center; }

@media print {
    /* Ocultar todo excepto el KuDE */
    body * { visibility: hidden; }
    .kude-paper, .kude-paper * { visibility: visible; }

    /* Normalizar el modal contenedor: quitar overlay oscuro, fondo y blur */
    .modal.active {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: auto !important;
        background: transparent !important;
        backdrop-filter: none !important;
        display: block !important;
        overflow: visible !important;
        z-index: 9999;
    }

    /* El paper ocupa toda la hoja, sin sombra ni bordes redondeados */
    .kude-paper {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 1.5cm !important;
        margin: 0 !important;
    }

    /* Ocultar elementos marcados como no imprimibles */
    .no-print { display: none !important; visibility: hidden !important; }

    /* Configuración de página */
    @page { margin: 0; size: A4 portrait; }
}

