/* Estilos para el Wizard de Todas las Comidas del Día */

/* Visualización de progreso de alimentos */
.food-progress-container {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.foods-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.food-item {
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.food-item.bg-success {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
    border: 1px solid #badbcc;
}

.food-item.bg-primary {
    background-color: #0d6efd !important;
    color: white !important;
    border: 1px solid #0d6efd;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.food-item.bg-secondary {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    border: 1px solid #dee2e6;
}

.block-title {
    font-size: 16px;
    color: #495057;
    margin-bottom: 12px;
}

/* Contenedor principal */
#chatInputContainer {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 150px;
    overflow: visible;
}

/* Mensajes del chat */
.chat-message {
    margin-bottom: 16px;
}

.chat-message .d-inline-block {
    line-height: 1.5;
    font-size: 16px;
}

.chat-message .bg-light {
    background-color: #ffffff !important;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Selector de comidas */
.meal-selector-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.meal-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.meal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.meal-card.completed {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.meal-card.completed::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 40px 40px 0;
    border-color: transparent #28a745 transparent transparent;
}

.meal-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.meal-name {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.meal-time {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 16px;
    font-style: italic;
}

.meal-status {
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    background-color: #e9ecef;
    color: #6c757d;
    display: inline-block;
}

.meal-card.completed .meal-status {
    background-color: #d4edda;
    color: #155724;
}

/* Indicadores de comidas */
.meal-indicators {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.meal-dot {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid #e9ecef;
    background-color: #ffffff;
    color: #6c757d;
    position: relative;
}

.meal-dot.active {
    border-color: #007bff;
    background-color: #007bff;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.meal-dot.completed {
    border-color: #28a745;
    background-color: #28a745;
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.meal-dot:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Indicadores de pasos */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.step-indicators {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #e9ecef;
    background-color: #ffffff;
    color: #6c757d;
    transition: all 0.3s ease;
}

.step-dot.active {
    border-color: #007bff;
    background-color: #007bff;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.step-dot.completed {
    border-color: #28a745;
    background-color: #28a745;
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Chips de selección */
.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    max-height: none;
    overflow: visible;
}

.chip {
    padding: 8px 16px;
    background-color: #ffffff;
    border: 2px solid #007bff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    user-select: none;
    color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
    min-width: 70px;
    text-align: center;
}

.chip:hover {
    background-color: #e7f3ff;
    border-color: #0056b3;
    color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}

.chip.selected {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transform: translateY(-1px);
}

.chip.selected:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

.chip:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    box-shadow: none;
    transform: none;
}

.chip:disabled:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    box-shadow: none;
    transform: none;
}

/* Inputs */
.text-input {
    width: 100%;
    min-height: 100px;
    padding: 16px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.time-input {
    font-size: 16px;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    width: 200px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.time-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #545b62;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tarjetas de resumen */
.summary-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f8f9fa;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item span:first-child {
    font-weight: 500;
    color: #495057;
}

.summary-item span:last-child {
    color: #6c757d;
    font-size: 14px;
}

/* Tarjetas de alimentos */
.food-item-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.food-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.food-item-title {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
}

.food-item-status {
    background-color: #fff3cd;
    color: #856404;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.food-item-section {
    margin-bottom: 18px;
}

.food-item-section h6 {
    color: #495057;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Resumen de todas las comidas */
.all-meals-summary {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.all-meals-summary .summary-title {
    font-size: 24px;
    text-align: center;
    margin-bottom: 24px;
    color: #212529;
}

.meal-summary-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
}

.meal-summary-card h5 {
    color: #007bff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
}

/* Contenedor del resumen */
.summary-container {
    margin: 20px 0;
}

.summary-container .summary-card {
    margin-bottom: 16px;
}

.summary-container .btn {
    margin-top: 16px;
}

/* Sección de cantidad dinámica */
.quantity-section {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Topbar del wizard */
    .wizard-topbar .btn {
        width: 100%;
    }
    .wizard-topbar .progress {
        width: 100% !important;
        max-width: none !important;
    }
    .wizard-topbar #stepCounter {
        display: inline-block;
        margin-bottom: 6px;
        margin-right: 8px;
    }

    .meal-selector-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .meal-card {
        padding: 20px;
    }
    
    .meal-indicators {
        gap: 15px;
    }
    
    .meal-dot {
        width: 50px;
        height: 50px;
        font-size: 10px;
    }
    
    .step-indicators {
        gap: 10px;
    }
    
    .step-dot {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .chip-container {
        gap: 8px;
    }
    
    .chip {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 70px;
    }
    
    .text-input {
        min-height: 80px;
        padding: 12px;
    }
    
    .time-input {
        width: 100%;
        max-width: 200px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    /* Ajustes generales de espaciado en móvil pequeño */
    .container .h5, .container .h4, .container h2, .container h3 { font-size: 1rem; }
    .container { padding-left: 0.5rem; padding-right: 0.5rem; }
    .wizard-step { margin-top: 0.5rem; }

    #chatInputContainer {
        padding: 16px;
        margin: 16px 0;
    }
    
    .meal-card {
        padding: 16px;
    }
    
    .meal-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    .meal-name {
        font-size: 18px;
    }
    
    .meal-time {
        font-size: 13px;
    }
    
    .meal-status {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .summary-card,
    .food-item-card,
    .all-meals-summary {
        padding: 16px;
    }
    
    .summary-title {
        font-size: 16px;
    }
    
    .food-item-title {
        font-size: 18px;
    }
}

/* Estilos para las imágenes del atlas ENCA */
.atlas-image-section {
    background: #ffffff;
    border: 2px solid #e3f2fd;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 3px 12px rgba(33, 150, 243, 0.1);
}

.atlas-section-title {
    color: #1976d2;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.atlas-image-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e9ecef;
}

.atlas-food-image {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.atlas-food-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.atlas-size-btn {
    min-width: 80px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-width: 2px;
}

.atlas-size-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.atlas-size-btn.btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.atlas-size-btn.btn-outline-primary {
    background-color: transparent !important;
    border-color: #0d6efd !important;
    color: #0d6efd !important;
}

/* Estilos para el formulario de información personal */
.wizard-step[data-step="2"] {
    animation: fadeIn 0.5s ease-in-out;
}

.wizard-step[data-step="2"] .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.wizard-step[data-step="2"] .form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.wizard-step[data-step="2"] .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(-1px);
}

.wizard-step[data-step="2"] .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.wizard-step[data-step="2"] .form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.wizard-step[data-step="2"] .form-check-label {
    font-size: 16px;
    color: #495057;
    margin-left: 8px;
}

.wizard-step[data-step="2"] h6 {
    color: #6c757d;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.wizard-step[data-step="2"] .btn {
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.wizard-step[data-step="2"] .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wizard-step[data-step="2"] .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.wizard-step[data-step="2"] .btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
}

.wizard-step[data-step="2"] .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Estilos para la lista de archivos */
#file-list {
    max-height: 200px;
    overflow-y: auto;
}

#file-list .list-group-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 4px;
    padding: 8px 12px;
    background-color: #f8f9fa;
}

/* Animación de entrada */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive para el formulario */
@media (max-width: 768px) {
    .wizard-step[data-step="2"] .col-sm-4,
    .wizard-step[data-step="2"] .col-sm-6 {
        margin-bottom: 16px;
    }
    
    .wizard-step[data-step="2"] .btn {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .wizard-step[data-step="2"] .d-flex.justify-content-between {
        flex-direction: column;
    }
}

/* Loader Inicial */
#initial-loader {
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#initial-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}