/* ============================================================================
   MÓDULO SGSST - Estilos para el Dashboard
   Ubicación: /css/sgsst.css
   ============================================================================ */

/* --- Sección Principal SGSST --- */
.sgsst-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%);
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.sgsst-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #166534;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #86efac;
}

.sgsst-title i {
    font-size: 1.5rem;
    color: #22c55e;
}

.sgsst-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    margin-left: auto;
    min-width: 1.5rem;
    text-align: center;
}

/* --- Estado de Carga --- */
.sgsst-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
}

.sgsst-loading i {
    font-size: 2rem;
    color: #22c55e;
    margin-bottom: 1rem;
}

/* --- Grid de Tarjetas SGSST --- */
.sgsst-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .sgsst-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .sgsst-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Tarjeta SGSST Individual --- */
.sgsst-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.sgsst-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sgsst-card.clickable {
    cursor: pointer;
}

.sgsst-card.clickable:hover {
    border-color: #22c55e;
}

/* Íconos de tarjeta */
.sgsst-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sgsst-card-icon i {
    font-size: 1.5rem;
    color: white;
}

.sgsst-card-icon.examen {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
}

.sgsst-card-icon.capacitacion {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.sgsst-card-icon.reinduccion {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.sgsst-card-icon.autoreporte {
    background: linear-gradient(135deg, #22c55e, #10b981);
}

/* Contenido de tarjeta */
.sgsst-card-content {
    flex: 1;
    min-width: 0;
}

.sgsst-card-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.sgsst-card-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.sgsst-card-status .status-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.sgsst-card-status .status-value {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

/* Estados de color */
.status-value.vigente, .status-value.ok {
    background: #dcfce7;
    color: #166534;
}

.status-value.proximo, .status-value.proxima {
    background: #fef3c7;
    color: #92400e;
}

.status-value.vencido, .status-value.vencida {
    background: #fee2e2;
    color: #991b1b;
}

.status-value.sin_vencimiento, .status-value.sin_programar {
    background: #f3f4f6;
    color: #6b7280;
}

/* Badge de concepto médico */
.concepto-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.concepto-badge.apto {
    background: #dcfce7;
    color: #166534;
}

.concepto-badge.apto-restricciones {
    background: #fef3c7;
    color: #92400e;
}

.concepto-badge.no-apto {
    background: #fee2e2;
    color: #991b1b;
}

.sgsst-card-detail {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.sgsst-card-next {
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.sgsst-card-next i {
    font-size: 0.7rem;
}

.sgsst-card-big-number {
    font-size: 2rem;
    font-weight: 700;
    color: #22c55e;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.sgsst-card-action {
    font-size: 0.8rem;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* --- Barra de Progreso SGSST --- */
.sgsst-progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sgsst-progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.sgsst-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.sgsst-progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #f97316);
}

.sgsst-progress-fill.danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.sgsst-progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    min-width: 35px;
    text-align: right;
}

/* --- Sección de Alertas --- */
.sgsst-alerts-container {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.sgsst-alerts-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem 0;
}

.sgsst-alerts-title i {
    color: #ef4444;
}

.sgsst-alerts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sgsst-alerts-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #fecaca;
    font-size: 0.85rem;
}

.sgsst-alerts-list li:last-child {
    border-bottom: none;
}

.sgsst-alerts-list .alert-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sgsst-alerts-list .alert-priority.critica {
    background: #dc2626;
    box-shadow: 0 0 8px #dc2626;
}

.sgsst-alerts-list .alert-priority.alta {
    background: #f97316;
}

.sgsst-alerts-list .alert-priority.media {
    background: #f59e0b;
}

.sgsst-alerts-list .alert-priority.baja {
    background: #6b7280;
}

.sgsst-alerts-list .alert-text {
    flex: 1;
    color: #7f1d1d;
}

.sgsst-alerts-list .alert-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* --- Estados Vacíos --- */
.sgsst-empty, .sgsst-not-installed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: #6b7280;
}

.sgsst-empty i, .sgsst-not-installed i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.sgsst-empty h4, .sgsst-not-installed h4 {
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.sgsst-empty p, .sgsst-not-installed p {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
}

.sgsst-empty-hint {
    font-size: 0.8rem;
    color: #9ca3af;
    font-style: italic;
}

/* --- Modal Autoreporte --- */
.sgsst-modal {
    max-width: 550px;
}

.sgsst-modal .modal-header {
    background: linear-gradient(135deg, #22c55e, #10b981);
    color: white;
}

.sgsst-modal .modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sgsst-modal .modal-header h3 i {
    font-size: 1.25rem;
}

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

.sgsst-modal .form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.sgsst-modal .form-group input,
.sgsst-modal .form-group select,
.sgsst-modal .form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sgsst-modal .form-group input:focus,
.sgsst-modal .form-group select:focus,
.sgsst-modal .form-group textarea:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.sgsst-modal .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.sgsst-modal .checkbox-group input[type="checkbox"] {
    width: auto;
}

.sgsst-modal .form-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-left: 1.5rem;
}

.sgsst-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* --- Botones SGSST --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #22c55e;
    color: white;
}

.btn-primary:hover {
    background: #16a34a;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* --- Overlay Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    color: inherit;
    line-height: 1;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
}

/* --- Responsive Ajustes --- */
@media (max-width: 768px) {
    .sgsst-section {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .sgsst-card {
        padding: 1rem;
    }
    
    .sgsst-card-icon {
        width: 40px;
        height: 40px;
    }
    
    .sgsst-card-icon i {
        font-size: 1.25rem;
    }
    
    .sgsst-modal {
        max-width: 100%;
    }
}

/* Grid para documentos */
.docs-legal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.doc-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

/* Estado Cargado (Verde) */
.doc-card.uploaded {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.doc-card.uploaded .doc-icon {
    color: #16a34a;
    background: #dcfce7;
}

.doc-icon {
    font-size: 24px;
    width: 50px;
    height: 50px;
    background: #e2e8f0;
    color: #64748b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.doc-info h4 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    color: #334155;
}

.doc-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 8px;
}
.badge-secondary { background: #e2e8f0; color: #64748b; }
.badge-success { background: #dcfce7; color: #166534; }

.doc-actions {
    display: flex;
    gap: 5px;
}

.file-hidden { display: none; }

.btn-upload, .btn-view {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-upload { background: #3b82f6; color: white; }
.btn-upload:hover { background: #2563eb; }

.btn-view { background: #fff; border: 1px solid #cbd5e1; color: #475569; }
.btn-view:hover { background: #f1f5f9; }