:root {
    --primary-color: #e63946;
    --bg-color: #fdfbf7;
    --text-color: #2d1e17;
    --accent-color: #457b9d;
    --card-bg: #ffffff;
}

.app-container {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    position: relative;
}

@media (min-width: 768px) {
    .app-container {
        max-width: 600px;
        margin: 0 auto;
        border-left: 1px solid #eee;
        border-right: 1px solid #eee;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1024px;
    }
}

/* --- Global Animations --- */
.fade-in {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Header --- */
.main-header {
    padding: 20px 20px 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.main-title {
    font-family: 'Pacifico', cursive;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin: 10px 0 10px 0;
    text-align: center;
}

.add-btn-header {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    border-radius: 20px;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

.add-btn-header:active {
    transform: scale(0.95);
}

/* --- Search Bar --- */
.search-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
    padding: 20px 20px 5px 20px;
}

.search-container {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.1);
}

.search-icon {
    font-size: 1.2rem;
    margin-right: 10px;
    opacity: 0.6;
}

.search-input {
    border: none;
    outline: none;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    width: 100%;
    color: var(--text-color);
}

/* --- Filter Pills --- */
.filter-pills-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 20px;
    scrollbar-width: none;
    position: sticky;
    top: 70px;
    z-index: 99;
    background: var(--bg-color);
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
}

.filter-pills-container::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-pill.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 2px 6px rgba(69, 123, 157, 0.4);
}

/* --- Filter Tabs (Yums) --- */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 15px 20px;
    flex-wrap: wrap;
}

.filter-tab {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.filter-tab.active {
    background: rgba(230, 57, 70, 0.1);
    color: var(--primary-color);
    border-color: rgba(230, 57, 70, 0.2);
}

/* --- Recipe List --- */
.recipe-list {
    padding: 15px 20px;
    padding-bottom: 80px;
}

.recipe-card {
    background: white;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
    position: relative;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: rgba(230, 57, 70, 0.1);
}

.recipe-card-thumb {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    margin-right: 16px;
    flex-shrink: 0;
}

.recipe-card-info {
    flex: 1;
    min-width: 0;
}

.recipe-card-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0 0 8px 0;
    color: var(--text-color);
    line-height: 1.2;
}

.recipe-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 6px;
}

.recipe-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.card-tag {
    background: #f0f0f0;
    color: #666;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.recipe-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    height: 80px;
    margin-left: 10px;
}

.yum-btn-mini {
    background: #f5f5f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.yum-btn-mini:active {
    transform: scale(0.8);
}

.yum-btn-mini.active {
    background: #ffebee;
}

.recipe-card-arrow {
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0.5;
    margin-top: auto;
}

/* --- Detail View --- */
.detail-view {
    background: var(--bg-color);
    min-height: 100vh;
    padding-bottom: 40px;
}

.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 110;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: none;
    padding: 10px 16px;
    border-radius: 30px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    color: var(--text-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-header {
    position: relative;
}

.detail-image-container {
    width: 100%;
    height: 300px;
    overflow: hidden;
    position: relative;
    clip-path: ellipse(150% 100% at 50% 0%);
}

.detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yum-fab {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s;
}

.yum-fab:active {
    transform: scale(0.9);
}

.detail-title {
    font-family: 'Pacifico', cursive;
    font-size: 2.2rem;
    text-align: center;
    color: var(--primary-color);
    margin: 80px 20px 10px 20px;
    line-height: 1.2;
}

.detail-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 0 20px;
}

.detail-tag {
    background: rgba(69, 123, 157, 0.1);
    color: var(--accent-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.detail-meta-overlay {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.meta-pill {
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.detail-content {
    padding: 0 25px;
    max-width: 100%;
    box-sizing: border-box;
}

.section-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 3px solid rgba(69, 123, 157, 0.2);
    padding-bottom: 8px;
    margin-top: 30px;
    margin-bottom: 20px;
}

.ingredients-grid {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.ingredient-item {
    background: white;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ingredient-emoji {
    font-size: 2rem;
    margin-bottom: 5px;
}

.ingredient-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    line-height: 1.3;
}

.steps-list {
    list-style: none;
    padding: 0;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    margin-bottom: 25px;
    padding-left: 50px;
}

.step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: 'Pacifico', cursive;
    box-shadow: 0 3px 6px rgba(230, 57, 70, 0.3);
}

.step-text {
    margin: 0;
    line-height: 1.6;
    color: #444;
    font-size: 1.05rem;
}

/* --- Comments Section Styles --- */
.section-comments {
    margin-top: 40px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.comment-bubble {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
}

.comment-date {
    color: #888;
    font-size: 0.8rem;
    font-weight: 400;
}

.comment-text {
    margin: 5px 0 0 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #555;
}

.no-comments {
    font-style: italic;
    color: #888;
    text-align: center;
}

.add-comment-form {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.add-comment-form h4 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.form-group {
    margin-bottom: 15px;
}

.comment-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    box-sizing: border-box;
    background: #fafafa;
}

.star-rating {
    display: flex;
    gap: 5px;
    font-size: 1.5rem;
    cursor: pointer;
}

.star {
    color: #ddd;
    transition: color 0.2s;
}

.star.filled {
    color: #FFD700;
}

.star.readonly {
    cursor: default;
    font-size: 1rem;
}

.submit-comment-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(230, 57, 70, 0.3);
    width: 100%;
    transition: transform 0.2s;
}

.submit-comment-btn:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}

.submit-comment-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

/* --- Add Recipe Form Styles --- */
.add-recipe-view {
    padding: 20px;
    padding-bottom: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.add-recipe-form {
    padding-bottom: 40px;
}

.form-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-section.half {
    flex: 1;
}

.form-label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    outline: none;
    background: #fafafa;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--primary-color);
    background: #fff;
}

.form-range {
    width: 100%;
    accent-color: var(--primary-color);
}

.ingredient-input-row,
.step-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.form-input.qty {
    width: 70px;
}

.form-input.unit {
    width: 100px;
}

.form-input.name {
    flex: 1;
}

.remove-btn {
    background: #ffeeee;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: bold;
}

.add-btn {
    background: transparent;
    border: 2px dashed #ddd;
    color: #888;
    padding: 10px;
    width: 100%;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 5px;
}

.add-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.step-idx {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 10px;
}

.tag-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.add-tag-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.tags-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-tag {
    background: rgba(69, 123, 157, 0.1);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

.preview-tag button {
    border: none;
    background: none;
    font-weight: bold;
    cursor: pointer;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.submit-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 100%;
    padding: 16px;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
    margin-bottom: 50px;
    transition: transform 0.2s;
}

.submit-btn:hover {
    transform: translateY(-2px);
}

.submit-btn:active {
    transform: scale(0.98);
}


/* --- Chat / AI Coach Styles --- */
.chat-fab-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 30px;
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4);
    cursor: pointer;
    z-index: 200;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-fab-btn:hover {
    transform: scale(1.1);
}

.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chat-window {
    width: 100%;
    max-width: 600px;
    height: 80vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-family: 'Pacifico', cursive;
    font-weight: normal;
    font-size: 1.5rem;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfbf7;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.message-bubble.model {
    background: white;
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message-bubble.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(230, 57, 70, 0.2);
}

.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 30px;
    border: 1px solid #ddd;
    font-family: 'Nunito', sans-serif;
    outline: none;
    font-size: 1rem;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.chat-send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send-btn:disabled {
    background: #ccc;
}