/* meals.css - Meal Planning Styles */

/* ===== MEAL TAB LAYOUT ===== */
#meals-content {
    overflow-y: auto;
}

#meals-content.active {
    display: flex !important;
    flex-direction: column;
}

.meals-container {
    padding: 20px;
    max-width: 100%;
    margin: 0 10%;
    flex: 1;
    overflow-y: auto;
}

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

.meals-header h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
}

.meals-actions {
    display: flex;
    gap: 10px;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* ===== WEEK VIEW ===== */
.week-meal-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#week-meal-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.week-day-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

.week-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
}

.day-name {
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.9rem;
}

.day-number {
    font-size: 1.2rem;
    color: var(--accent-color);
    font-weight: bold;
}

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

.meal-slot {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.meal-slot.empty {
    cursor: pointer;
    border: 1px dashed var(--border-color);
}

.meal-slot.empty:hover {
    background: var(--hover-overlay);
    border-color: var(--accent-color);
}

.meal-slot.filled {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.meal-time-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

.meal-name {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.add-meal-text {
    color: var(--accent-color);
    font-size: 0.9rem;
}

.remove-meal-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 59, 48, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

.remove-meal-btn:hover {
    background: rgba(255, 59, 48, 1);
    transform: scale(1.1);
}

/* ===== MEAL LIBRARY ===== */
.meals-library-section {
    margin-bottom: 40px;
}

.meal-category {
    margin-bottom: 30px;
}

.category-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid var(--accent-color);
}

.meal-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.meal-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.meal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.meal-card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.meal-card-content {
    padding: 15px;
}

.meal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.meal-card-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.star-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.star-btn.starred,
.star-btn:hover {
    opacity: 1;
}

.meal-notes {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 10px 0;
}

.meal-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-assign,
.btn-delete {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-assign {
    background: var(--accent-color);
    color: white;
}

.btn-assign:hover {
    background: var(--accent-hover);
}

.btn-delete {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.btn-delete:hover {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

/* ===== SPOONACULAR SEARCH ===== */
.spoonacular-section {
    margin-bottom: 40px;
}

.search-controls {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input,
.search-select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
}

.search-input:focus,
.search-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

#spoonacular-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.recipe-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.recipe-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recipe-info {
    padding: 15px;
}

.recipe-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

.recipe-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-save-recipe {
    width: 100%;
    padding: 10px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-save-recipe:hover {
    background: var(--accent-hover);
}

/* ===== WEEK WIDGET (Under Calendar) ===== */
#meals-widget-content {
    padding: 10px 0;
}

.widget-day {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.widget-day:last-child {
    border-bottom: none;
}

.widget-day strong {
    color: var(--accent-color);
    margin-right: 8px;
}

/* ===== MODALS ===== */
.meal-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: normal;
    justify-content: center;
    padding: 20px;
}

.meal-modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    position: relative;
}

.meal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.meal-modal-title {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.meal-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.meal-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.meal-form-group {
    margin-bottom: 20px;
}

.meal-form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.meal-form-input,
.meal-form-select,
.meal-form-textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
}

.meal-form-textarea {
    min-height: 80px;
    resize: vertical;
}

.meal-form-input:focus,
.meal-form-select:focus,
.meal-form-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.meal-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn-modal-cancel {
    flex: 1;
    padding: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-modal-cancel:hover {
    background: var(--hover-overlay);
}

.btn-modal-save {
    flex: 1;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-modal-save:hover {
    background: var(--accent-hover);
}

/* ===== MEAL SELECTOR MODAL ===== */
#meal-selector-list {
    display: grid;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.selectable-meal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.selectable-meal:hover {
    background: var(--hover-overlay);
    transform: translateX(5px);
}

.selector-meal-image {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
}

/* ===== NOTIFICATIONS ===== */
.meal-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent-color);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.meal-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.meal-notification.error {
    background: #ff3b30;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 1.1rem;
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.error-message {
    text-align: center;
    color: #ff3b30;
    padding: 40px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .search-controls {
        grid-template-columns: 1fr;
    }

    #week-meal-view {
        grid-template-columns: 1fr;
    }

    .meal-cards,
    #spoonacular-results {
        grid-template-columns: 1fr;
    }
}
