/* contratos.css - Versión Completamente Responsiva con Fondo Blanco */
:root {
    --primary-color: #ffa500;
    --primary-hover: #e69500;
    --text-color: #333;
    --text-light: #666;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --border-color: #ddd;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.dashboard {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 20px;
    width: 100%;
    transition: var(--transition);
    background-color: var(--background-color);
}

.top-bar {
    background-color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.top-bar h1 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-left: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

/* Contenedor principal */
.content {
    width: 100%;
}

.workers-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--box-shadow);
    animation: fadeIn 0.5s ease-out;
    width: 100%;
}

/* Acciones de tabla */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    background-color: white;
}

.search-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.1);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.btn-export {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-export:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Tabla de trabajadores */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.workers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    min-width: 800px; /* Asegura que la tabla no se comprima demasiado */
}

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

.workers-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.workers-table tbody tr {
    transition: background-color 0.3s ease;
}

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

/* Badges de estado */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
    text-align: center;
}

.status-active {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.status-expiring {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.status-expired {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-edit {
    background-color: var(--primary-color);
    color: white;
}

.btn-download {
    background-color: #6c757d;
    color: white;
}

.btn-action:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Estilos del Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    animation: overlayFadeIn 0.3s ease-out;
}

.modal-overlay.active {
    display: block;
}

.modal-contract {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #dc3545;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #444;
    font-size: 0.95rem;
}

.form-group input[type="date"] {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    width: 100%;
    background-color: white;
}

.form-group input[type="date"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.1);
}

/* Carga de archivos */
.file-upload {
    position: relative;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-upload label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    width: 100%;
}

.file-upload label:hover {
    border-color: var(--primary-color);
    background: rgba(255, 165, 0, 0.05);
}

.file-upload label i {
    font-size: 1.2rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.file-upload label span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.file-upload.has-file label {
    border-style: solid;
    border-color: var(--primary-color);
    background: rgba(255, 165, 0, 0.05);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 1;
}

.btn {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save {
    background: var(--primary-color);
    color: white;
    border: none;
}

.btn-save:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-cancel {
    background: #f8f9fa;
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background: #e9ecef;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Media queries para diseño responsivo */
@media (max-width: 1200px) {
    .workers-container {
        padding: 25px;
    }
    
    .btn-action {
        padding: 8px 10px;
    }
    
    .btn-action i + span {
        display: none;
    }
}

@media (max-width: 992px) {
    .main-content {
        padding: 15px;
    }
    
    .top-bar {
        padding: 12px 15px;
    }
    
    .top-bar h1 {
        font-size: 1.3rem;
    }
    
    .workers-container {
        padding: 20px;
    }
    
    .table-actions {
        gap: 10px;
    }
    
    .search-input {
        padding: 10px 40px 10px 12px;
    }
    
    .btn-export {
        padding: 10px 16px;
    }
    
    .workers-table th,
    .workers-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }
    
    .workers-container {
        padding: 15px;
        border-radius: 10px;
    }
    
    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: 100%;
        width: 100%;
    }
    
    .btn-export {
        width: 100%;
        justify-content: center;
    }
    
    .status-badge {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .modal-contract {
        width: 95%;
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .top-bar h1 {
        font-size: 1.1rem;
    }
    
    .workers-container {
        padding: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
    
    .modal-contract {
        padding: 15px;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input[type="date"] {
        padding: 10px;
    }
    
    .file-upload label {
        padding: 10px 15px;
    }
}

/* Soporte para preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
.btn-action:focus,
.search-input:focus,
input[type="date"]:focus,
.file-upload input[type="file"]:focus + label {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}