/* ==========================================================================
   ESTILOS BASE
   ========================================================================== */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #f4f7f6; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    margin: 0; 
    padding: 20px; 
    box-sizing: border-box;
}

.card { 
    background: white; 
    padding: 40px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    width: 100%; 
    max-width: 400px; 
    text-align: center; 
}

.logo { 
    font-size: 24px; 
    font-weight: bold; 
    color: #003366; 
    margin-bottom: 5px; 
}

.subtitle { 
    color: #17a2b8; 
    font-size: 14px; 
    margin-bottom: 30px; 
    letter-spacing: 2px; 
    text-transform: uppercase; 
}

/* ==========================================================================
   FORMULARIOS Y BOTONES
   ========================================================================== */
.form-group { margin-bottom: 20px; text-align: left; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; font-size: 14px; }
input, select { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; font-size: 15px; }

button { 
    width: 100%; 
    padding: 14px; 
    background-color: #007bff; 
    color: white; 
    border: none; 
    border-radius: 6px; 
    font-size: 16px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: background 0.3s; 
}
button:hover { background-color: #0056b3; }

.btn-teal { background-color: #17a2b8; }
.btn-teal:hover { background-color: #117a8b; }

.hidden { display: none !important; }
.error { color: #dc3545; font-size: 14px; margin-top: 10px; display: none; }

/* ==========================================================================
   DASHBOARD PRINCIPAL
   ========================================================================== */
.dashboard-container { width: 100%; max-width: 900px; display: none; }

.header-dash { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px; 
    background: white; 
    padding: 15px 20px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
}

.user-info { font-weight: bold; color: #003366; }
.btn-logout { background-color: #dc3545; padding: 8px 15px; font-size: 14px; width: auto; }

.grid-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.btn-menu { padding: 30px 20px; font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); color: white;}

.btn-clientes { background-color: #4CAF50; } .btn-clientes:hover { background-color: #45a049; }
.btn-reservas { background-color: #2196F3; } .btn-reservas:hover { background-color: #1e88e5; }
.btn-calendario { background-color: #9C27B0; } .btn-calendario:hover { background-color: #8e24aa; }
.btn-barcos { background-color: #FF9800; } .btn-barcos:hover { background-color: #fb8c00; }
.btn-personal { background-color: #607D8B; } .btn-personal:hover { background-color: #546e7a; }
.btn-averias { background-color: #F44336; } .btn-averias:hover { background-color: #e53935; }
.btn-caja { background-color: #0d6efd; } .btn-caja:hover { background-color: #0b5ed7; }

/* ==========================================================================
   MÓDULOS Y TABLAS
   ========================================================================== */
.panel-modulo { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; text-align: left; }
th { background-color: #f8f9fa; padding: 12px; border-bottom: 2px solid #dee2e6; color: #333; }
td { padding: 12px; border-bottom: 1px solid #eee; color: #555; }
tr:hover { background-color: #f1f7fd; }

.btn-accion { padding: 6px 10px; font-size: 13px; border-radius: 4px; border: none; cursor: pointer; color: white; margin-right: 5px; width: auto; }
.btn-editar { background-color: #ffc107; color: #000; }
.btn-volver { background-color: #6c757d; color: white; padding: 8px 15px; border-radius: 6px; border: none; cursor: pointer; width: auto;}
.etiqueta-roja { background: #dc3545; color: white; padding: 3px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; }

/* ==========================================================================
   MODALES (VENTANAS EMERGENTES)
   ========================================================================== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: 0 5px 20px rgba(0,0,0,0.2); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 2px solid #eee; padding-bottom: 10px; }
.modal-header h3 { margin: 0; color: #003366; }

.btn-cerrar { background: none; border: none; font-size: 24px; cursor: pointer; color: #999; width: auto; padding: 0;}
.btn-cerrar:hover { color: #333; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full-width { grid-column: 1 / -1; }

.checkbox-group { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; background: #fff3cd; border-radius: 6px; border: 1px solid #ffeeba; }
.checkbox-group input { width: auto; transform: scale(1.5); cursor: pointer; }

/* Corrección elástica para ventanas modales en móvil */
div[id^="modal"] > div {
    width: 95% !important;
    max-width: 800px !important;
    margin: 5% auto !important;
    box-sizing: border-box !important;
}

/* Evita que los formularios se salgan de la pantalla y previene el zoom en iOS */
div[id^="modal"] input, 
div[id^="modal"] select, 
div[id^="modal"] textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important; 
}

/* ==========================================================================
   MODO IMPRESIÓN CONTRATO
   ========================================================================== */
@media print {
    body * { 
        visibility: hidden; 
    }
    #zonaContratoImprimible, #zonaContratoImprimible * { 
        visibility: visible; 
    }
    #zonaContratoImprimible { 
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%; 
        color: black; 
        background: white; 
    }
    .hide-on-print { 
        display: none !important; 
    }
}

/* ==========================================================================
   AJUSTES AGRESIVOS DE FULLCALENDAR PARA MÓVILES (UX)
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Forzar que la barra principal se divida en filas apiladas */
    .fc .fc-toolbar.fc-header-toolbar {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        margin-bottom: 15px !important;
    }

    /* 2. Cada bloque (navegación, título, vistas) debe ocupar el 100% y centrarse */
    .fc .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
    }

    /* 3. Reducir el tamaño de la fuente del título y obligarlo a estar en una línea */
    .fc .fc-toolbar-title {
        font-size: 1.15rem !important;
        text-align: center !important;
        white-space: nowrap !important; 
    }

    /* 4. Hacer los botones un poco más compactos */
    .fc .fc-button {
        padding: 0.4em 0.8em !important;
        font-size: 0.85em !important;
    }
}