/*
 * Estilo inspirado en Complejo El Refugio - El Trapiche, San Luis
 * https://www.complejoelrefugio.com.ar/
 * Responsive: móvil y escritorio
 */

:root {
    --refugio-verde: #1a4d2e;
    --refugio-verde-claro: #2d6a4f;
    --refugio-verde-suave: #e8f5e9;
    --refugio-nature: #3d5a3c;
    --texto: #333;
    --texto-suave: #555;
    --texto-muted: #777;
    --borde: #e0e0e0;
    --fondo: #ffffff;
    --sombra: 0 2px 8px rgba(26, 77, 46, 0.08);
    --radio: 8px;
    --header-altura: auto;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background-color: var(--fondo);
    color: var(--texto);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== Header (estilo Complejo El Refugio) ========== */
.header {
    background: linear-gradient(180deg, var(--fondo) 0%, var(--refugio-verde-suave) 100%);
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--refugio-verde);
    box-shadow: var(--sombra);
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-align: center;
}

/* Logo: imagen oficial o fallback texto */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-logo {
    max-height: 56px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

.logo-text-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--refugio-verde);
    letter-spacing: 0.02em;
}

.logo-text-fallback.visible {
    display: flex;
}

.logo-triangle {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid var(--refugio-verde);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--texto-suave);
    letter-spacing: 0.05em;
}

.location {
    font-size: 0.75rem;
    color: var(--texto-muted);
}

.header .logout-link {
    flex-shrink: 0;
    color: var(--texto-muted);
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0.4rem 0.6rem;
}

.header .logout-link:hover {
    color: var(--refugio-verde);
}

/* ========== Main ========== */
.main-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.25rem;
    min-height: 50vh;
}

.main-container.full-width {
    max-width: 100%;
    padding: 1rem;
}

.usuarios-page {
    width: 100%;
}

.usuarios-page .usuarios-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.usuarios-actions .btn-compact {
    flex: none;
    min-width: 0;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.usuarios-actions .submit-button.btn-compact {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.submit-button.btn-compact,
.cancel-button.btn-compact {
    flex: none;
    min-width: 0;
}

.acciones-usuario {
    white-space: nowrap;
}

.acciones-usuario a {
    margin-right: 0.5rem;
}

.form-borrar-usuario {
    display: inline;
}

.form-borrar-usuario .btn-borrar {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    color: #c62828;
    text-decoration: underline;
}

.form-borrar-usuario .btn-borrar:hover {
    color: #b71c1c;
}

.usuarios-page .form-box {
    max-width: 420px;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: var(--radio);
}

#form-crear-usuario.form-box,
#form-cambiar-password.form-box {
    margin-left: auto;
    margin-right: auto;
}

.form-usuarios-zone {
    margin-top: 1.5rem;
    min-height: 1px;
}

.form-usuarios-zone .form-usuario-panel {
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
}

.form-usuarios-zone .form-usuario-panel:first-child {
    margin-top: 0;
}

/* ========== Menú (botones táctiles en móvil) ========== */
.menu-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.menu-button {
    background-color: var(--refugio-verde);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radio);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.15s;
    border: none;
    cursor: pointer;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}

.menu-button:hover {
    background-color: var(--refugio-verde-claro);
}

.menu-button:active {
    transform: scale(0.99);
}

.button-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.button-text {
    flex: 1;
    text-align: left;
}

/* ========== Formularios ========== */
.form-container,
.list-container {
    margin-top: 1rem;
}

.form-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--texto);
}

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

.form-group input:not(.checkout-realizado-input),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    font-size: 1rem;
    background-color: var(--fondo);
    color: var(--texto);
    font-family: inherit;
}

.form-group input:not(.checkout-realizado-input):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--refugio-verde);
    box-shadow: 0 0 0 3px rgba(26, 77, 46, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--texto-muted);
}

.form-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

/* Bloque Checkout realizado (editar_estadia) */
.checkout-realizado-box {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.checkout-realizado-box .checkout-realizado-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--refugio-verde-suave);
    border: 1px solid rgba(26, 77, 46, 0.2);
    border-radius: var(--radio);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.checkout-realizado-label:hover {
    background: rgba(26, 77, 46, 0.08);
    border-color: rgba(26, 77, 46, 0.3);
}

/* El checkbox no debe heredar estilos de .form-group input */
.checkout-realizado-box .checkout-realizado-input {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--borde);
    border-radius: 4px;
    accent-color: var(--refugio-verde);
    cursor: pointer;
    flex-shrink: 0;
    background-color: var(--fondo);
}

.checkout-realizado-texto {
    font-weight: 600;
    color: var(--refugio-verde);
    font-size: 1rem;
    white-space: nowrap;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-actions-inline .submit-button,
.form-actions-inline .cancel-button {
    flex: none;
}

/* Lista búsqueda clientes/estadías (agregar_estadia, ingreso_pago): botón siempre a la derecha y a la misma altura */
.lista-clientes-busqueda {
    list-style: none;
    padding: 0;
}

.lista-clientes-busqueda-item {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    background: #f5f5f5;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.lista-clientes-busqueda-datos {
    flex: 1 1 0%;
    min-width: 0;
}

.lista-clientes-busqueda-btn {
    flex: 0 0 auto;
}

/* ========== Resumen precios vigentes (administrar_precios) ========== */
.resumen-precios-vigentes {
    background: linear-gradient(145deg, #f8faf8 0%, var(--refugio-verde-suave) 100%);
    border: 1px solid rgba(26, 77, 46, 0.2);
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 2px 12px rgba(26, 77, 46, 0.06);
}

.resumen-precios-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--refugio-verde);
    margin: 0 0 0.35rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(26, 77, 46, 0.2);
    letter-spacing: 0.02em;
}

.resumen-precios-fecha {
    font-size: 0.9rem;
    color: var(--texto-muted);
    margin: 0 0 1rem 0;
}

.resumen-precios-grid {
    display: grid;
    gap: 0.5rem 1.5rem;
    grid-template-columns: 1fr auto;
    align-items: baseline;
}

.resumen-precios-fila {
    display: contents;
}

.resumen-precios-etiqueta {
    font-size: 0.95rem;
    color: var(--texto-muted);
}

.resumen-precios-valor {
    font-size: 1rem;
    font-weight: 600;
    color: var(--refugio-verde);
    font-variant-numeric: tabular-nums;
}

/* ========== Resumen de estadía (ver_estadia) ========== */
.resumen-estadia {
    background: linear-gradient(145deg, #f8faf8 0%, var(--refugio-verde-suave) 100%);
    border: 1px solid rgba(26, 77, 46, 0.2);
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 2px 12px rgba(26, 77, 46, 0.06);
}

.resumen-estadia-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--refugio-verde);
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(26, 77, 46, 0.2);
    letter-spacing: 0.02em;
}

.resumen-estadia-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.resumen-estadia-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.resumen-estadia-fila {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.75rem;
    align-items: baseline;
    line-height: 1.4;
}

.resumen-estadia-etiqueta {
    font-size: 0.9rem;
    color: var(--texto-muted);
    font-weight: 500;
}

.resumen-estadia-valor {
    font-size: 1rem;
    color: var(--texto);
}

.resumen-estadia-monto {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.resumen-estadia-caja-cobro {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid rgba(26, 77, 46, 0.15);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.resumen-estadia-cobro .resumen-estadia-fila {
    grid-template-columns: 1fr auto;
}

.resumen-estadia-nota {
    font-size: 0.8rem;
    color: var(--texto-muted);
    margin: -0.25rem 0 0.5rem 0;
}

.resumen-estadia-deuda {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.resumen-deuda-pendiente {
    color: #c0392b;
    font-weight: 700;
}

.resumen-deuda-cero {
    color: #27ae60;
    font-weight: 600;
}

.estado-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.estado-activo {
    background: rgba(26, 77, 46, 0.15);
    color: var(--refugio-verde);
}

.estado-checkout {
    background: rgba(39, 174, 96, 0.2);
    color: #1e7b3d;
}

.resumen-estadia-valor .dias-extras {
    color: #c0392b;
    font-weight: 600;
    font-size: 0.9rem;
}

.resumen-fecha-checkout {
    color: var(--texto-muted);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .resumen-estadia-grid {
        grid-template-columns: 1fr;
    }
    .resumen-estadia-fila {
        grid-template-columns: 120px 1fr;
    }
}

.submit-button {
    flex: 1;
    min-width: 120px;
    background-color: var(--refugio-verde);
    color: white;
    padding: 0.9rem 1rem;
    border: none;
    border-radius: var(--radio);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-button:hover {
    background-color: var(--refugio-verde-claro);
}

.cancel-button {
    flex: 1;
    min-width: 120px;
    background-color: #f0f0f0;
    color: var(--texto);
    padding: 0.9rem 1rem;
    border: none;
    border-radius: var(--radio);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s;
}

.cancel-button:hover {
    background-color: #e0e0e0;
}

/* Tipo ingreso (vehículo / motorhome / caminando) */
.tipo-ingreso-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    justify-content: space-between;
}

.tipo-ingreso-option {
    cursor: pointer;
    flex: 1 1 30%;
    min-width: 0;
}

.tipo-ingreso-option input[type="radio"] {
    display: none;
}

.option-box {
    background-color: var(--refugio-verde-suave);
    color: var(--refugio-verde);
    padding: 1rem;
    border-radius: var(--radio);
    border: 2px solid rgba(26, 77, 46, 0.25);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    min-height: 100px;
    justify-content: center;
}

.option-box:hover {
    border-color: rgba(26, 77, 46, 0.5);
    background-color: rgba(26, 77, 46, 0.08);
    transform: translateY(-2px);
}

.tipo-ingreso-option input[type="radio"]:checked + .option-box {
    background-color: var(--refugio-verde);
    color: white;
    border-color: var(--refugio-verde);
    box-shadow: 0 0 0 3px rgba(26, 77, 46, 0.4), 0 4px 12px rgba(26, 77, 46, 0.3);
    font-weight: 600;
}

.option-icon {
    font-size: 2rem;
}

/* Mensajes */
.mensaje {
    padding: 1rem;
    border-radius: var(--radio);
    margin-bottom: 1rem;
    font-weight: 500;
}

.mensaje.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mensaje.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.mensaje.info {
    background-color: #e7f3ff;
    color: #0c5460;
    border: 1px solid #b8daff;
}

/* Tablas */
.clientes-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.clientes-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    background-color: white;
    border-radius: var(--radio);
    overflow: hidden;
    box-shadow: var(--sombra);
}

.clientes-table thead {
    background-color: var(--refugio-verde);
    color: white;
}

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

.clientes-table .sort-indicator {
    margin-left: 4px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
}

.clientes-table th {
    font-weight: 600;
    font-size: 0.9rem;
}

.clientes-table tbody tr:hover {
    background-color: var(--refugio-verde-suave);
}

.clientes-table tbody tr:last-child td {
    border-bottom: none;
}

.clientes-table a {
    color: var(--refugio-verde);
    text-decoration: none;
}

.clientes-table a:hover {
    text-decoration: underline;
}

.no-data {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--texto-muted);
    font-size: 1rem;
}

/* ========== Login (misma identidad visual) ========== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(180deg, var(--fondo) 0%, var(--refugio-verde-suave) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: var(--radio);
    box-shadow: 0 4px 20px rgba(26, 77, 46, 0.12);
    border: 1px solid var(--borde);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header .logo-container {
    margin-bottom: 0.25rem;
}

.login-header .header-logo {
    max-height: 52px;
}

.login-header .logo-text-fallback {
    font-size: 1.5rem;
}

.login-form input {
    width: 100%;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    font-size: 1rem;
}

.login-form input:focus {
    outline: none;
    border-color: var(--refugio-verde);
}

.login-button {
    width: 100%;
    padding: 0.9rem;
    background-color: var(--refugio-verde);
    color: white;
    border: none;
    border-radius: var(--radio);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 0.5rem;
}

.login-button:hover {
    background-color: var(--refugio-verde-claro);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .header {
        padding: 0.9rem 1rem;
    }

    .header-logo {
        max-height: 48px;
        max-width: 180px;
    }

    .logo-text-fallback {
        font-size: 1.35rem;
    }

    .main-container {
        padding: 1rem;
    }

    .main-container.full-width {
        padding: 0.75rem;
    }

    .clientes-table {
        font-size: 0.9rem;
    }

    .clientes-table th,
    .clientes-table td {
        padding: 0.6rem;
    }

    .tipo-ingreso-option {
        flex: 1 1 100%;
    }

    .option-box {
        min-height: 88px;
    }
}

@media (max-width: 480px) {
    :root {
        --radio: 6px;
    }

    .header-logo {
        max-height: 44px;
        max-width: 160px;
    }

    .logo-text-fallback {
        font-size: 1.25rem;
    }

    .menu-button {
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
        min-height: 48px;
    }

    .button-icon {
        font-size: 1.35rem;
    }

    .form-title {
        font-size: 1.2rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .submit-button,
    .cancel-button {
        width: 100%;
        min-width: 0;
    }

    .login-container {
        padding: 1.5rem;
    }
}
