:root {
    --rosado: #E22863;
    --azul: #0A4B8A;
    --naranja: #F69D34;
    --azul-oscuro: #004a8c;
    --blanco: #FFFFFF;
    --gris: #F5F7FA;
    --gris-claro: #E3E8EF;
    --gris-texto: #3A3A3A;
}

/* ======== GENERAL ======== */
body {
    background: var(--gris);
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    color: var(--gris-texto);
}

/* ======== BOTÓN VOLVER ======== */
.btn-volver {
    display: inline-block;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    padding: 10px 18px;
    background: var(--rosado);
    color: var(--blanco);
    font-weight: 600;
    text-decoration: none;
    border-radius: 25px;
    transition: 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.btn-volver:hover {
    background: #c41e54;
    transform: translateY(-2px);
}

/* ======== HEADER ======== */
.header {
    background: var(--azul);
    text-align: center;
    padding: 20px 20px;
    color: var(--blanco);
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* ======== CONTENEDOR ======== */
.container {
    width: 90%;
    max-width: 1100px;
    margin: 60px auto 40px auto;
}

.container h2 {
    font-size: 24px;
    color: var(--azul-oscuro);
    margin-bottom: 20px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.container h2::after {
    content: '';
    width: 60px;
    height: 4px;
    background: var(--rosado);
    display: block;
    position: absolute;
    bottom: -8px;
    left: 0;
    border-radius: 5px;
}

/* ======== BOTÓN AGREGAR ======== */
.btn-agregar {
    background: var(--rosado);
    color: var(--blanco);
    font-weight: 600;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    transition: 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-agregar:hover {
    background: #c41e54;
    transform: translateY(-2px);
}

/* ======== TABLA ======== */
.tabla {
    width: 100%;
    border-collapse: collapse;
    background: var(--blanco);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    table-layout: auto;
}

.tabla thead {
    background: var(--azul);
    color: var(--blanco);
}

.tabla th,
.tabla td {
    text-align: center;
    padding: 12px 4px;
    vertical-align: middle;
}

.tabla th:nth-child(2),
.tabla td:nth-child(2) {
    text-align: center;
}

.tabla tbody tr:nth-child(even) {
    background: var(--gris-claro);
}

.tabla tbody tr:hover {
    background: #fff3f8;
}

/* ======== BOTONES ======== */
.btn {
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: 0.3s ease;
}

.btn.editar {
    background: var(--azul);
    color: var(--blanco);
}

.btn.editar:hover {
    background: var(--azul-oscuro);
}

.btn.eliminar {
    background: var(--rosado);
    color: var(--blanco);
}

.btn.eliminar:hover {
    background: #c41e54;
}

/* ======== ALINEACIÓN DE BOTONES EN TABLA ======== */
.tabla tbody td {
    vertical-align: middle;
}

.tabla tbody td:last-child {
    text-align: center;
}

.tabla tbody td:last-child .btn {
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px;
}

/* ======== MODAL OVERLAY (CREAR/EDITAR) ======== */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#modal-content {
    background: var(--blanco);
    padding: 30px;
    border-radius: 6px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: 0.2s;
}

#modal-close:hover {
    color: #000;
}

/* ======== MODAL DE CONFIRMACIÓN ======== */
#confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

#confirm-content {
    background: var(--blanco);
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
}

#confirm-content h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

#confirm-message {
    color: #666;
    margin: 20px 0;
    font-size: 14px;
}

#confirm-cancel,
#confirm-ok {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
}

#confirm-cancel {
    background: #ccc;
    color: #333;
    margin-right: 10px;
}

#confirm-cancel:hover {
    background: #aaa;
}

#confirm-ok {
    background: #d32f2f;
    color: var(--blanco);
}

#confirm-ok:hover {
    background: #b71c1c;
}

/* ======== MODAL DE SELECCIÓN DE SEDE ======== */
#sede-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

#sede-selector-content {
    background: var(--blanco);
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

#sede-selector-content h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

#sede-selector-content p {
    color: #666;
    margin: 10px 0 20px 0;
    font-size: 14px;
}

#sede-selector-body {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

#sede-cancel-btn {
    padding: 10px 20px;
    background: #ccc;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
}

#sede-cancel-btn:hover {
    background: #aaa;
}

/* ======== MODAL DE MENSAJE ======== */
#message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

#message-content {
    background: var(--blanco);
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
}

#message-title {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

#message-text {
    color: #666;
    margin: 20px 0;
    font-size: 14px;
}

#message-ok {
    padding: 10px 30px;
    background: #4caf50;
    color: var(--blanco);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
}

#message-ok:hover {
    background: #45a049;
}

/* ========== FORMULARIO EMPLEADOS ========== */
#form-empleado {
    width: 100%;
}
#form-empleado > div { margin-bottom: 10px; }
#form-empleado label { display:block; margin-bottom:6px; font-weight:600; color:#333; }
#form-empleado input,
#form-empleado textarea,
#form-empleado select {
    width:100%;
    padding:8px;
    border:1px solid #ddd;
    border-radius:4px;
    font-size:14px;
    box-sizing:border-box;
}
#form-empleado input:focus,
#form-empleado textarea:focus,
#form-empleado select:focus {
    outline:none;
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(10,75,138,0.06);
}
#form-error { display:none; color:#b00020; margin-bottom:8px; font-size:13px; }

/* MODAL BODY (contenido cargado por fetch) */
#modal-body {
    padding: 6px 0;
}

/* CONFIRM BUTTONS (JS crea .confirm-buttons) */
.confirm-buttons {
    display:flex;
    gap:10px;
    justify-content:center;
    margin-top:12px;
}
.confirm-buttons button {
    padding:8px 14px;
    border:none;
    border-radius:4px;
    font-weight:600;
    cursor:pointer;
}
.confirm-buttons .cancel { background:#ccc; color:#333; }
.confirm-buttons .confirm { background:#d32f2f; color:#fff; }

/* UTILIDADES */
.hidden { display:none !important; }
.text-center { text-align:center; }

/* Pequeña mejora responsive para formularios en modal */
@media (max-width: 520px) {
    #modal-content { padding:14px; }
    #form-empleado input, #form-empleado textarea, #form-empleado select { font-size:13px; padding:7px; }
}

/* ======== FORMULARIO EN MODAL ======== */
#form-pelicula,
#form-sede,
#form-sala,
#form-funcion,
#form-producto,
#form-categoria,
#form-beneficio {
    width: 100%;
}

#form-pelicula > div,
#form-sede > div,
#form-sala > div,
#form-funcion > div,
#form-producto > div,
#form-categoria > div,
#form-beneficio > div {
    margin-bottom: 15px;
}

#form-pelicula label,
#form-sede label,
#form-sala label,
#form-funcion label,
#form-producto label,
#form-categoria label,
#form-beneficio label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

#form-pelicula input,
#form-pelicula select,
#form-pelicula textarea,
#form-sede input,
#form-sede select,
#form-sala input,
#form-funcion input,
#form-producto input,
#form-categoria input,
#form-categoria select,
#form-beneficio input,
#form-beneficio select,
#form-sala select,
#form-funcion select,
#form-producto select,
#form-producto textarea,
#form-categoria textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
}

#form-pelicula input:focus,
#form-pelicula select:focus,
#form-pelicula textarea:focus,
#form-sede input:focus,
#form-sede select:focus,
#form-sala input:focus,
#form-funcion input:focus,
#form-producto input:focus,
#form-categoria input:focus,
#form-categoria select:focus,
#form-beneficio input:focus,
#form-beneficio select:focus,
#form-sala select:focus,
#form-funcion select:focus,
#form-producto select:focus,
#form-producto textarea:focus,
#form-categoria textarea:focus {
    outline: none;
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(10, 75, 138, 0.1);
}

#form-error {
    display: none;
    color: #b00020;
    margin-bottom: 10px;
    font-size: 13px;
}

#form-pelicula > div:last-of-type,
#form-sede > div:last-of-type,
#form-sala > div:last-of-type,
#form-funcion > div:last-of-type,
#form-producto > div:last-of-type,
#form-categoria > div:last-of-type {
    text-align: right;
    margin-top: 12px;
    margin-bottom: 0;
}

#cancel-btn,
#form-pelicula button[type="submit"],
#form-sede button[type="submit"],
#form-sala button[type="submit"],
#form-funcion button[type="submit"],
#form-producto button[type="submit"],
#form-categoria button[type="submit"],
#form-beneficio button[type="submit"] {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: 0.3s;
}

#cancel-btn {
    background: #ccc;
    color: #333;
    margin-right: 12px;
}

#cancel-btn:hover {
    background: #aaa;
}

#form-pelicula button[type="submit"],
#form-sede button[type="submit"],
#form-sala button[type="submit"],
#form-funcion button[type="submit"],
#form-producto button[type="submit"],
#form-categoria button[type="submit"],
#form-beneficio button[type="submit"] {
    background: var(--azul);
    color: var(--blanco);
}

#form-pelicula button[type="submit"]:hover,
#form-sede button[type="submit"]:hover,
#form-sala button[type="submit"]:hover,
#form-funcion button[type="submit"]:hover,
#form-producto button[type="submit"]:hover,
#form-categoria button[type="submit"]:hover,
#form-beneficio button[type="submit"]:hover {
    background: var(--azul-oscuro);
}

/* ======== FORMULARIO COMBO ======== */
#form-combo {
    width: 100%;
}

#form-combo > div {
    margin-bottom: 15px;
}

#form-combo label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

#form-combo input,
#form-combo select,
#form-combo textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
}

#form-combo input:focus,
#form-combo select:focus,
#form-combo textarea:focus {
    outline: none;
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(10, 75, 138, 0.1);
}

#form-combo > div:last-of-type {
    text-align: right;
    margin-top: 12px;
    margin-bottom: 0;
}

#form-combo button[type="submit"],
#form-combo button[type="button"] {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: 0.3s;
}

#form-combo button[type="submit"] {
    background: var(--azul);
    color: var(--blanco);
}

#form-combo button[type="submit"]:hover {
    background: var(--azul-oscuro);
}

/* Sección de productos dentro del combo */
.combo-productos-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.combo-productos-section > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.combo-selector-container {
    margin-bottom: 10px;
}

.combo-selector-container select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
}

.combo-cantidad-container {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.combo-cantidad-container input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
}

#btn-agregar-producto {
    padding: 10px 16px;
    background: var(--rosado);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: 0.3s;
}

#btn-agregar-producto:hover {
    background: #f57b20;
}

.combo-productos-list {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    min-height: 100px;
    background: #f9f9f9;
    margin-bottom: 15px;
}

.combo-productos-list p {
    color: #999;
    text-align: center;
    margin: 0;
}

.combo-producto-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    margin-bottom: 5px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.combo-producto-item > div {
    flex: 1;
}

.combo-producto-item strong {
    display: block;
    margin-bottom: 4px;
}

.combo-producto-item small {
    color: #666;
    font-size: 13px;
}

.btn-remover-producto {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-remover-producto:hover {
    background: #b71c1c;
}

/* ======== SECCIONES AGRUPADAS POR SEDE ======== */
.sede-section {
    margin-bottom: 30px;
}

.sede-section h3 {
    color: var(--azul);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--rosado);
    padding-bottom: 10px;
}

.sede-section p {
    color: #999;
    font-style: italic;
}

/* ======== SECCIONES AGRUPADAS POR TIPO ======== */
.tipo-section {
    margin-bottom: 30px;
}

.tipo-section h3 {
    color: var(--azul);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--rosado);
    padding-bottom: 10px;
}

.tipo-section p {
    color: #999;
    font-style: italic;
}

#salas-container p {
    color: #666;
    font-style: italic;
    text-align: center;
    margin-top: 20px;
}

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
    .tabla th,
    .tabla td {
        font-size: 13px;
        padding: 8px;
    }

    .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .btn-agregar {
        padding: 8px 14px;
        font-size: 13px;
    }

    #modal-content {
        max-width: 90%;
    }

    #confirm-content,
    #message-content {
        max-width: 85%;
    }
}

/* Mapear estilos de form-pelicula a form-empleado para reutilizar CSS de películas */
#form-empleado > div:last-of-type {
    text-align: right;
    margin-top: 12px;
    margin-bottom: 0;
}

#cancel-btn,
#form-empleado button[type="submit"] {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
}

#cancel-btn {
    background: #ccc;
    color: #333;
    margin-right: 8px;
}

#form-empleado button[type="submit"] {
    background: var(--azul);
    color: var(--blanco);
}

#cancel-btn:hover { background: #aaa; }
#form-empleado button[type="submit"]:hover { background: var(--azul-oscuro); }

/* ======== FORMULARIO CAJERO (usar mismos estilos que empleado) ======== */

#form-cajero {
    width: 100%;
}

#form-cajero > div {
    margin-bottom: 10px;
}

#form-cajero label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
}

#form-cajero input,
#form-cajero select,
#form-cajero textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

#form-cajero input:focus,
#form-cajero select:focus,
#form-cajero textarea:focus {
    outline: none;
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(10, 75, 138, 0.06);
}

#form-cajero > div:last-of-type {
    text-align: right;
    margin-top: 12px;
    margin-bottom: 0;
}

#form-cajero button[type="submit"],
#cancel-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
}

#cancel-btn {
    background: #ccc;
    color: #333;
    margin-right: 8px;
}

#cancel-btn:hover { background: #aaa; }

#form-cajero button[type="submit"] {
    background: var(--azul);
    color: var(--blanco);
}

#form-cajero button[type="submit"]:hover {
    background: var(--azul-oscuro);
}
