/* ============================================
   RESET Y ESTILOS BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #4c526e 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* Contenedor principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   HEADER Y BOTONES
   ============================================ */
.header {
    background: white;
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    color: #333;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

h1::before {
    content: "📋";
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.btn-agregar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-agregar:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-agregar:active {
    transform: translateY(0);
}

/* ============================================
   FILTROS
   ============================================ */
.filtros {
    background: white;
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    animation: fadeIn 0.6s ease-out;
}

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

.filtros label {
    font-weight: 600;
    margin-right: 15px;
    color: #555;
}

.filtro-select {
    padding: 8px 20px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filtro-select:hover {
    border-color: #667eea;
}

.filtro-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================
   GRID DE PRODUCTOS
   ============================================ */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 25px;
}

/* Tarjeta de producto con animación de entrada */
.producto-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardAppear 0.5s ease-out backwards;
    animation-delay: calc(var(--card-index, 0) * 0.05s);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.producto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.producto-nombre {
    font-size: 1.2rem;
    font-weight: bold;
}

.estado-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.card-body {
    padding: 20px;
}

.descripcion {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 3px solid #667eea;
    padding-left: 12px;
}

/* ============================================
   PASOS - ANIMACIONES DE PROGRESO
   ============================================ */
.pasos-container {
    margin-top: 15px;
}

.paso-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 4px solid #ddd;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Animación de completado */
.paso-item.completado {
    border-left-color: #28a745;
    background: linear-gradient(90deg, #f0f9f0 0%, #ffffff 100%);
    animation: completePulse 0.6s ease-out;
}

@keyframes completePulse {
    0% {
        transform: scale(1);
        background: #f0f9f0;
    }
    50% {
        transform: scale(1.02);
        background: #d4edda;
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
    }
    100% {
        transform: scale(1);
        background: linear-gradient(90deg, #f0f9f0 0%, #ffffff 100%);
    }
}

/* Animación de paso actual */
.paso-item.actual {
    border-left-color: #ffc107;
    background: #fff9e6;
    animation: currentGlow 1.5s ease-in-out infinite;
}

@keyframes currentGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 193, 7, 0);
    }
}

/* Efecto de confeti al completar */
.paso-item.completado::after {
    content: "🎉";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    animation: confetti 0.5s ease-out;
    pointer-events: none;
}

@keyframes confetti {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) scale(1);
    }
}

.paso-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.paso-nombre {
    font-weight: bold;
    color: #333;
}

.paso-estado {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 15px;
    background: #e0e0e0;
    transition: all 0.3s ease;
}

.paso-estado.completado {
    background: #28a745;
    color: white;
    animation: badgePop 0.4s ease-out;
}

.paso-estado.actual {
    background: #ffc107;
    color: #333;
    animation: badgePulse 1s ease-in-out infinite;
}

@keyframes badgePop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    80% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(255, 193, 7, 0.2);
    }
}

/* Animación para archivo subido */
.archivo-info {
    font-size: 0.8rem;
    color: #28a745;
    margin: 8px 0;
    padding: 5px 8px;
    background: #e8f5e9;
    border-radius: 8px;
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.archivo-info a {
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s;
}

.archivo-info a:hover {
    text-decoration: underline;
    color: #5a67d8;
}

/* Botón subir archivo */
.subir-archivo {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input {
    font-size: 0.75rem;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input:hover {
    border-color: #667eea;
}

.btn-subir {
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-subir:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-subir:active {
    transform: translateY(0);
}

/* Botón avanzar */
.btn-avanzar {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 8px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-avanzar:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-avanzar:active {
    transform: translateY(0);
}

/* Botón eliminar */
.btn-eliminar {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.7rem;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.btn-eliminar:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* ============================================
   MODAL CON ANIMACIÓN
   ============================================ */
.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;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.modal-content input, 
.modal-content textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-cancelar {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancelar:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-crear {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-crear:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* ============================================
   LOADING Y ESTADOS VACÍOS
   ============================================ */
.loading {
    text-align: center;
    padding: 60px;
    background: white;
    border-radius: 20px;
    color: #888;
    animation: fadeIn 0.5s ease-out;
}

.loading::after {
    content: "⏳";
    display: inline-block;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 60px;
    background: white;
    border-radius: 20px;
    color: #888;
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out;
    z-index: 1000;
    max-width: 350px;
}

.toast-notification.success {
    border-left: 4px solid #28a745;
}

.toast-notification.error {
    border-left: 4px solid #dc3545;
}

.toast-notification.info {
    border-left: 4px solid #17a2b8;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .productos-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .subir-archivo {
        flex-direction: column;
        align-items: stretch;
    }
    
    .file-input {
        width: 100%;
    }
    
    .btn-subir {
        width: 100%;
    }
}