/* Strict Diet Mode Icon Button */
.strict-diet-icon-btn {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #ffffff;
    color: #ff9800;
    border: 2px solid #ddd;
    border-radius: 12px;
    width: 60px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: hidden;
    outline: none;
}

.strict-diet-icon-btn:focus {
    outline: none;
}

.strict-diet-icon-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.strict-diet-icon-btn.active {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: 2px solid #f57c00;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
}

.strict-diet-icon-btn.active:hover {
    background: linear-gradient(135deg, #f57c00, #e65100);
    border-color: #e65100;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.5);
}

.strict-diet-icon-btn.long-pressing::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(76, 175, 80, 0.5));
    border-radius: 0 0 10px 10px;
    animation: fillFromBottom 1.5s linear;
    z-index: -1;
}

@keyframes fillFromBottom {
    0% {
        height: 0%;
        border-radius: 0 0 10px 10px;
    }
    50% {
        border-radius: 0 0 10px 10px;
    }
    100% {
        height: 100%;
        border-radius: 10px;
    }
}


/* Universal Product Analyzer Button */
.universal-analyzer-btn {
    position: fixed;
    top: 140px;
    right: 20px;
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 12px;
    width: 60px;
    height: 50px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* Show analyzer button only on products tab */
#products-tab:not(.active) ~ * .universal-analyzer-btn,
.tab-content:not(#products-tab).active ~ .universal-analyzer-btn {
    display: none;
}

.universal-analyzer-btn:hover {
    background: #e8e8e8;
    border-color: #bbb;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Category Selection Styles */
.category-selection {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.category-selection strong {
    font-size: 14px;
    color: #555;
}

.category-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    justify-content: center;
}

.category-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.forbidden-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.forbidden-btn:hover {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.25);
}

.allowed-btn {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.allowed-btn:hover {
    background: linear-gradient(135deg, #45a049, #388e3c);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.25);
}
/* Diet Plan Styles */
.diet-plan-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.diet-plan-content h2 {
    color: #333;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.diet-plan-content p {
    color: #666;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 20px;
}

/* Diet Controls */
.diet-controls {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    position: relative;
    max-width: 1760px;
    margin-left: auto;
    margin-right: auto;
}

/* Doctor Info Button */
.doctor-info-btn-wrapper {
    position: absolute;
    top: 15px;
    right: 65px;
    width: 40px;
    height: 40px;
}

.doctor-info-btn {
    background: transparent;
    border: 2px solid #4caf50;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.doctor-info-btn:hover {
    background: #4caf50;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Long press progress indicator */
.long-press-progress {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #ff9800;
    opacity: 0;
    transform: rotate(0deg);
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 3;
    box-sizing: border-box;
}

.long-press-progress.active {
    opacity: 1;
    animation: longPressRotate 1s linear forwards;
}

@keyframes longPressRotate {
    0% {
        transform: rotate(0deg);
        border-top-color: #ff9800;
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    25% {
        border-right-color: #ff9800;
    }
    50% {
        border-bottom-color: #ff9800;
    }
    75% {
        border-left-color: #ff9800;
    }
    100% {
        transform: rotate(360deg);
        border-color: #ff9800;
    }
}

/* Recipes Button */
.recipes-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: 2px solid #ff9800;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipes-btn:hover {
    background: #ff9800;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}


.diet-generate-btn {
    font-size: 1.1rem;
    padding: 15px 30px;
    margin: 0 auto 10px auto;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    width: 280px !important;
    height: 50px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    display: block;
    text-align: center;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}

.diet-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

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

.diet-generate-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
    transform: none !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
    width: 280px !important;
    height: 50px !important;
    min-width: 280px !important;
    min-height: 50px !important;
    max-width: 280px !important;
    max-height: 50px !important;
}

.diet-generate-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    margin-left: 10px;
    display: inline-block;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

.diet-info {
    margin-top: 15px;
}

.diet-info p {
    color: #666;
    font-size: 1rem;
    margin: 0;
    text-align: center;
}

.diet-plan-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
    align-items: start;
    max-width: 1760px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
}

.meal-section {
    display: flex;
    flex-direction: column;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 0;
    transition: all 0.3s ease;
    min-height: 300px;
    perspective: 1000px;
    cursor: pointer;
    height: auto;
}

.meal-section:hover {
    border-color: #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

/* 1. Титулы секций: убираем лишние вертикальные отступы, добавляем отступ слева */
.meal-section h3,
.meal-flip-back h3 {
    margin-top: 0.5em !important;
    margin-bottom: 0.7em !important;
    padding-top: 0.2em !important;
    padding-bottom: 0.3em !important;
    padding-left: 18px !important;
    border-bottom-width: 2px;
}

/* Flip card container */
.meal-flip-container {
    flex: 1 1 auto;
    width: 100%;
    min-height: 280px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    border-radius: 12px;
}

.meal-section.flipped .meal-flip-container {
    transform: rotateY(180deg);
}

/* Front and back sides */
.meal-flip-front, .meal-flip-back {
    width: 100%;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
}

/* Position for flip effect */
.meal-flip-container .meal-flip-front,
.meal-flip-container .meal-flip-back {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
}

.meal-flip-front {
    background: white;
}

.meal-flip-back {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    transform: rotateY(180deg);
}

.meal-section h3 {
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.meal-flip-back h3 {
    border-bottom: 2px solid #90caf9;
    color: #1565c0;
}

.meal-items {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    flex: 1;
}

.meal-items:empty::after {
    content: "Перетащите продукты сюда или дважды кликните для добавления";
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    line-height: 1.4;
}

/* Meal Item Styles */
.meal-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
    /* убираем hover-эффект */
}
.meal-item:hover {
    border-color: #e0e0e0;
    box-shadow: none;
}

.meal-item-header h4 {
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.meal-item-content p {
    color: #555;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 4px 0;
    text-align: left;
}

/* Центрируем только заголовки (strong), текст остается слева */
.meal-item-content strong {
    color: #333;
    font-weight: 700;
    display: block;
    text-align: center;
    margin-top: 8px;
    margin-bottom: 4px;
}

/* Для параграфа внутри ingredients (только заголовок) */
.meal-item-content .ingredients p {
    text-align: center;
    margin: 0;
}

/* 3. Отступы для списков внутри карточки блюда */
.meal-item-content ul,
.meal-item-content ol {
    margin-left: 0;
    margin-right: 0;
    margin-top: 6px;
    margin-bottom: 6px;
    padding-left: 8px;
    text-align: left;
}

.meal-item-content li {
    text-align: left;
    margin-bottom: 4px;
    padding-left: 0;
}

/* Styles for restriction warnings */
.restrictions-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px;
    margin: 10px 0 !important;
    color: #856404;
    font-size: 0.9em;
}

.restrictions-warning strong {
    color: #856404;
}

/* Save Recipe Button */
.save-recipe-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fff;
    color: #ff9800;
    border: 2px solid #ff9800;
    border-radius: 4px;
    width: 30px;
    height: 25px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s, border 0.2s;
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

.save-recipe-btn:hover, .save-recipe-btn:focus {
    background: #ff9800;
    color: #fff;
    border: 2px solid #ff9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.25);
    outline: none;
}

.ingredients-list {
    margin: 0 0 0 0.5em;
    padding: 0;
    list-style-type: disc;
    list-style-position: outside;
    text-align: left;
}

.ingredients-list li {
    margin-left: 1.2em;
    padding-left: 0;
    text-align: left;
}

.meal-item-content p strong,
.ingredients > p > strong {
    text-align: left;
    display: block;
    width: 100%;
    margin-bottom: 0.2em;
    font-weight: 600;
    margin-left: 0;
    margin-top: 0.7em;
    margin-bottom: 0.7em;
    text-align: left;
}
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 32px;
    right: 32px;
    background: #4caf50;
    color: white;
    padding: 15px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    z-index: 10001;
    min-width: 220px;
    font-size: 1.08em;
    font-weight: 500;
    text-align: left;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-notification.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}
    font-weight: 500;
    min-width: 250px;
    text-align: center;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

/* Success and Error Notifications for Diet Plan */
.success-notification,
.error-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 300px;
    max-width: 500px;
    animation: slideIn 0.3s ease-out;
}

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

.success-notification {
    border: 3px solid #4caf50;
}

.error-notification {
    border: 3px solid #f44336;
}

.success-icon,
.error-icon {
    font-size: 32px;
    line-height: 1;
}

.success-message,
.error-message {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    flex: 1;
}

/* Prompt Modal Styles - FORCE WIDE */
#prompt-info-modal .modal-content.prompt-modal {
    width: 95vw !important;
    max-width: 95vw !important;
    min-width: 95vw !important;
    height: calc(85vh * 1.25) !important;
    max-height: 95vh !important;
    left: 2.5vw !important;
    right: 2.5vw !important;
    margin: 0 !important;
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.prompt-content {
    height: 65vh;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    width: 100%;
    box-sizing: border-box;
}

.prompt-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #333;
    margin: 0;
}

.prompt-content textarea {
    width: 100%;
    height: 55vh;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #333;
    background: #fff;
    border: 2px solid #4caf50;
    border-radius: 6px;
    padding: 15px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.prompt-content textarea:focus {
    border-color: #45a049;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.prompt-modal .modal-header {
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    border-bottom: 1px solid #4caf50;
}

.prompt-modal .modal-header span {
    color: #2e7d32;
    font-weight: 700;
}

/* Prompt notification styles */
.prompt-notification {
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.prompt-notification.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.prompt-notification.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

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

.prompt-meta-info {
    margin-bottom: 10px;
}

.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0px; /* Убран gap полностью для drag & drop */
    align-items: start;
}

/* Синхронизация высоты категорий между колонками */
.section {
    display: flex;
    flex-direction: column;
}

#forbidden-products,
#allowed-products {
    display: flex;
    flex-direction: column;
}

.category {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

/* Синхронизация высоты категорий */
.category:nth-child(1) { min-height: var(--category-1-height, auto) !important; }
.category:nth-child(2) { min-height: var(--category-2-height, auto) !important; }
.category:nth-child(3) { min-height: var(--category-3-height, auto) !important; }
.category:nth-child(4) { min-height: var(--category-4-height, auto) !important; }
.category:nth-child(5) { min-height: var(--category-5-height, auto) !important; }
.category:nth-child(6) { min-height: var(--category-6-height, auto) !important; }
.category:nth-child(7) { min-height: var(--category-7-height, auto) !important; }
.category:nth-child(8) { min-height: var(--category-8-height, auto) !important; }
.category:nth-child(9) { min-height: var(--category-9-height, auto) !important; }
.category:nth-child(10) { min-height: var(--category-10-height, auto) !important; }
.category:nth-child(11) { min-height: var(--category-11-height, auto) !important; }
.category:nth-child(12) { min-height: var(--category-12-height, auto) !important; }
.category:nth-child(13) { min-height: var(--category-13-height, auto) !important; }
.category:nth-child(14) { min-height: var(--category-14-height, auto) !important; }
.category:nth-child(15) { min-height: var(--category-15-height, auto) !important; }
.category:nth-child(16) { min-height: var(--category-16-height, auto) !important; }
.category:nth-child(17) { min-height: var(--category-17-height, auto) !important; }
.category:nth-child(18) { min-height: var(--category-18-height, auto) !important; }
.category:nth-child(19) { min-height: var(--category-19-height, auto) !important; }
.category:nth-child(20) { min-height: var(--category-20-height, auto) !important; }

/* Стили для пустых категорий */
.category.empty-category {
    opacity: 0.4;
}

.category.empty-category h3 {
    color: #999;
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: left;
    font-weight: 600;
}

.forbidden-section h2 {
    color: #e74c3c;
}


.allowed-section h2 {
    color: #27ae60;
}


/* Цветовая схема hover для разных разделов */
.forbidden-section .product-card:hover {
    border-color: #e74c3c !important;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3) !important;
    background: rgba(231, 76, 60, 0.05) !important;
    transform: scale(1.08);
    z-index: 10;
}

.allowed-section .product-card:hover {
    border-color: #27ae60 !important;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3) !important;
    background: rgba(39, 174, 96, 0.05) !important;
    transform: scale(1.08);
    z-index: 10;
}

.category {
    margin-bottom: 20px;
}

.category h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #555;
    font-weight: 500;
}

.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-card {
    background: white;
    border-radius: 8px;
    padding: 2px 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    font-size: 0.9rem;
    display: inline-block;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    user-select: none; /* Отключаем выделение текста */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
}

.product-card:hover {
    background: #e8f5e8;
    border-color: #4caf50;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
    z-index: 10;
}

.product-card h3 {
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0;
    color: #333;
    line-height: 1.2;
}


.product-card .note {
    font-size: 0.7rem;
    color: #666;
    margin-top: 2px;
    font-weight: 400;
    line-height: 1.1;
    font-style: italic;
}

/* Дополнительные стили для карточек с примечаниями */
.product-card.has-note {
    border-bottom: 2px solid #f0f0f0;
}

.product-card.has-note:hover {
    border-bottom: 2px solid #4caf50;
}

/* Новые стили для компактных табличек */
.nutrient-badges {
    position: absolute;
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.3s ease;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}


.nutrient-badges.shift-right {
    left: 0;
    transform: translateX(0);
}

.nutrient-badges.shift-left {
    right: 0;
    left: auto;
    transform: translateX(0);
}

.nutrient-badge {
    background: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid;
}

.nutrient-badge.potassium {
    border-color: #2196f3;
    color: #2196f3;
}

.nutrient-badge.phosphorus {
    border-color: #ff9800;
    color: #ff9800;
}

.nutrient-badge.sodium {
    border-color: #f44336;
    color: #f44336;
}

.product-card:hover .nutrient-badges {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .section {
        padding: 15px;
        height: calc(50vh - 100px);
    }
    
    /* Responsive modal improvements */
    .modal {
        padding: 5px !important;
    }
    
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 5px auto !important;
        max-height: 85vh !important;
    }
    
    .modal-body {
        padding: 10px !important;
    }
    
    .modal-header {
        padding: 8px 10px !important;
    }
    
    .modal-footer {
        padding: 8px 10px !important;
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 4px;
    }
    
    .product-card {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .product-card h3 {
        font-size: 0.8rem;
    }
    
    /* Extra small screen modal improvements */
    .modal {
        padding: 2px !important;
    }
    
    .modal-content {
        width: 98vw !important;
        max-width: 98vw !important;
        margin: 2px auto !important;
        max-height: 95vh !important;
        border-radius: 6px !important;
    }
    
    .modal-body {
        padding: 8px !important;
    }
    
    .modal-header {
        padding: 6px 8px !important;
    }
    
    .modal-header span {
        font-size: 13px !important;
    }
    
    .modal-footer {
        padding: 6px 8px !important;
        flex-direction: column;
        gap: 6px;
    }
    
    .btn {
        width: 100%;
        padding: 10px 16px !important;
    }
}
/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.2rem;
    color: #7f8c8d;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #3498db;
    border-top: 2px solid transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Стили для модалки добавления продукта */

#new-product-name {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#new-product-name:focus {
    outline: none;
    border-color: #4caf50;
}

.ai-processing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #fff3e0;
    border-radius: 4px;
    margin-bottom: 15px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff9800;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-result {
    padding: 15px;
    background: #e8f5e8;
    border-radius: 4px;
    margin-bottom: 15px;
}

.category-info, .nutrients-info {
    margin-bottom: 8px;
    font-size: 13px;
}

.category-info strong, .nutrients-info strong {
    color: #2e7d32;
}


.modal-body textarea {
    width: 100%;
    min-height: 50px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.modal-body textarea:focus {
    outline: none;
    border-color: #4caf50;
}

.modal.forbidden .modal-body textarea:focus {
    border-color: #e74c3c;
}

.modal-footer {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    justify-content: flex-start;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #4caf50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.modal.forbidden .btn-primary {
    background: #4caf50;
    color: white;
}

.modal.forbidden .btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e0e0e0;
    color: #666;
}

.btn-secondary:hover {
    background: #d5d5d5;
}

.btn-success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    font-weight: 600;
    transition: all 0.3s;
}

        .btn-success:hover {
            background: linear-gradient(135deg, #5568d3 0%, #6a3d92 100%);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        /* Active session indicator with pulsing animation */
        .btn-success.session-active {
            position: relative;
            animation: sessionPulse 1.5s ease-in-out infinite;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        }
        
        /* Inner glow effect */
        .btn-success.session-active::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: 4px;
            background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
            animation: innerGlow 1.5s ease-in-out infinite;
            pointer-events: none;
        }
        
        @keyframes sessionPulse {
            0%, 100% {
                box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.9), 
                           0 0 20px rgba(102, 126, 234, 0.5),
                           inset 0 0 20px rgba(255, 255, 255, 0.2);
            }
            50% {
                box-shadow: 0 0 0 10px rgba(102, 126, 234, 0), 
                           0 0 30px rgba(102, 126, 234, 0.8),
                           inset 0 0 30px rgba(255, 255, 255, 0.4);
            }
        }
        
        @keyframes innerGlow {
            0%, 100% {
                opacity: 0.3;
            }
            50% {
                opacity: 0.7;
            }
        }/* Drag and Drop Styles */

.product-card.long-pressing {
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.3) 0%, transparent 0%);
    background-size: 200% 100%;
    animation: longPressProgress 0.2s linear forwards; /* Ускорено до 0.2 секунды */
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

@keyframes longPressProgress {
    from {
        background: linear-gradient(90deg, rgba(76, 175, 80, 0.3) 0%, transparent 0%);
    }
    to {
        background: linear-gradient(90deg, rgba(76, 175, 80, 0.3) 100%, transparent 100%);
    }
}

.product-card.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1500;
    cursor: grabbing;
}

.section.drag-over {
    background: rgba(76, 175, 80, 0.2);
    border: 3px dashed #4caf50;
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

/* Make sections more visible as drop zones */
.section {
    min-height: 300px;
    transition: all 0.15s ease; /* Быстрее отклик */
    position: relative;
    border: 2px solid transparent;
    padding: 0 10px; /* Внутренний отступ для визуального разделения */
}

/* Show drop zones when dragging */
body.dragging .section {
    border: 2px dashed #ccc;
    background: rgba(0, 0, 0, 0.02);
    min-height: 400px;
}

body.dragging .forbidden-section {
    border-color: #ff6b6b; /* Мягкий красный */
    background: rgba(255, 107, 107, 0.05);
}

body.dragging .allowed-section {
    border-color: #51cf66; /* Мягкий зеленый */
    background: rgba(81, 207, 102, 0.05);
}

body.dragging .section:hover {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.3);
}

/* Убираем текст - зоны и так понятны */

.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1400;
    background: rgba(0, 0, 0, 0.1);
    display: none;
}

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


/* Updated product visual feedback */
.product-card.updated {
    border-color: #2196f3;
    background: rgba(33, 150, 243, 0.05);
}

#product-name-en,
#detected-name-en {
    font-weight: 500;
    color: #444;
}

.translatable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(33, 150, 243, 0.05);
    border-bottom: 1px dashed #2196f3;
}

.translatable:hover {
    background: rgba(33, 150, 243, 0.1);
    border-bottom: 1px solid #2196f3;
}

/* Inline select for category editing - styled like other text */
.inline-select {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #ddd;
    color: #333;
    background: white;
    margin-left: 4px;
    min-width: 100px;
    transition: all 0.2s ease;
}

.inline-select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.inline-select:hover {
    border-color: #999;
}


/* Product dimming for strict diet filter */
.product-card.dimmed {
    display: none;
    transition: all 0.3s ease;
}

.product-card.highlighted {
    /* No special styling - just normal display */
    transition: all 0.3s ease;
}

#strict-diet-modal .modal-content,
.strict-diet-modal .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    min-width: 95vw !important;
    max-height: 90vh !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#strict-diet-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#strict-diet-modal .modal-footer {
    flex-shrink: 0;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
    margin-top: 15px;
}

.strict-diet-info {
    background: #fff3e0;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.strict-diet-info p {
    margin: 5px 0;
    color: #555;
    font-size: 14px;
}

.strict-diet-selection {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
    min-height: 0;
}

#strict-diet-products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.strict-diet-product-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.strict-diet-product-card:hover {
    border-color: #ff9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
    transform: translateY(-2px);
}

.strict-diet-product-card.selected {
    border-color: #4caf50;
    background: #e8f5e9;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.strict-diet-product-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4caf50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.strict-diet-product-card h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.strict-diet-product-card .category-label {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 8px;
}

.strict-diet-product-card .nutrient-mini {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
}

.strict-diet-summary {
    margin-top: 15px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 6px;
    text-align: center;
    flex-shrink: 0;
}

.strict-diet-summary strong {
    color: #1976d2;
    font-size: 16px;
}

.strict-diet-summary #selected-count {
    color: #ff9800;
    font-size: 18px;
    font-weight: bold;
}


/* Edit Modal Specific Styles */
#edit-modal .modal-content {
    width: 700px !important;
    max-width: 95vw !important;
    min-width: 320px !important;
}

#edit-modal .source-info.nutrients span,
#add-product-modal #nutrient-labels {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

#edit-modal .nutrient-tag,
#add-product-modal .nutrient-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#edit-modal .nutrient-tag.potassium,
#add-product-modal .nutrient-tag.potassium {
    border-color: #2196f3;
    color: #2196f3;
}

#edit-modal .nutrient-tag.phosphorus,
#add-product-modal .nutrient-tag.phosphorus {
    border-color: #ff9800;
    color: #ff9800;
}

#edit-modal .nutrient-tag.sodium,
#add-product-modal .nutrient-tag.sodium {
    border-color: #f44336;
    color: #f44336;
}

#edit-modal .nutrient-tag .label,
#add-product-modal .nutrient-tag .label {
    font-weight: 600;
}

#edit-modal .nutrient-tag .value,
#add-product-modal .nutrient-tag .value {
    font-weight: 500;
}

.source-info {
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.source-info strong {
    color: #333;
}

.source-info .fdc-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.source-info .fdc-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Add Product Modal - wider */
#add-product-modal .modal-content {
    width: 796px !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    overflow-y: auto;
}

#add-product-modal .modal-content::-webkit-scrollbar {
    width: 8px;
}

#add-product-modal .modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#add-product-modal .modal-content::-webkit-scrollbar-thumb {
    background: #4caf50;
    border-radius: 4px;
}

#add-product-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #45a049;
}

/* Modal animations and colors */
.modal.show .modal-content {
    animation: editingGlow 1.5s infinite alternate;
}

.modal.forbidden .modal-content {
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
    border: 3px solid #e74c3c;
}

.modal.forbidden.show .modal-content {
    animation: editingGlowRed 1.5s infinite alternate;
}

@keyframes editingGlow {
    from {
        box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
        border-color: #4caf50;
    }
    to {
        box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
        border-color: #66bb6a;
    }
}

@keyframes editingGlowRed {
    from {
        box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
        border-color: #e74c3c;
    }
    to {
        box-shadow: 0 6px 25px rgba(192, 57, 43, 0.6);
        border-color: #c0392b;
    }
}

.modal.forbidden .modal-body textarea:focus {
    border-color: #e74c3c;
}

.modal.forbidden .btn-primary {
    background: #4caf50;
    color: white;
}

.modal.forbidden .btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
}

/* Translatable elements */
#product-name-en,
#detected-name-en {
    font-weight: 500;
    color: #444;
}

.translatable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(33, 150, 243, 0.05);
    border-bottom: 1px dashed #2196f3;
}

.translatable:hover {
    background: rgba(33, 150, 243, 0.1);
    border-bottom: 1px solid #2196f3;
}

/* Inline select for category editing */
.inline-select {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #ddd;
    color: #333;
    background: white;
    margin-left: 4px;
    min-width: 100px;
    transition: all 0.2s ease;
}

.inline-select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.inline-select:hover {
    border-color: #999;
}

/* Medical Analysis Styles */
.analysis-controls {
    display: flex;
    justify-content: center;
    margin: 12px 0 4px 0;
}

.medical-analysis {
    margin-top: 16px;
    margin-bottom: 18px;
    padding: 20px 22px;
    background: #f9fbff;
    border-radius: 12px;
    font-size: 13px;
    color: #1f2937;
    border: 2px solid #2563eb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.medical-analysis > strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 12px;
}

.medical-analysis strong {
    color: inherit;
    font-weight: 600;
}

.analysis-section + .analysis-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5edff;
}

.analysis-title {
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 6px;
}

.analysis-answer {
    margin-bottom: 8px;
    padding-left: 2px;
}

.analysis-list {
    margin: 0 0 10px 0;
    padding-left: 0;
    list-style: none;
}

.analysis-list li {
    margin-bottom: 6px;
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
}

.analysis-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: #2563eb;
}

.analysis-paragraph {
    margin-bottom: 8px;
}

.analysis-section:last-child .analysis-paragraph:last-child,
.analysis-section:last-child .analysis-answer:last-child,
.analysis-section:last-child .analysis-list:last-child {
    margin-bottom: 0;
}

#medical-analysis-content {
    line-height: 1.55;
}

#medical-analysis-content strong {
    color: #1d4ed8;
}

#medical-analysis-content em {
    font-style: italic;
    color: #424242;
}

#medical-analysis-content br {
    margin-bottom: 4px;
}

/* Desktop modal widths - ensure correct sizing on large screens */
@media (min-width: 769px) {
    #edit-modal .modal-content {
        width: 700px !important;
        min-width: 320px !important;
    }

    #add-product-modal .modal-content {
        width: 796px !important;
    }
}

/* Saved Recipes Modal Styles */
.recipes-modal .close-btn {
    color: #333 !important;
    font-size: 24px !important;
    font-weight: bold;
}

.recipes-modal .close-btn:hover {
    color: #f44336 !important;
}

.recipes-content {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

#saved-recipes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    width: 100%;
}

.saved-recipe-item {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.saved-recipe-item:hover {
    border-color: #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

.recipe-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #fff;
    color: #f44336;
    border: 2px solid #f44336;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.recipe-delete-btn:hover {
    background: #f44336;
    color: white;
    transform: scale(1.1);
}

/* Убираем синий фокус и box-shadow для всех кнопок и иконок во вкладке рацион */
.diet-plan-content button:focus,
.diet-plan-content .category-btn:focus,
.diet-plan-content .diet-generate-btn:focus,
.diet-plan-content .strict-diet-icon-btn:focus,
.diet-plan-content .doctor-info-btn:focus,
.diet-plan-content .recipes-btn:focus,
.diet-plan-content svg:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ===== DIET LOGS MODAL STYLES ===== */

.diet-logs-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    border-radius: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
}

.diet-logs-modal .modal-body {
    flex: 1;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.diet-logs-content {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 30px;
    background: #ffffff;
    /* Enable smooth scrolling within modal */
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* Diet logs modal specific header/footer */
.diet-logs-modal .modal-header {
    padding: 20px 30px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
}

.diet-logs-modal .modal-header .header-title {
    text-align: center;
    background: white;
    color: #333;
    padding: 12px 24px;
    border-radius: 6px;
    border: 2px solid #4caf50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.diet-logs-modal .modal-header .close-btn {
    color: white;
    position: absolute;
    right: 20px;
}

.diet-logs-modal .modal-header .close-btn:hover {
    opacity: 0.8;
}

.diet-logs-modal .modal-header #refresh-diet-logs {
    position: absolute;
    left: 20px;
}

/* History List Styles */
.history-header-bar {
    background: white;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-header-bar h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-date {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.history-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.history-status.status-ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.history-status.status-issues {
    background: #fff3e0;
    color: #e65100;
}

.history-item-info {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.history-item-version {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Log Details Styles */
.log-details {
    animation: fadeIn 0.3s ease;
}

.log-details h3 {
    color: #4caf50;
    margin-bottom: 20px;
    font-size: 24px;
}

.log-details h4 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.log-details h5 {
    color: #666;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 16px;
}

.log-details-meta {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.meta-item {
    font-size: 14px;
}

.meta-item strong {
    color: #666;
    margin-right: 5px;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.log-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.log-section:last-child {
    border-bottom: none;
}

.validation-issues {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.validation-issues li {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.product-candidates {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-candidates li {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    color: #1976d2;
}

.meal-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
}

.dish-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

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

.dish-header strong {
    color: #333;
    font-size: 15px;
}

.variant-badge {
    background: #e0e0e0;
    color: #666;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.new-product-badge {
    font-size: 16px;
    margin-left: 5px;
}

.dish-ingredients {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.json-display {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.log-section details {
    cursor: pointer;
}

.log-section details summary {
    display: flex;
    align-items: center;
    user-select: none;
}

.log-section details summary h4 {
    margin: 0;
    display: inline;
}

.log-section details[open] summary {
    margin-bottom: 15px;
}

/* Loading and Error States */
.loading, .no-data, .error-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.error-message {
    color: #f44336;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Back button on white background */
.back-button-white {
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.back-button-white:hover {
    background: #45a049;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.diet-logs-modal .modal-header .close-btn {
    color: white;
    font-size: 32px;
    font-weight: normal;
}

.diet-logs-modal .modal-header .close-btn:hover {
    color: #fff;
    opacity: 0.8;
}

.diet-logs-modal .modal-footer {
    padding: 15px 30px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

/* Two-column layout for meal sections in logs */
.meal-section-logs {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    padding: 15px;
}

.meal-section-logs h5 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #4caf50;
    color: #4caf50;
    font-size: 18px;
    font-weight: 600;
}

.meal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.meal-column {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
}

.column-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e3f2fd;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.no-dishes {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.dish-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
}

.meal-column .dish-item {
    background: #f9f9f9;
}

.meal-column .dish-item:last-child {
    margin-bottom: 0;
}

.dish-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.dish-header strong {
    flex: 1;
    color: #333;
    font-size: 15px;
}

.variant-badge {
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.new-product-badge {
    background: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.dish-ingredients {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    padding-left: 10px;
}

.dish-ingredients p {
    margin: 8px 0;
    text-align: left;
}

.dish-ingredients p:first-child {
    margin-top: 0;
}

.dish-ingredients strong {
    color: #333;
    font-weight: 600;
}

.dish-ingredients .restrictions-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px;
    margin: 10px 0 !important;
    color: #856404;
}

.log-section {
    margin-bottom: 25px;
}

.log-section h4 {
    color: #333;
    font-size: 18px;
    margin-bottom: 12px;
}

.validation-issues, .product-candidates {
    list-style: none;
    padding: 0;
}

.validation-issues li, .product-candidates li {
    background: #f8f9fa;
    border-left: 3px solid #ffc107;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.product-candidates li {
    border-left-color: #4caf50;
}

.json-display {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

details summary {
    cursor: pointer;
    user-select: none;
    padding: 5px 0;
}

details summary h4 {
    display: inline;
}

/* Responsive styles */
@media (max-width: 768px) {
    .diet-logs-content {
        padding: 20px;
    }

    .history-item-info {
        flex-direction: column;
        gap: 5px;
    }

    .log-details-meta {
        grid-template-columns: 1fr;
    }

    .diet-logs-modal .modal-header {
        padding: 15px 20px;
        font-size: 18px;
    }

    .diet-logs-modal .modal-footer {
        padding: 12px 20px;
    }

    /* Stack columns on mobile */
    .meal-columns {
        grid-template-columns: 1fr;
    }
}
