/* Estilos generales para el sistema de alquiler */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
    padding-top: 120px; /* Espacio para el header sticky */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content h1 {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #88b841;
    padding-bottom: 10px;
}

/* Header y navegación */
.menu {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    border-radius: 0; /* Sin radius para que ocupe todo el ancho */
    position: fixed; /* Cambiado a fixed para que no dependa del scroll del container */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.menu-header h2 {
    color: #ecf0f1;
    margin: 0;
    font-size: 1.2rem;
}

.menu-header h2 a.header-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.menu-header h2 a.header-link:hover {
    color: #88b841;
}

.user-info {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.user-info a {
    color: #e74c3c;
    text-decoration: none;
    margin-left: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-info a:hover {
    text-decoration: underline;
}

.user-info > .fa-user {
    margin-right: 8px;
}

.menu-items {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
    max-width: 1200px;
    margin: 1rem auto 0 auto;
    padding: 0 20px;
}

.menu-items li a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 8px 12px;
    background-color: #34495e;
    border-radius: 3px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px; /* Espacio entre icono y texto */
    font-size: 0.9rem;
}

.menu-items li a:hover {
    background-color: #88b841;
}

/* Estado cuando un item del menú está activo (clase .active) */
.menu-items li a.active {
    background-color: #88b841;
    color: #ffffff;
}

/* Asegura que el estado activo se mantenga también en hover */
.menu-items li a.active:hover {
    background-color: #88b841;
}

.mobile-logout {
    display: none;
}

.menu-toggle {
    display: none; /* Oculto en desktop */
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Formularios */
.form-container {
    background-color: white;
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Grid para página de configuración: campos y vista previa del logo */

.config-grid {
    display: grid;
    grid-template-columns: 1fr 220px; /* campos | panel de logo (más estrecho) */
    gap: 18px;
    align-items: start;
}

.config-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en escritorio */
    gap: 14px;
}

.config-fields .form-group {
    margin-bottom: 0; /* el gap del grid maneja el espacio */
}

.config-fields .full-width {
    grid-column: 1 / -1; /* elemento ocupa todas las columnas */
}

.config-preview {
    background: #fbfbfb;
    border: 1px solid #ececec;
    padding: 18px;
    border-radius: 6px;
    text-align: center;
}

.config-preview .preview-logo {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto 12px auto;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    background: white;
    padding: 6px;
}

.config-preview .business-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
}

.config-preview .logo-actions {
    margin-top: 12px;
}

/* Botón guardar centrado y ocupando toda la fila cuando es full-width */
.form-actions {
    grid-column: 1 / -1;
    margin-top: 18px;
}

@media (max-width: 1000px) {
    .config-grid {
        grid-template-columns: 1fr 200px;
    }
    .config-fields {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .config-grid {
        grid-template-columns: 1fr; /* panel abajo en móvil */
    }
    .config-fields {
        grid-template-columns: 1fr; /* una columna */
    }
    .form-actions {
        grid-column: auto;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 16px;
}

.form-group textarea {
    height: 80px;
    resize: vertical;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #88b841;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #88b841;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-info {
    background-color: #88b841;
    color: #ffffff;
}

.btn-info:hover {
    background-color: #229954;
}

.btn-small {
    padding: 5px 10px;
    font-size: 14px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Tablas */
.table-container {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #34495e;
    color: white;
    font-weight: bold;
}

table tr:hover {
    background-color: #f8f9fa;
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 1.1em;
}

.stat-card.blue .stat-number {
    color: #88b841;
}

.stat-card.green .stat-number {
    color: #88b841;
}

.stat-card.orange .stat-number {
    color: #f39c12;
}

.stat-card.red .stat-number {
    color: #e74c3c;
}

/* Nuevos estilos para las tablas del dashboard */
.dashboard-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

/* Fix para que el scroll funcione dentro del grid */
.dashboard-tables-grid .table-container {
    min-width: 0;
}

@media (max-width: 768px) {
    .dashboard-tables-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Table Cards */
.stat-table-card {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow: hidden;
    display: block; /* Cambiado de flex a block para mayor compatibilidad */
}

.stat-table-card .card-header {
    display: block;
    width: 100%;
    padding: 20px;
    margin: 0;
    color: white;
    font-size: 1.17em;
    font-weight: bold;
    box-sizing: border-box;
}

.stat-table-card .card-header.red {
    background-color: #e74c3c;
}

.stat-table-card .card-header.green {
    background-color: #88b841;
}

.stat-table-card .table-scroll {
    display: block;
    overflow-x: auto;
    width: 100%;
}

/* Mensajes */
.mensaje {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: bold;
}

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

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

.mensaje.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Estados */
.estado {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.estado.disponible {
    background-color: #d4edda;
    color: #155724;
}

.estado.alquilada {
    background-color: #fff3cd;
    color: #856404;
}

.estado.mantenimiento {
    background-color: #f8d7da;
    color: #721c24;
}

.estado.activo {
    background-color: #d4edda;
    color: #155724;
}

.estado.finalizado {
    background-color: #e2e3e5;
    color: #383d41;
}

.estado.suspendido {
    background-color: #f8d7da;
    color: #721c24;
}

.estado.pagado {
    background-color: #d4edda;
    color: #155724;
}

.estado.pendiente {
    background-color: #fff3cd;
    color: #856404;
}

/* PWA Install Banner */
#install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #2c3e50;
    color: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    display: none; /* Hidden by default */
}

.install-banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.install-banner-content span {
    font-weight: bold;
    margin-right: 10px;
}

@media (max-width: 768px) {
    .install-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background-color: white;
    padding: 40px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

/* Estilos para comprobante de pago */
.comprobante-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

@media print {
    @page {
        margin: 2cm;
    }
    body {
        padding-top: 0; /* Quitar padding en impresión */
    }
    body * { 
        visibility: hidden; 
    }
    .comprobante, .comprobante * { 
        visibility: visible; 
    }
    .comprobante { 
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%; 
        padding: 0 1cm;
        box-sizing: border-box;
    }
    .no-print { 
        display: none !important; 
    }
    .menu {
        display: none !important;
    }
}

.comprobante-header {
    text-align: center;
    border-bottom: 3px solid #2c3e50;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.comprobante-title {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.comprobante-subtitle {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.comprobante-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.info-section h3 {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #88b841;
    padding-bottom: 5px;
}

.info-row {
    margin-bottom: 10px;
    padding: 5px 0;
}

.info-label {
    font-weight: bold;
    color: #34495e;
    display: inline-block;
    min-width: 120px;
}

.info-value {
    color: #2c3e50;
}

.pago-detalle {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
}

.pago-detalle h3 {
    text-align: center;
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #88b841;
    padding-bottom: 10px;
}

.monto-total {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    color: #88b841;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    padding: 15px;
    background-color: white;
    border-radius: 5px;
    border: 2px solid #88b841;
}

.comprobante-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.5;
}

.comprobante-numero {
    background-color: #88b841;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    display: inline-block;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.pagination a {
    padding: 8px 12px;
    margin: 0 4px;
    text-decoration: none;
    background-color: white;
    color: #2c3e50;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.pagination a:hover {
    background-color: #88b841;
    color: white;
}

.pagination a.active {
    background-color: #2c3e50;
    color: white;
}

/* Filtros */
.filters {
    border: 1px solid #ccc;
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.filters .form-group {
    display: inline-block;
    width: auto;
    margin-right: 20px;
    margin-bottom: 10px;
}

.filters .form-group input,
.filters .form-group select {
    width: 200px;
}

.filters .btn {
    vertical-align: bottom;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}
.filter-tab {
    padding: 10px 20px;
    text-decoration: none;
    color: #34495e;
    font-weight: bold;
    border-radius: 5px 5px 0 0;
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-bottom: none;
    position: relative;
    top: 2px;
}
.filter-tab.active {
    background-color: white;
    border-bottom: 2px solid white;
    color: #88b841;
}
.filter-form {
    padding-top: 20px;
}


/* --- ESTILOS RESPONSIVE PARA EL MENÚ --- */

/* Estilos para Grid de Formularios (Reemplaza estilos inline de contratos.php) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 20px;
}

.form-group.full {
    grid-column: 1 / -1;
}

/* Estilos para Modales Responsivos */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    padding: 20px;
    overflow-y: auto; /* Permite scroll si el modal es muy alto */
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    margin: 50px auto;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
}

/* Para pantallas de 992px o menos */
@media (max-width: 992px) {
    .menu-items li a span {
        display: none; /* Ocultar texto y mostrar solo iconos */
    }
    .menu-items li a {
        padding: 10px;
    }
    .user-info span {
        display: none;
    }

    /* Grid de formularios a 1 columna en móvil */
    .form-grid {
        grid-template-columns: 1fr;
        grid-gap: 15px;
    }
    
    /* Modales en móvil */
    .modal-content {
        margin: 20px auto;
        padding: 20px;
        width: 100%;
    }
}

/* Para pantallas de 768px o menos (móviles) */
@media (max-width: 768px) {
    body {
        padding-top: 60px; /* Ajustar al alto del header móvil */
    }

    .menu {
        padding: 0.5rem;
    }

    .menu-header {
        padding: 0 10px;
    }

    .menu-toggle {
        display: block; /* Mostrar el botón de hamburguesa */
    }

    .menu-items {
        display: none; /* Ocultar el menú de escritorio */
        flex-direction: column;
        width: 100%;
        background-color: #34495e;
        position: absolute;
        top: 100%;
        left: 0;
        margin: 0;
        padding: 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }

    .menu.is-open .menu-items {
        display: flex; /* Mostrar el menú cuando está abierto */
    }

    .menu-items li {
        width: 100%;
    }

    .menu-items li a {
        padding: 15px;
        justify-content: flex-start;
        border-radius: 0;
        border-bottom: 1px solid #4a627a;
    }

    .menu-items li a span {
        display: inline; /* Mostrar el texto en el menú desplegable */
    }

    .mobile-logout {
        display: block;
    }
    
    .user-info {
        display: none; /* Opcional: ocultar info de usuario en la barra principal */
    }

    .container {
        padding: 10px;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px 10px;
    }

    .stat-number {
        font-size: 2em;
        margin-bottom: 5px;
    }

    .stat-label {
        font-size: 0.9em;
        line-height: 1.2;
    }
    
    table {
        font-size: 14px;
    }

    /* Responsive para comprobante */
    .comprobante-container {
        padding: 20px;
        margin: 10px;
    }
    
    .comprobante-info {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .comprobante-title {
        font-size: 24px;
    }
    
    .monto-total {
        font-size: 28px;
    }

    /* --- MEJORAS GENERALES PARA MÓVILES (FILTROS Y TABLAS) --- */
    
    /* Filtros apilados y ancho completo */
    .filters {
        padding: 15px;
    }

    .filters form {
        display: flex;
        flex-direction: column;
    }

    .filters .form-group {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .filters .form-group input,
    .filters .form-group select {
        width: 100% !important; /* Forzar ancho completo */
        height: 45px; /* Mayor altura para toque táctil */
    }
    
    .filters .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        padding: 12px; /* Botones más altos */
    }

    /* Botones de acción en tablas más compactos */
    table td .btn {
        display: inline-block;
        margin-bottom: 5px;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Formularios de edición/creación */
    .form-container {
        padding: 20px 15px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Evita zoom automático en iOS */
    }

    /* Botones de formulario full width */
    .form-container .btn {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        text-align: center;
    }

    /* Ajuste de títulos */
    .main-content h1 {
        font-size: 1.4rem;
        flex-wrap: wrap;
    }
}

/* --- ESTILOS PÁGINA PÚBLICA DE CONSULTA --- */
.public-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

.public-header {
    text-align: center;
    margin-bottom: 30px;
}

.business-logo {
    /* Aumentado ligeramente para que el logo se vea más grande */
    max-width: 200px;
    max-height: 200px;
    margin-bottom: 20px;
}

.public-header h1 {
    border-bottom: none;
    justify-content: center;
}

.public-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.public-form {
    max-width: 500px;
    margin: 0 auto 30px auto;
}

.results-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.payment-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.payment-card {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-left: 5px solid #88b841;
}

.payment-card .card-header {
    background-color: #f8f9fa;
    padding: 10px 15px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    border-radius: 5px 5px 0 0;
}

.payment-card .card-body {
    padding: 15px;
}

.payment-card .card-body p {
    margin-bottom: 10px;
}

.payment-card .card-body .text-muted {
    color: #7f8c8d;
    font-style: italic;
}

.payment-card .estado.pagado {
    border-left-color: #88b841;
}

.payment-card .estado.atrasado {
    border-left-color: #e74c3c;
}

.payment-card .estado.pendiente {
    border-left-color: #f39c12;
}

/* ============================================
   MODAL DE CONFIRMACIÓN DE PAGO
   ============================================ */

/* Overlay del modal */
.modal-pago-overlay {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.modal-pago-overlay.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* Contenedor del modal */
.modal-container {
    background: white;
    border-radius: 12px;
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-pago-overlay.active .modal-container {
    transform: scale(1);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Header del modal */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #88b841;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    font-size: 1.5rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Body del modal */
.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Alerta de mora */
.modal-alerta {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.1);
}

.modal-alerta i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Loader */
.modal-loader {
    text-align: center;
    padding: 30px;
    color: #7f8c8d;
    font-size: 1.1rem;
}

.modal-loader i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* Detalle del pago */
.modal-detalle {
    margin-bottom: 20px;
}

.detalle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.detalle-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.detalle-label {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detalle-label i {
    color: #88b841;
    font-size: 1.2rem;
}

.detalle-valor {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Item de mora */
.detalle-item.detalle-mora {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border-left: 4px solid #e74c3c;
}

.detalle-item.detalle-mora .detalle-label {
    color: #c0392b;
}

.detalle-item.detalle-mora .detalle-label i {
    color: #e74c3c;
}

.detalle-item.detalle-mora .detalle-valor {
    color: #e74c3c;
}

/* Info adicional */
.detalle-info {
    background: #e8f5e9;
    border-left: 4px solid #88b841;
    color: #2d5016;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.detalle-info i {
    color: #88b841;
    font-size: 1.2rem;
}

/* Resumen total */
.modal-resumen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.resumen-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.resumen-label {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.resumen-valor {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Footer del modal */
.modal-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #dee2e6;
}

.modal-footer .btn {
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-footer .btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
}

.modal-footer .btn-secondary:hover {
    background: #5a6268;
}

.modal-footer .btn-success {
    background: #88b841;
    color: white;
    border: none;
}

.modal-footer .btn-success:hover {
    background: #6d9334;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .detalle-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .detalle-valor {
        font-size: 1.4rem;
        align-self: flex-end;
    }
    
    .resumen-total {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal-container {
        border-radius: 0;
        max-height: 100vh;
        width: 100%;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .resumen-valor {
        font-size: 1.8rem;
    }
}
/* Estilos para formulario de viviendas con im�genes */
.form-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.form-column {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-column h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #88b841;
    font-size: 1.1rem;
}

/* Galer�a de im�genes existentes */
.imagenes-existentes {
    margin-bottom: 20px;
}

.galeria-imagenes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 15px 0;
}

.imagen-item {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.imagen-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.imagen-item.predeterminada {
    border-color: #88b841;
    box-shadow: 0 0 10px rgba(136, 184, 65, 0.3);
}

.imagen-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.badge-predeterminada {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #88b841;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.badge-predeterminada::before {
    content: '';
    font-size: 1rem;
}

.imagen-acciones {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    padding: 8px;
    display: flex;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.imagen-item:hover .imagen-acciones {
    opacity: 1;
}

.imagen-acciones .btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
}

.info-imagenes {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 10px;
    font-style: italic;
}

/* Preview de im�genes nuevas */
.preview-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 15px 0;
}

.preview-item {
    position: relative;
    border: 2px dashed #88b841;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.preview-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.preview-nombre {
    display: block;
    padding: 8px;
    background: rgba(255,255,255,0.95);
    font-size: 0.8rem;
    color: #555;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Input de archivo personalizado */
input[type='file'] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type='file']:hover {
    border-color: #88b841;
    background: #e8f5e9;
}

input[type='file']::file-selector-button {
    background: #88b841;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    transition: background 0.3s ease;
}

input[type='file']::file-selector-button:hover {
    background: #6d9334;
}

/* Selector de imagen predeterminada */
#selector-predeterminada {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #88b841;
}

#selector-predeterminada label {
    color: #2c3e50;
    font-weight: bold;
}

#imagen_predeterminada {
    width: 100%;
    padding: 10px;
    border: 1px solid #88b841;
    border-radius: 4px;
    background: white;
    margin-top: 5px;
}

/* Mensajes informativos */
.mensaje.info {
    background: #e3f2fd;
    color: #1976d2;
    border-left: 4px solid #1976d2;
}

/* Responsive para formulario de dos columnas */
@media (max-width: 992px) {
    .form-two-columns {
        grid-template-columns: 1fr;
    }
    
    .galeria-imagenes,
    .preview-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .galeria-imagenes,
    .preview-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .imagen-acciones {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .galeria-imagenes,
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .form-column {
        padding: 15px;
    }
}

/* Lightbox / Modal para galer�as */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 2010;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 22px;
    cursor: pointer;
    border-radius: 4px;
}

.lightbox-close {
    top: 10px;
    right: 10px;
}

.lightbox-prev {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-caption {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0,0,0,0.5);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        padding: 6px 10px;
        font-size: 18px;
    }
}

/* Ajustes adicionales para lightbox - estilo tipo inmobiliaria */
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 2010;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flechas laterales en cajas grises fuera de la imagen */
.lightbox-arrow-box {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.55);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    z-index: 2020;
}

.lightbox-prev-box { left: 20px; }
.lightbox-next-box { right: 20px; }

.lightbox-arrow-box:hover {
    background: rgba(0,0,0,0.75);
}

/* Botones prev/next ocultos en pantallas peque�as ligeramente */
@media (max-width: 480px) {
    .lightbox-arrow-box { width:40px; height:40px; left:10px; right:10px; }
}

/* Contador en la esquina inferior derecha (ej. 1 of 7) */
.lightbox-counter {
    position: absolute;
    right: 18px;
    bottom: 12px;
    z-index: 2025;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Transici�n de cambio de imagen */
.lightbox-img-fade {
    opacity: 0;
    transition: opacity 260ms ease-in-out;
}

.lightbox-img-fade.show {
    opacity: 1;
}

/* Asegurar close visible peque�o */
.lightbox-close {
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 20px;
    width:36px;
    height:36px;
    border-radius:4px;
}

@media (max-width: 768px) {
    .lightbox-close { width:30px; height:30px; font-size:18px; }
}

/* Forzar centrado robusto del lightbox y límites por viewport */
.lightbox-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px; /* espacio para que no toque los bordes */
}

/* Centrado absoluto del contenido del lightbox para evitar desplazamientos */
.lightbox-content {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 1100px;
    box-sizing: border-box;
    max-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2010;
}

.lightbox-content img {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    margin: 0 auto;
    display: block;
}

/* Si la imagen es muy alta, permitir que el contenido se haga scroll internamente pero mantener centrado */
.lightbox-content .inner-scroll {
    max-height: calc(100vh - 80px);
    overflow: auto;
}

/* Estilo especial para la imagen predeterminada: cuadrada y se vea completa */
.imagen-predeterminada-separada {
    margin-bottom: 16px;
}

.imagen-predeterminada-separada .imagen-item {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16/9; /* ocupa ancho completo y mantiene proporción */
    border-radius: 8px;
    overflow: hidden;
    margin: 0 0 12px 0;
    display: block;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.imagen-predeterminada-separada .imagen-item img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* muestra la imagen completa dentro del bloque */
    background: #f6f6f6;
    display: block;
    cursor: pointer;
}

/* Previews antes de subir también clicables */
.preview-item img {
    cursor: pointer;
}

.imagen-predeterminada-separada p {
    text-align: center;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

@media (max-width: 992px) {
    .imagen-predeterminada-separada .imagen-item {
        aspect-ratio: 4/3;
    }
}

@media (max-width: 576px) {
    .imagen-predeterminada-separada .imagen-item {
        aspect-ratio: 1/1;
    }
}

/* Ajustes adicionales para lightbox - estilo tipo inmobiliaria */
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 2010;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flechas laterales en cajas grises fuera de la imagen */
.lightbox-arrow-box {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.55);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    z-index: 2020;
}

.lightbox-prev-box { left: 20px; }
.lightbox-next-box { right: 20px; }

.lightbox-arrow-box:hover {
    background: rgba(0,0,0,0.75);
}

/* Botones prev/next ocultos en pantallas peque�as ligeramente */
@media (max-width: 480px) {
    .lightbox-arrow-box { width:40px; height:40px; left:10px; right:10px; }
}

/* Contador en la esquina inferior derecha (ej. 1 of 7) */
.lightbox-counter {
    position: absolute;
    right: 18px;
    bottom: 12px;
    z-index: 2025;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Transici�n de cambio de imagen */
.lightbox-img-fade {
    opacity: 0;
    transition: opacity 260ms ease-in-out;
}

.lightbox-img-fade.show {
    opacity: 1;
}

/* Asegurar close visible peque�o */
.lightbox-close {
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 20px;
    width:36px;
    height:36px;
    border-radius:4px;
}

@media (max-width: 768px) {
    .lightbox-close { width:30px; height:30px; font-size:18px; }
}
