/* Nutrition Plan Styles */

/* Coach Message Styles */
.coach-message {
    margin: 15px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.coach-message.bot-message {
    justify-content: flex-start;
}

.coach-message.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bot-message .message-content {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    color: #495057;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-text {
    line-height: 1.5;
    margin-bottom: 8px;
}

.message-text strong {
    font-weight: 600;
    color: #495057;
}

.user-message .message-text strong {
    color: white;
}

.message-text em {
    font-style: italic;
    opacity: 0.9;
}

.message-text ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-text li {
    margin: 5px 0;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.bot-message .message-time {
    color: #6c757d;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Plan Button Container */
.plan-button-container {
    margin: 0 auto 20px auto;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
}

/* En móvil, los botones se mantienen en una fila */
@media (max-width: 768px) {
    .plan-button-container {
        flex-wrap: nowrap;
    }
    
    /* Ocultar botones de ver plan y regenerar plan en la página de weekly plan (solo móvil) */
    /* Cuando el contenedor tiene la clase weekly-plan-active, ocultar estos botones */
    .plan-button-container.weekly-plan-active .view-plan-btn,
    .plan-button-container.weekly-plan-active .regenerate-plan-btn {
        display: none !important;
    }
}

/* Plan Warning */
.plan-warning {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    color: #92400e;
}

.warning-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.warning-text {
    flex: 1;
    line-height: 1.5;
}

/* Plan Buttons */
.plan-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    margin: 0;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: #3b82f6;
    color: white;
}

.plan-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.plan-button:active {
    transform: translateY(0);
}

.plan-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.generate-plan-btn {
    background: #10b981;
}

.generate-plan-btn:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.view-plan-btn {
    background: #3b82f6;
}

.view-plan-btn:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.regenerate-plan-btn {
    background: #f59e0b;
}

.regenerate-plan-btn:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.loading-btn {
    background: #6b7280;
}

.button-icon {
    font-size: 16px;
}

.button-text {
    font-weight: 600;
}

/* Nutrition Plan Modal */
.nutrition-plan-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-header h3 {
    margin: 0;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: #e5e7eb;
    color: #374151;
}

.modal-body {
    padding: 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.btn-secondary, .btn-primary {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

/* Weekly Totals */
.weekly-totals {
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 8px;
    border: 1px solid #0ea5e9;
}

.weekly-totals h4 {
    margin: 0 0 15px 0;
    color: #0c4a6e;
    font-size: 18px;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.total-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0f2fe;
}

.total-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #0c4a6e;
}

/* Days List View */
.days-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.day-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.day-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.day-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.day-card-header h4 {
    margin: 0;
    color: #111827;
    font-size: 18px;
    font-weight: 600;
}

.day-card-preview {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.preview-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preview-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-value {
    font-size: 16px;
    font-weight: 700;
    color: #3b82f6;
}

/* Back Button */
.btn-back {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-back:hover {
    background: #4b5563;
    transform: translateX(-2px);
}

/* Daily Plans */
.daily-plans {
    display: grid;
    gap: 20px;
}

.day-plan {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.day-header h4 {
    margin: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

.training-summary {
    font-size: 12px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 4px 8px;
    border-radius: 4px;
}

.day-content {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.nutrition-info, .hydration-info, .supplementation-info, .meals-info {
    background: #f9fafb;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.nutrition-info h5, .hydration-info h5, .supplementation-info h5, .meals-info h5 {
    margin: 0 0 10px 0;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
}

.macros, .hydration-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.macros span, .hydration-details span {
    font-size: 12px;
    color: #6b7280;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.supplements, .meals {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.supplement-item, .meal-item {
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
}

.supplement-item strong, .meal-item strong {
    display: block;
    color: #111827;
    margin-bottom: 2px;
}

.meal-kcal {
    color: #059669;
    font-weight: 600;
    font-size: 11px;
}

/* Plan Rationale and Recommendations */
.plan-rationale, .plan-recommendations {
    margin-top: 30px;
    padding: 20px;
    background: #f0fdf4;
    border-radius: 8px;
    border: 1px solid #22c55e;
}

.plan-rationale h4, .plan-recommendations h4 {
    margin: 0 0 15px 0;
    color: #15803d;
    font-size: 16px;
}

.plan-rationale p {
    margin: 0;
    color: #166534;
    line-height: 1.6;
}

.plan-recommendations ul {
    margin: 0;
    padding-left: 20px;
    color: #166534;
}

.plan-recommendations li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 15px;
    }
    
    .totals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .day-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .macros, .hydration-details {
        flex-direction: column;
    }
    
    .days-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .day-card {
        padding: 15px;
    }
    
    .day-card-header h4 {
        font-size: 16px;
    }
    
    .btn-back {
        width: 100%;
        justify-content: center;
    }
    
    /* Botones en columna, centrados y más pequeños en móvil */
    .plan-button-container {
        padding: 4px 6px;
        margin: 0.5rem auto;
        gap: 0.5rem;
        flex-direction: column; /* Uno debajo del otro */
        flex-wrap: nowrap;
        align-items: center; /* Centrar horizontalmente */
        width: fit-content;
        max-width: 70%;
    }
    
    .plan-button {
        padding: 3px 6px;
        font-size: 8px;
        flex: 0 0 auto;
        min-width: auto;
        width: auto;
        white-space: nowrap;
        line-height: 1.3;
        justify-content: center; /* Centrar contenido del botón */
    }
    
    .button-icon {
        font-size: 8px;
    }
    
    .button-text {
        font-size: 8px;
        font-weight: 500;
    }
}

/* Coach Message Styles */
.coach-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: #3b82f6;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.bot-message .message-content {
    background: #f1f5f9;
    color: #334155;
    border-radius: 18px 18px 18px 4px;
}

.message-content {
    padding: 12px 16px;
    max-width: 80%;
    word-wrap: break-word;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.success {
    background: #10b981;
}

.notification.error {
    background: #ef4444;
}

.notification.warning {
    background: #f59e0b;
}

.notification.info {
    background: #3b82f6;
}
/* ========================================
   MEJORAS DE VISIBILIDAD EN MODAL
   ======================================== */

/* Botones siempre visibles y clickeables */
.plan-button,
.btn-primary,
.btn-secondary,
.close-modal {
    min-height: 44px;
    min-width: 80px;
    touch-action: manipulation;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .modal-content {
        width: calc(100% - 20px);
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }
    
    .modal-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #f9fafb;
    }
    
    .modal-body {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
}

/* Mejorar visibilidad del scrollbar en móvil */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

/* Contenido del plan más legible */
.day-content {
    gap: 15px;
}

@media (max-width: 768px) {
    .day-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .nutrition-info,
    .hydration-info,
    .supplementation-info,
    .meals-info {
        padding: 12px;
    }
}

/* Estilos para acordeones de suplementación */
.accordion-container {
    margin-top: 20px;
}

.accordion-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    background: #f8f9fa;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-content {
    padding: 0;
}

.supplement-category {
    padding: 15px;
}

.supplement-guide-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.supplement-header {
    background: #f8f9fa;
    padding: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.supplement-header:hover {
    background: #e9ecef;
}

.supplement-details {
    padding: 15px;
    background: white;
}

.supplement-details p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.supplement-details ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.supplement-details li {
    margin-bottom: 5px;
}

.accordion-icon, .supplement-icon {
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.2s;
    color: #007bff;
}

.btn-link {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    font-size: 12px;
    padding: 5px 0;
    transition: color 0.2s ease;
}

.btn-link:hover {
    color: #0056b3;
}

/* Estilos para información de suplementos en el plan diario */
.supplement-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0;
}

.supplement-timing,
.supplement-dose,
.supplement-frequency {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

.supplement-purpose {
    font-size: 13px;
    color: #333;
    margin: 8px 0;
    font-style: italic;
}

.supplement-explanation {
    font-size: 12px;
    color: #666;
    margin: 8px 0;
    background: #f0f8ff;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.supplement-actions {
    margin-top: 10px;
}

/* Responsive para acordeones */
@media (max-width: 768px) {
    .accordion-header {
        padding: 12px;
    }
    
    .supplement-category {
        padding: 10px;
    }
    
    .supplement-details {
        padding: 12px;
    }
    
    .supplement-meta {
        flex-direction: column;
        gap: 5px;
    }
}

