/**
 * Sistema Visual de Trabajadores - CSS Completo
 * Incluye animaciones, efectos visuales y responsividad
 */

/* Reset y Variables CSS */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales */
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --primary-200: #BFDBFE;
    --primary-300: #93C5FD;
    --primary-400: #60A5FA;
    --primary-500: #3B82F6;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-800: #1E40AF;
    --primary-900: #1E3A8A;

    /* Colores de estado */
    --success-500: #10B981;
    --success-600: #059669;
    --warning-500: #F59E0B;
    --warning-600: #D97706;
    --danger-500: #EF4444;
    --danger-600: #DC2626;
    --info-500: #06B6D4;
    --info-600: #0891B2;

    /* Colores adicionales */
    --purple-500: #8B5CF6;
    --pink-500: #EC4899;
    --indigo-500: #6366F1;
    --cyan-500: #06B6D4;
    --lime-500: #84CC16;
    --orange-500: #F97316;

    /* Escala de grises */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Espaciado */
    --spacing-0: 0;
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-10: 2.5rem;
    --spacing-12: 3rem;
    --spacing-16: 4rem;

    /* Bordes */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index layers */
    --z-particles: -1;
    --z-normal: 1;
    --z-elevated: 10;
    --z-floating: 100;
    --z-modal: 1000;
    --z-toast: 2000;
    --z-loading: 9999;
}

/* Base styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-700);
    line-height: 1.6;
    overflow-x: auto;
    font-feature-settings: 'kern' 1, 'liga' 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container principal */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--spacing-8);
    position: relative;
}

/* Header principal */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-xl);
    margin-bottom: var(--spacing-8);
    padding: var(--spacing-8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 2s ease;
}

.header:hover::before {
    left: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-8);
    position: relative;
    z-index: var(--z-normal);
}

/* Título principal */
.title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-600), var(--purple-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
    letter-spacing: -0.025em;
}

.title-icon {
    font-size: 3rem;
    animation: bounce 2s infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { 
        transform: translateY(0); 
    }
    40% { 
        transform: translateY(-10px); 
    }
    60% { 
        transform: translateY(-5px); 
    }
}

/* Estadísticas */
.stats-container {
    display: flex;
    gap: var(--spacing-4);
    flex-wrap: wrap;
}

.stat-bubble {
    background: linear-gradient(135deg, white, var(--gray-50));
    padding: var(--spacing-4) var(--spacing-6);
    border-radius: var(--radius-full);
    border: 2px solid var(--gray-100);
    text-align: center;
    min-width: 120px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.stat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transition: left 0.6s ease;
}

.stat-bubble:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.stat-bubble:hover::before {
    left: 100%;
}

.stat-number {
    display: block;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    transition: all var(--transition-fast);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Controles */
.controls {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-xl);
    padding: var(--spacing-6);
    margin-bottom: var(--spacing-8);
    display: flex;
    gap: var(--spacing-4);
    flex-wrap: wrap;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4) var(--spacing-3) var(--spacing-10);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    transition: all var(--transition-normal);
    background: white;
    font-weight: 500;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-icon {
    position: absolute;
    left: var(--spacing-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1.125rem;
    pointer-events: none;
}

.filter-select {
    padding: var(--spacing-3) var(--spacing-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.filter-btn {
    background: linear-gradient(135deg, var(--primary-500), var(--purple-500));
    color: white;
    border: none;
    padding: var(--spacing-3) var(--spacing-6);
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-600), var(--purple-600));
}

.refresh-btn {
    background: linear-gradient(135deg, var(--success-500), var(--lime-500));
    color: white;
    border: none;
    padding: var(--spacing-3);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    font-size: 1.25rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-lg);
}

/* Workspace principal */
.workspace {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-8);
    min-height: 600px;
}

/* Zonas de ubicación */
.location-zone {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-xl);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.location-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.05), transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.location-zone:hover::before {
    opacity: 1;
}

.location-zone.drag-over {
    border-color: var(--primary-500);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
    background: rgba(59, 130, 246, 0.05);
}

.location-zone.drag-over::before {
    opacity: 1;
}

/* Header de ubicación */
.location-header {
    padding: var(--spacing-8);
    text-align: center;
    border-bottom: 2px solid var(--gray-100);
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    position: relative;
}

.location-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-4);
    display: block;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px); 
    }
    50% { 
        transform: translateY(-10px); 
    }
}

.location-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-2);
    letter-spacing: -0.025em;
}

.location-count {
    background: linear-gradient(135deg, var(--primary-500), var(--purple-500));
    color: white;
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.location-count:hover {
    transform: scale(1.05);
}

/* Área de trabajadores */
.workers-area {
    padding: var(--spacing-8);
    min-height: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-4);
    align-content: flex-start;
    align-items: flex-start;
}

/* Muñequitos de trabajadores */
.worker-figure {
    width: 100px;
    height: 140px;
    cursor: grab;
    transition: all var(--transition-normal);
    position: relative;
    user-select: none;
    animation: fadeInUp 0.6s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.worker-figure:hover {
    transform: scale(1.08) translateY(-8px);
    z-index: var(--z-elevated);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.worker-figure:active {
    cursor: grabbing;
}

.worker-figure.dragging {
    cursor: grabbing;
    transform: scale(1.15) rotate(8deg);
    z-index: var(--z-floating);
    opacity: 0.9;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Cuerpo del muñequito */
.worker-body {
    width: 60px;
    height: 80px;
    margin: 0 auto;
    border-radius: 30px 30px 15px 15px;
    background: linear-gradient(135deg, var(--primary-500), var(--purple-500));
    position: relative;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.worker-body::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 15%;
    right: 15%;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 50%;
    filter: blur(8px);
}

/* Cabeza del muñequito */
.worker-head {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #FBBF24;
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-normal);
}

.worker-head::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    filter: blur(1px);
}

/* Brazos del muñequito */
.worker-arms {
    position: absolute;
    top: 25px;
    left: -12px;
    right: -12px;
    height: 24px;
    z-index: var(--z-normal);
}

.worker-arms::before,
.worker-arms::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FBBF24;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.worker-arms::before { 
    left: 0; 
    animation: wave-left 2s ease-in-out infinite;
}

.worker-arms::after { 
    right: 0; 
    animation: wave-right 2s ease-in-out infinite;
}

@keyframes wave-left {
    0%, 100% { 
        transform: rotate(0deg) translateY(0px); 
    }
    50% { 
        transform: rotate(-25deg) translateY(-3px); 
    }
}

@keyframes wave-right {
    0%, 100% { 
        transform: rotate(0deg) translateY(0px); 
    }
    50% { 
        transform: rotate(25deg) translateY(-3px); 
    }
}

/* Piernas del muñequito */
.worker-legs {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.worker-leg {
    width: 16px;
    height: 22px;
    background: var(--gray-700);
    border-radius: 8px;
    animation: walk 1.5s ease-in-out infinite alternate;
    box-shadow: var(--shadow-sm);
}

.worker-leg:nth-child(2) {
    animation-delay: 0.75s;
}

@keyframes walk {
    0% { 
        transform: translateY(0px) scaleY(1); 
    }
    100% { 
        transform: translateY(4px) scaleY(0.9); 
    }
}

/* Información del trabajador */
.worker-name {
    text-align: center;
    margin-top: var(--spacing-2);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    background: rgba(255, 255, 255, 0.95);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    backdrop-filter: blur(10px);
    line-height: 1.2;
}

.worker-dept {
    text-align: center;
    margin-top: var(--spacing-1);
    font-size: 0.625rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* Indicador de estado */
.worker-status {
    position: absolute;
    top: -2px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-500);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
    animation: pulse 2s infinite;
    z-index: var(--z-elevated);
}

@keyframes pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); 
    }
}

/* Efectos especiales */
.magic-trail {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary-500);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    animation: trail 0.8s ease-out;
    z-index: var(--z-elevated);
}

@keyframes trail {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
}

/* Toast de notificaciones */
.toast {
    position: fixed;
    bottom: var(--spacing-8);
    right: var(--spacing-8);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--spacing-6) var(--spacing-8);
    z-index: var(--z-toast);
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: 400px;
    min-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
}

.toast-icon {
    font-size: 1.5rem;
    animation: bounce 1s ease-in-out;
    flex-shrink: 0;
}

.toast-message {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
    line-height: 1.4;
}

.toast.success { border-left: 4px solid var(--success-500); }
.toast.warning { border-left: 4px solid var(--warning-500); }
.toast.error { border-left: 4px solid var(--danger-500); }
.toast.info { border-left: 4px solid var(--info-500); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-modal);
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-2xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { 
        transform: translateY(-40px) scale(0.9); 
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1); 
        opacity: 1;
    }
}

.modal-header {
    padding: var(--spacing-8);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.close-btn {
    background: none;
    border: none;
    padding: var(--spacing-2);
    cursor: pointer;
    color: var(--gray-400);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-600);
    transform: scale(1.1);
}

.modal-body {
    padding: var(--spacing-8);
}

/* Partículas de fondo */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-particles);
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: float-particle 8s infinite ease-in-out;
}

@keyframes float-particle {
    0%, 100% { 
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% { 
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Efectos de glow */
.glow {
    position: relative;
}

.glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--primary-500), 
        var(--purple-500), 
        var(--success-500), 
        var(--warning-500),
        var(--primary-500)
    );
    border-radius: inherit;
    z-index: -1;
    filter: blur(15px);
    opacity: 0;
    transition: opacity var(--transition-normal);
    animation: glow-rotate 4s linear infinite;
}

@keyframes glow-rotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.glow:hover::before {
    opacity: 0.6;
}

/* Sidebar (opcional) */
.sidebar {
    position: fixed;
    top: 50%;
    right: -300px;
    transform: translateY(-50%);
    width: 280px;
    height: auto;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl) 0 0 var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: right var(--transition-slow);
    z-index: var(--z-floating);
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-content {
    padding: var(--spacing-6);
}

.sidebar-toggle {
    position: absolute;
    left: -48px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
}

.sidebar-toggle:hover {
    background: var(--primary-600);
    transform: translateY(-50%) scale(1.1);
}

/* Estados especiales */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loading);
    transition: opacity var(--transition-slow);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: var(--spacing-6);
    }
    
    .container {
        padding: var(--spacing-6);
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-4);
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--spacing-6);
    }
    
    .title {
        font-size: 2rem;
    }
    
    .stats-container {
        width: 100%;
        justify-content: center;
    }
    
    .controls {
        flex-direction: column;
        gap: var(--spacing-3);
    }
    
    .search-box,
    .filter-select {
        width: 100%;
        min-width: auto;
    }
    
    .workspace {
        grid-template-columns: 1fr;
        gap: var(--spacing-4);
    }
    
    .worker-figure {
        width: 80px;
        height: 110px;
    }
    
    .worker-body {
        width: 50px;
        height: 65px;
    }
    
    .worker-head {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .sidebar {
        width: 100vw;
        right: -100vw;
        top: 0;
        transform: none;
        height: 100vh;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }
    
    .title-icon {
        font-size: 2rem;
    }
    
    .workers-area {
        padding: var(--spacing-4);
        justify-content: center;
    }
    
    .toast {
        bottom: var(--spacing-4);
        right: var(--spacing-4);
        left: var(--spacing-4);
        max-width: none;
        min-width: auto;
    }
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1F2937;
        --gray-100: #374151;
        --gray-200: #4B5563;
        --gray-900: #F9FAFB;
        --gray-800: #F3F4F6;
        --gray-700: #E5E7EB;
    }
    
    body {
        background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
    }
}

/* Animaciones adicionales */
@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100px) rotate(360deg);
        opacity: 0;
    }
}

/* Animación de escritura para el título */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Estados de interacción mejorados */
.worker-figure:focus {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-lg);
}

.location-zone:focus-within {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .particles,
    .toast,
    .modal,
    .sidebar,
    .glow::before {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .header,
    .controls,
    .location-zone {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}