/* ========================================
   VARIABLES Y RESET
   ======================================== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #ecf0f1;
    --dark-text: #34495e;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--light-bg);
    min-height: 100vh;
}

/* ========================================
   LOGIN
   ======================================== */
#loginContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 60px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.login-header h2 {
    color: var(--primary-color);
    font-size: 24px;
}

.login-header p {
    color: #7f8c8d;
    font-size: 14px;
    margin-top: 5px;
}

/* ========================================
   COMPONENTES COMUNES
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-text);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn {
    width: 100%;
    padding: 14px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.btn:hover { background: #2980b9; }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-primary:hover { background: #2980b9; }

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-secondary:hover { background: #7f8c8d; }

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-danger:hover { background: #c0392b; }

/* ========================================
   NAVBAR Y MENÚ
   ======================================== */
.navbar {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.logo { font-size: 18px; font-weight: 600; }
.user-info { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.user-info i { font-size: 20px; }

.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.side-menu.open { left: 0; }

.menu-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

.menu-header i { font-size: 50px; margin-bottom: 10px; }
.menu-header h3 { font-size: 16px; font-weight: 400; }
.menu-header small { opacity: 0.8; }

.menu-items { list-style: none; padding: 15px 0; }
.menu-items li {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--dark-text);
}
.menu-items li:hover { background: var(--light-bg); }
.menu-items li i { width: 25px; color: var(--secondary-color); }

.menu-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    z-index: 1000;
}
.menu-overlay.show { display: block; }

/* ========================================
   CONTENIDO PRINCIPAL
   ======================================== */
.main-content {
    margin-top: 70px;
    padding: 20px;
}

.module-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: none;
}

.module-container.active { display: block; }

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}
.module-header h2 { color: var(--primary-color); font-size: 24px; }
.module-header h2 i { color: var(--secondary-color); margin-right: 10px; }

/* ========================================
   DASHBOARD CARDS
   ======================================== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
}

.stat-icon {
    width: 60px; height: 60px;
    background: var(--secondary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
}

.stat-info h3 { font-size: 14px; color: #7f8c8d; margin-bottom: 5px; }
.stat-info p { font-size: 24px; font-weight: 600; color: var(--primary-color); }

/* ========================================
   TABLAS
   ======================================== */
.table-responsive { overflow-x: auto; min-height: 200px; }
#tablaUsuarios { width: 100% !important; margin-top: 10px; }

.dataTables_wrapper { padding: 10px 0; width: 100%; }
.dataTables_length select,
.dataTables_filter input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.dataTables_paginate .paginate_button {
    padding: 8px 12px;
    margin: 0 3px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}
.dataTables_paginate .paginate_button.current {
    background: var(--secondary-color);
    color: white !important;
    border-color: var(--secondary-color);
}
.dataTables_paginate .paginate_button:hover { background: var(--light-bg); }
.dataTables_empty {
    text-align: center;
    padding: 30px !important;
    color: #7f8c8d;
    font-style: italic;
}

/* ========================================
   MODALES
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background-color: white;
    margin: 30px auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    animation: slideDown 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 20px; }
.close { color: white; font-size: 28px; font-weight: bold; cursor: pointer; transition: opacity 0.3s; }
.close:hover { opacity: 0.8; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 20px;
    background: var(--light-bg);
    border-radius: 0 0 10px 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================================
   UTILIDADES
   ======================================== */
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

.badge { padding: 5px 10px; border-radius: 15px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-color); color: white; }
.badge-danger { background: var(--danger-color); color: white; }
.badge-warning { background: var(--warning-color); color: white; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .login-card { padding: 30px 20px; }
    .user-info span { display: none; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .module-header { flex-direction: column; align-items: flex-start; }
    .modal-content { margin: 10px; width: calc(100% - 20px); }
}
@media (max-width: 480px) {
    .dashboard-cards { grid-template-columns: 1fr; }
    .stat-card { padding: 15px; }
}

/* ========================================
   MÓDULO DE INCIDENCIAS (FOTOS)
   ======================================== */
.image-preview-box {
    margin-top: 15px;
    display: none;
    text-align: center;
    border: 2px dashed var(--border-color);
    padding: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.image-preview-box img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 5px;
    box-shadow: var(--shadow);
    object-fit: contain;
}

.image-stats {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dark-text);
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
}

/* ========================================
   CORRECCIÓN DE CAPAS (Z-INDEX)
   ======================================== */
.swal2-container {
    z-index: 9999 !important;
}