/**
 * Estilos Completos para Sistema de Bitácora de Reportes Automáticos - GPS Delonix v5.0
 * CSS profesional para interfaz completa de gestión de reportes diarios
 * 
 * @author GPS Delonix Team
 * @version 5.0
 * @date 2025-11-05
 */

/* Animación de spinner para descarga */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos para notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
}

.notification.warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
}

.notification.info {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
}

/* Estilos para progreso de descarga */
.download-progress {
    background: #e8f5e8;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.progress-bar {
    background: #dee2e6;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    background: linear-gradient(90deg, #28a745, #20c997);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Estilos para filtros avanzados */
.filters-container {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Estilos para configuración */
.config-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.config-section h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

.config-field {
    margin-bottom: 20px;
}

.config-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.config-field input,
.config-field select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.config-field input:focus,
.config-field select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.checkbox-field input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Estilos para grupos de dispositivos */
.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.group-card {
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s;
}

.group-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.group-card label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    cursor: pointer;
}

.group-card small {
    color: #6c757d;
    font-size: 13px;
}

/* Estilos para botones mejorados */
.btn-enhanced {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.btn-enhanced:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.3s, height 0.3s;
    transform: translate(-50%, -50%);
}

.btn-enhanced:hover:before {
    width: 300px;
    height: 300px;
}

.btn-primary-enhanced {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-success-enhanced {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.btn-warning-enhanced {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

.btn-danger-enhanced {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-info-enhanced {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

/* Estilos para tabla mejorada */
.table-enhanced {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-enhanced thead tr {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.table-enhanced th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-enhanced td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    color: #495057;
}

.table-enhanced tbody tr:hover {
    background: #f8f9fa;
}

.table-enhanced tbody tr:last-child td {
    border-bottom: none;
}

/* Estilos para acciones de tabla */
.table-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 70px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.action-btn.download {
    background: #28a745;
    color: white;
}

.action-btn.view {
    background: #007bff;
    color: white;
}

.action-btn.delete {
    background: #dc3545;
    color: white;
}

/* Estilos para panel de estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #007bff;
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.stat-card.success {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #ffffff, #f8fff9);
}

.stat-card.warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #ffffff, #fffcf0);
}

.stat-card.info {
    border-left-color: #17a2b8;
    background: linear-gradient(135deg, #ffffff, #f0fdff);
}

.stat-card.purple {
    border-left-color: #6f42c1;
    background: linear-gradient(135deg, #ffffff, #f8f7ff);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Estilos para centro de descarga */
.download-center {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.download-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .download-options {
        grid-template-columns: 1fr;
    }
}

.download-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.download-section h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.quick-downloads {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.groups-selection {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    background: white;
}

.groups-selection label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    transition: background 0.2s;
}

.groups-selection label:hover {
    background: #f8f9fa;
    padding-left: 10px;
    border-radius: 4px;
}

/* Responsive design */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-downloads {
        flex-direction: column;
    }
    
    .table-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

/* ===============================
   CONTENEDOR PRINCIPAL
   =============================== */

.reports-bitacora {
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.bitacora-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.bitacora-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.bitacora-header i {
    margin-right: 10px;
    color: #3498db;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ===============================
   PANEL DE ESTADO DEL SISTEMA
   =============================== */

.system-status-panel {
    margin-bottom: 30px;
}

.status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.status-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.status-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
}

.status-icon.active {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.status-icon.inactive {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.status-icon:not(.active):not(.inactive) {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.status-content h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-content span {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

/* ===============================
   PANEL DE FILTROS
   =============================== */

.filters-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.filter-group .form-control,
.filter-group select {
    padding: 8px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.filter-group .form-control:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ===============================
   TABLA DE REPORTES
   =============================== */

.reports-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
}

.table-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.table-header .badge {
    background: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

.bulk-actions {
    display: flex;
    gap: 10px;
}

.table-responsive {
    overflow-x: auto;
}

#reportsTable {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

#reportsTable th {
    background: #f8f9fa;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e1e8ed;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#reportsTable td {
    padding: 15px 12px;
    border-bottom: 1px solid #e1e8ed;
    vertical-align: middle;
}

#reportsTable tbody tr:hover {
    background: #f8f9fa;
}

/* ===============================
   ELEMENTOS DE LA TABLA
   =============================== */

.filename-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filename {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #2c3e50;
}

.group-badge {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.status-completed {
    background: #d5edda;
    color: #155724;
}

.status-badge.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.status-processing {
    background: #d1ecf1;
    color: #0c5460;
}

.file-size {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #6c757d;
}

.created-time {
    font-size: 13px;
    color: #6c757d;
}

.report-date {
    font-weight: 500;
    color: #2c3e50;
}

/* ===============================
   BOTONES DE ACCIÓN
   =============================== */

.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons .btn {
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.action-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===============================
   PAGINACIÓN
   =============================== */

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pagination-info {
    color: #6c757d;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#pageInfo {
    font-weight: 500;
    color: #2c3e50;
}

/* ===============================
   MODALES
   =============================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e1e8ed;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e1e8ed;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* ===============================
   FORMULARIOS EN MODALES
   =============================== */

.config-section {
    margin-bottom: 30px;
}

.config-section h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #e1e8ed;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-group .form-control,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group .form-control:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ===============================
   BARRA DE PROGRESO
   =============================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e8ed;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#progressText {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

/* ===============================
   ESTADOS ESPECIALES
   =============================== */

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.loading-spinner i {
    font-size: 24px;
    margin-bottom: 10px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.no-data i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-data p {
    font-size: 16px;
    margin: 0;
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

@media (max-width: 768px) {
    .bitacora-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .status-cards {
        grid-template-columns: 1fr;
    }
    
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .bulk-actions {
        justify-content: center;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .reports-bitacora {
        padding: 10px;
    }
    
    .bitacora-header,
    .filters-panel,
    .reports-table-container,
    .pagination-container {
        padding: 15px;
    }
    
    #reportsTable th,
    #reportsTable td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .status-card {
        padding: 15px;
    }
    
    .status-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* ===============================
   ANIMACIONES
   =============================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.reports-bitacora {
    animation: fadeIn 0.5s ease-out;
}

.status-card {
    animation: fadeIn 0.5s ease-out;
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* ===============================
   UTILIDADES
   =============================== */

.text-center {
    text-align: center;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-primary {
    color: #007bff !important;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-3 {
    margin-top: 1rem;
}

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}