/* =============================================================================
   HotelManager Pro — Estilos del panel admin
   Bootstrap 5.3 + tokens propios
   ============================================================================= */

:root {
    /* Paleta corporativa: azul navy hotelero */
    --hm-primary-50:  #eef4fb;
    --hm-primary-100: #dbe7f4;
    --hm-primary-200: #b6cde9;
    --hm-primary-300: #88aed8;
    --hm-primary-400: #5a8fc8;
    --hm-primary-500: #3d72b0;
    --hm-primary-600: #2c5a92;
    --hm-primary-700: #234876;
    --hm-primary-800: #1c395f;
    --hm-primary-900: #122742;

    /* Acentos */
    --hm-success: #198754;
    --hm-warning: #f59e0b;
    --hm-danger:  #dc2626;
    --hm-info:    #0ea5e9;

    /* Estados de habitación (chips) */
    --hm-st-disponible:   #d1fae5;
    --hm-st-disponible-t: #065f46;
    --hm-st-ocupada:      #fee2e2;
    --hm-st-ocupada-t:    #991b1b;
    --hm-st-limpieza:     #fef3c7;
    --hm-st-limpieza-t:   #92400e;
    --hm-st-mant:         #e5e7eb;
    --hm-st-mant-t:       #374151;
    --hm-st-bloqueada:    #fae8ff;
    --hm-st-bloqueada-t:  #6b21a8;

    /* Layout */
    --hm-sidebar-width: 260px;
    --hm-navbar-height: 56px;
    --hm-radius:        0.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6f9;
}

/* ---------- Navbar ---------- */
.hm-navbar {
    background-color: var(--hm-primary-700);
    min-height: var(--hm-navbar-height);
}
.hm-navbar .navbar-brand {
    color: #fff !important;
    letter-spacing: 0.3px;
}

/* ---------- Layout principal ---------- */
.hm-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.hm-body {
    flex: 1;
    min-height: calc(100vh - var(--hm-navbar-height));
}

/* ---------- Sidebar ---------- */
.hm-sidebar {
    width: var(--hm-sidebar-width);
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .hm-sidebar {
        position: sticky;
        top: 0;
        height: calc(100vh - var(--hm-navbar-height));
        flex-shrink: 0;
        align-self: flex-start;
        overflow-y: auto;
    }
    /* Scrollbar fina y discreta para Firefox/Chromium */
    .hm-sidebar {
        scrollbar-width: thin;
        scrollbar-color: #d1d5db transparent;
    }
    .hm-sidebar::-webkit-scrollbar { width: 6px; }
    .hm-sidebar::-webkit-scrollbar-track { background: transparent; }
    .hm-sidebar::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 3px;
    }
    .hm-sidebar::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
}

/* En offcanvas mobile, ancho más cómodo */
@media (max-width: 991.98px) {
    .hm-sidebar.offcanvas {
        width: 280px !important;
    }
}

.hm-sidebar .nav {
    padding: 0.5rem 0;
}
.hm-sidebar .nav-item {
    margin: 1px 0;
}
.hm-sidebar .nav-link {
    color: #374151;
    padding: 0.6rem 1rem 0.6rem 0.85rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.hm-sidebar .nav-link i {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.65rem;
    color: #6b7280;
    flex-shrink: 0;
    transition: color 0.15s ease;
}
.hm-sidebar .nav-link:hover {
    background-color: var(--hm-primary-50);
    color: var(--hm-primary-700);
}
.hm-sidebar .nav-link:hover i {
    color: var(--hm-primary-600);
}
.hm-sidebar .nav-link.active {
    background-color: var(--hm-primary-50);
    color: var(--hm-primary-700);
    border-left-color: var(--hm-primary-600);
    font-weight: 600;
}
.hm-sidebar .nav-link.active i {
    color: var(--hm-primary-600);
}
.hm-sidebar-group-title {
    padding: 0.85rem 1rem 0.35rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #9ca3af;
    font-weight: 700;
}
.hm-sidebar-group-title:not(:first-child) {
    margin-top: 0.25rem;
    border-top: 1px solid #f3f4f6;
}
.hm-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    font-size: 0.72rem;
    color: #9ca3af;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #fafafa;
}

/* ---------- Main content ---------- */
.hm-main-content {
    min-height: calc(100vh - var(--hm-navbar-height));
}

/* ---------- Page header ---------- */
.hm-page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}
.hm-page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--hm-primary-800);
}
.hm-page-header .subtitle {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid #e5e7eb;
    border-radius: var(--hm-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.card-header {
    background-color: #fafbfc;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
}

/* ---------- Botones ---------- */
.btn-primary {
    background-color: var(--hm-primary-600);
    border-color: var(--hm-primary-600);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--hm-primary-700);
    border-color: var(--hm-primary-700);
}
.btn-outline-primary {
    color: var(--hm-primary-700);
    border-color: var(--hm-primary-600);
}
.btn-outline-primary:hover {
    background-color: var(--hm-primary-600);
    border-color: var(--hm-primary-600);
}

/* ---------- Chips de estado de habitación ---------- */
.hm-estado {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.hm-estado-disponible    { background: var(--hm-st-disponible);   color: var(--hm-st-disponible-t); }
.hm-estado-ocupada       { background: var(--hm-st-ocupada);      color: var(--hm-st-ocupada-t); }
.hm-estado-limpieza      { background: var(--hm-st-limpieza);     color: var(--hm-st-limpieza-t); }
.hm-estado-mantenimiento { background: var(--hm-st-mant);         color: var(--hm-st-mant-t); }
.hm-estado-bloqueada     { background: var(--hm-st-bloqueada);    color: var(--hm-st-bloqueada-t); }

/* ---------- Tablas ---------- */
.table {
    background: #fff;
}
.table > thead {
    background-color: #fafbfc;
}
.table > thead th {
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #4b5563;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---------- Login (página suelta sin sidebar) ---------- */
.hm-login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--hm-primary-800) 0%, var(--hm-primary-600) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.hm-login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.hm-login-header {
    background-color: var(--hm-primary-700);
    color: #fff;
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}
.hm-login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.5rem 0 0.25rem;
}
.hm-login-header p {
    font-size: 0.85rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}
.hm-login-body {
    padding: 2rem;
}

/* ---------- Dashboard widgets ---------- */
.hm-widget {
    background: #fff;
    border-radius: var(--hm-radius);
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    height: 100%;
}
.hm-widget-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.hm-widget-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--hm-primary-800);
    line-height: 1;
}
.hm-widget-icon {
    float: right;
    font-size: 1.5rem;
    color: var(--hm-primary-200);
}

/* ---------- Form helpers ---------- */
.form-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}
.form-label .required-mark {
    color: var(--hm-danger);
}

/* ---------- Utilities ---------- */
.hm-text-muted {
    color: #6b7280;
}
.hm-divider {
    border-top: 1px solid #e5e7eb;
    margin: 1.5rem 0;
}

/* ---------- Responsive ajustes ---------- */
@media (max-width: 991.98px) {
    .hm-main-content {
        padding: 1rem;
    }
}

/* =============================================================================
   ENTREGA 2: Habitaciones, camas, tipos, precios
   ============================================================================= */

/* ---------- Chips de filtro de estado (clickeables) ---------- */
.hm-estado-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.15s ease;
}
.hm-estado-chip:hover {
    background: var(--hm-primary-50);
    color: var(--hm-primary-700);
    border-color: var(--hm-primary-200);
}
.hm-estado-chip.active {
    background: var(--hm-primary-600);
    color: #fff;
    border-color: var(--hm-primary-600);
}
.hm-estado-chip.active .text-muted {
    color: rgba(255,255,255,0.85) !important;
}

/* ---------- Cards de habitación (grilla) ---------- */
.hm-hab-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--hm-radius);
    overflow: hidden;
    height: 100%;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.hm-hab-card:hover {
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.hm-hab-card-img {
    display: block;
    aspect-ratio: 4 / 3;
    background: #f3f4f6;
    overflow: hidden;
}
.hm-hab-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hm-hab-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}
.hm-hab-card-body {
    padding: 0.85rem 1rem;
}
.hm-hab-numero {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}
.hm-hab-numero a {
    color: var(--hm-primary-800);
    text-decoration: none;
}
.hm-hab-numero a:hover {
    color: var(--hm-primary-600);
}

/* ---------- Galería de imágenes (vista detalle) ---------- */
.hm-imagen-thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 0.4rem;
    background: #f3f4f6;
}
.hm-imagen-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hm-imagen-acciones {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.hm-imagen-thumb:hover .hm-imagen-acciones {
    opacity: 1;
}

/* =============================================================================
   ENTREGA 3: Huéspedes y Reservas
   ============================================================================= */

/* ---------- Estados de reserva ---------- */
.hm-reserva-estado {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    color: #fff;
    background: #6b7280;
}
.hm-reserva-pendiente   { background: #f59e0b; color: #fff; }
.hm-reserva-confirmada  { background: #3b82f6; color: #fff; }
.hm-reserva-en_curso    { background: #10b981; color: #fff; }
.hm-reserva-completada  { background: var(--hm-primary-700); color: #fff; }
.hm-reserva-cancelada   { background: #6b7280; color: #fff; opacity: 0.7; }

/* ---------- Calendario de ocupación ---------- */
.hm-calendario-wrap {
    overflow-x: auto;
    position: relative;
}
.hm-calendario {
    border-collapse: collapse;
    width: 100%;
    min-width: 1200px;
}
.hm-calendario th,
.hm-calendario td {
    border: 1px solid #e5e7eb;
    padding: 0;
    vertical-align: middle;
    background: #fff;
}
.hm-cal-th-hab,
.hm-cal-td-hab,
.hm-cal-td-hab-empty {
    width: 180px;
    min-width: 180px;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 2px solid var(--hm-primary-300);
}
.hm-cal-th-hab {
    background: var(--hm-primary-50);
    color: var(--hm-primary-800);
    font-weight: 600;
    text-align: left;
}
.hm-cal-th-dia {
    width: 36px;
    min-width: 36px;
    padding: 0.25rem 0;
    text-align: center;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 500;
}
.hm-cal-th-dia.hm-cal-hoy {
    background: var(--hm-primary-100);
    color: var(--hm-primary-800);
    font-weight: 700;
}
.hm-cal-th-dia.hm-cal-finde {
    background: #f3f4f6;
}
.hm-cal-dia-num {
    display: block;
    font-size: 0.85rem;
    color: #1f2937;
    font-weight: 600;
}
.hm-cal-dia-sem {
    display: block;
    font-size: 0.65rem;
    color: #9ca3af;
    text-transform: uppercase;
}
.hm-cal-celda {
    height: 28px;
    width: 36px;
}
.hm-cal-celda.hm-cal-hoy {
    background: rgba(99, 102, 241, 0.06);
}
.hm-cal-celda.hm-cal-finde {
    background: #fafafa;
}
.hm-cal-fila-reservas td {
    border: none;
    padding: 0;
}
.hm-cal-td-hab-empty {
    background: #f9fafb;
    border-right: 2px solid var(--hm-primary-300);
}
.hm-cal-td-reservas {
    position: relative;
    padding: 0;
    background: transparent;
}
.hm-cal-reservas-track {
    position: relative;
    height: 22px;
    margin-top: -22px;
    z-index: 1;
}
.hm-cal-reserva {
    position: absolute;
    top: 1px;
    height: 20px;
    border-radius: 3px;
    color: #fff;
    font-size: 0.72rem;
    line-height: 20px;
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.1s ease;
}
.hm-cal-reserva:hover {
    transform: translateY(-1px) scale(1.01);
    z-index: 10;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.hm-cal-reserva-texto {
    color: inherit;
}
.hm-cal-leyenda {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
}

/* =============================================================================
   ENTREGA 5: Roles y matriz de permisos
   ============================================================================= */

.hm-modulo-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
    height: 100%;
}
.hm-modulo-header {
    background: var(--hm-primary-50);
    border-bottom: 1px solid var(--hm-primary-200);
    padding: 0.6rem 0.85rem;
    color: var(--hm-primary-800);
}
.hm-modulo-permisos {
    padding: 0.5rem 0.85rem;
    max-height: 280px;
    overflow-y: auto;
}
.hm-modulo-permisos .form-check {
    margin-bottom: 0.35rem;
}
.hm-modulo-permisos code {
    font-size: 0.78rem;
    background: #f3f4f6;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    margin-right: 0.35rem;
}

/* =============================================================================
   ENTREGA 7: Dashboard avanzado
   ============================================================================= */

.hm-kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    transition: transform 0.15s, box-shadow 0.15s;
}
.hm-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.hm-kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.hm-kpi-content {
    flex-grow: 1;
    min-width: 0;
}
.hm-kpi-label {
    color: #6b7280;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.15rem;
}
.hm-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: #1f2937;
}
.hm-kpi-detail {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.hm-kpi-primary .hm-kpi-icon { background: #dbeafe; color: #1e40af; }
.hm-kpi-success .hm-kpi-icon { background: #d1fae5; color: #047857; }
.hm-kpi-warning .hm-kpi-icon { background: #fef3c7; color: #b45309; }
.hm-kpi-info    .hm-kpi-icon { background: #cffafe; color: #0e7490; }
.hm-kpi-danger  .hm-kpi-icon { background: #fee2e2; color: #b91c1c; }