/* Chat with AI Chef Styles */

/* Chat Container */
.chat-container {
    height: calc(100vh - 180px); /* Header(56) + tab-header(40) + input(70) + nav(64) ≈ 230 */
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 95%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    animation: messageAppear 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    background: #4CAF50;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    align-self: flex-start;
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-message.ai.typing {
    font-style: italic;
    color: #666;
}

.chat-message.ai.typing .dots {
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    80%, 100% { opacity: 0; }
}

/* Recipe Notification */
.recipe-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 15px;
    max-width: 300px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

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

.recipe-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.recipe-icon {
    font-size: 32px;
}

.btn-view-recipe {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.btn-view-recipe:hover {
    background: #45a049;
}

/* Recipes List */
.recipes-list {
    padding: 20px;
}

.recipes-list h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
}

.no-recipes {
    text-align: center;
    color: #666;
    padding: 40px;
}

.recipe-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.recipe-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.recipe-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.recipe-meta {
    font-size: 13px;
    color: #666;
}

.btn-cook {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

/* Recipe Detail Card */
.recipe-detail-card {
    background: white;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

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

.recipe-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
    flex: 1;
    margin-right: 10px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recipe-meta-bar {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.recipe-meta-bar span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.difficulty {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.difficulty.easy {
    background: #d4edda;
    color: #155724;
}

.difficulty.medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty.hard {
    background: #f8d7da;
    color: #721c24;
}

.recipe-description {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Recipe Sections */
.recipe-section {
    margin-bottom: 25px;
}

.recipe-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Checkboxes */
.ingredients-checklist,
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item,
.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-item:hover,
.step-item:hover {
    background: #e9ecef;
}

.checkbox-item.completed,
.step-item.completed {
    background: #d4edda;
    text-decoration: line-through;
    opacity: 0.7;
}

.checkbox-item.missing {
    background: #fff3cd;
}

.checkbox-item input,
.step-item input {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #4CAF50;
}

.item-text {
    flex: 1;
}

.stock-status {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

.step-number {
    background: #4CAF50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

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

/* Tips Section */
.recipe-section.tips {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 10px;
}

.recipe-section.tips h4 {
    color: #1565c0;
}

.recipe-section.tips ul {
    margin: 0;
    padding-left: 20px;
}

.recipe-section.tips li {
    margin-bottom: 8px;
    color: #333;
}

/* Actions */
.recipe-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn-primary {
    flex: 1;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-secondary {
    flex: 1;
    padding: 15px 25px;
    background: white;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.btn-secondary:hover {
    border-color: #4CAF50;
    color: #4CAF50;
}

/* Progress */
.recipe-progress {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: #666;
    display: block;
    margin-bottom: 15px;
}

.btn-complete {
    width: 100%;
    padding: 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-complete:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-complete:not(:disabled):hover {
    background: #45a049;
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 15px;
}

.quick-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-chip {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-chip:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    gap: 10px;
    margin: 5px;  
    position: fixed;
    bottom: 64px; /* Above bottom-nav (64px) */
    left: 0;
    right: 0;
    padding: 8px 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    z-index: 100;
    height: 60px;
    box-sizing: border-box;
}

#meal-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
}

#meal-input:focus {
    border-color: #4CAF50;
}

.btn-send {
    width: 45px;
    height: 45px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    background: #45a049;
}

/* My Recipes Button */
.btn-recipes {
    background: #fff;
    border: 2px solid #4CAF50;
    color: #4CAF50;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-recipes:hover {
    background: #4CAF50;
    color: white;
}

/* Tab Header with recipes button */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tab-header h2 {
    margin: 0;
    font-size: 20px;
}

/* Chat date separator */
.chat-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    position: relative;
}

.chat-date-separator::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
}

.chat-date-separator span {
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: #888;
    position: relative;
    z-index: 1;
}

/* Collapsible sections in AI messages */
.chat-collapsible {
    margin: 8px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.chat-collapsible-header {
    background: #f0f0f0;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    user-select: none;
}

.chat-collapsible-header::before {
    content: '▶';
    font-size: 10px;
    transition: transform 0.2s;
}

.chat-collapsible.open .chat-collapsible-header::before {
    transform: rotate(90deg);
}

.chat-collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.chat-collapsible.open .chat-collapsible-content {
    max-height: 500px;
    padding: 10px 12px;
}

/* Chat text blocks */
.chat-text {
    margin: 8px 0;
    line-height: 1.5;
}

/* Collapsible content lists */
.chat-collapsible-content ul {
    margin: 0;
    padding-left: 20px;
}

.chat-collapsible-content li {
    margin: 4px 0;
    line-height: 1.5;
}

/* Recipe cards from suggested_recipes */
.recipe-cards-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.recipe-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s;
}

.recipe-card.can-cook {
    border-color: #4CAF50;
    background: #f8fff8;
}

.recipe-card.need-shopping {
    border-color: #ff9800;
    background: #fffbf5;
}

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

.recipe-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.recipe-cost {
    font-size: 13px;
    color: #666;
}

.recipe-card-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.recipe-status.can {
    color: #4CAF50;
}

.recipe-status.need {
    color: #ff9800;
}

.btn-recipe-details {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.btn-recipe-details:hover {
    background: var(--primary-dark);
}
