/* ============================================
   CliqHealth Recipe Cookbook - Styles
   ============================================ */

/* CSS Reset & Variables */
:root {
    --primary: #2d8a4e;
    --primary-dark: #1e6b3a;
    --secondary: #e8735a;
    --accent: #f4a261;
    --cancer: #9b59b6;
    --weight-loss: #27ae60;
    --menopause: #e74c8b;
    --pcos: #3498db;
    --heart: #e74c3c;
    --diabetes: #f39c12;
    --mental: #8e44ad;
    --muscle: #d35400;
    --joint: #16a085;
    --gut: #2ecc71;
    --immune: #e67e22;
    --bg: #fafbfc;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #6c757d;
    --border: #e9ecef;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
    --radius: 12px;
    --transition: all 0.3s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hidden {
    display: none !important;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
}

.header-content .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-content .logo i {
    font-size: 2.5rem;
    color: var(--secondary);
}

.header-content .logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
}

.header .tagline {
    margin-top: 8px;
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ============================================
   Disclaimer
   ============================================ */
.disclaimer {
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
    padding: 12px 0;
}

.disclaimer p {
    font-size: 0.85rem;
    color: #856404;
    text-align: center;
}

.disclaimer i {
    margin-right: 6px;
}

/* ============================================
   Health Goals Navigation
   ============================================ */
.health-goals-nav {
    padding: 40px 0 20px;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
}

.goal-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.goal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
}

.goal-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.goal-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.goal-btn[data-goal="cancer"] { --goal-color: var(--cancer); }
.goal-btn[data-goal="weight-loss"] { --goal-color: var(--weight-loss); }
.goal-btn[data-goal="menopause"] { --goal-color: var(--menopause); }
.goal-btn[data-goal="pcos-pcod"] { --goal-color: var(--pcos); }
.goal-btn[data-goal="heart"] { --goal-color: var(--heart); }
.goal-btn[data-goal="diabetes"] { --goal-color: var(--diabetes); }
.goal-btn[data-goal="mental"] { --goal-color: var(--mental); }
.goal-btn[data-goal="muscle"] { --goal-color: var(--muscle); }
.goal-btn[data-goal="joint"] { --goal-color: var(--joint); }
.goal-btn[data-goal="gut"] { --goal-color: var(--gut); }
.goal-btn[data-goal="immune"] { --goal-color: var(--immune); }

.goal-btn[data-goal]:not([data-goal="all"]).active {
    background: var(--goal-color);
    border-color: var(--goal-color);
}

/* ============================================
   Search & Sort
   ============================================ */
.search-section {
    padding: 0 0 30px;
}

.search-section .container {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-bar input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--card-bg);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 138, 78, 0.1);
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls label {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

.sort-controls select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    cursor: pointer;
}

/* ============================================
   Recipe Grid
   ============================================ */
.recipes-section {
    padding: 0 0 60px;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.recipe-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border);
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.recipe-card:focus-within {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.card-header {
    position: relative;
    padding: 24px 20px 16px;
    background: linear-gradient(135deg, rgba(45, 138, 78, 0.05), rgba(45, 138, 78, 0.02));
}

.card-emoji {
    font-size: 3rem;
    margin-bottom: 8px;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.card-goal-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.card-goal-badge.cancer { background: var(--cancer); }
.card-goal-badge.weight-loss { background: var(--weight-loss); }
.card-goal-badge.menopause { background: var(--menopause); }
.card-goal-badge.pcos-pcod { background: var(--pcos); }
.card-goal-badge.heart { background: var(--heart); }
.card-goal-badge.diabetes { background: var(--diabetes); }
.card-goal-badge.mental { background: var(--mental); }
.card-goal-badge.muscle { background: var(--muscle); }
.card-goal-badge.joint { background: var(--joint); }
.card-goal-badge.gut { background: var(--gut); }
.card-goal-badge.immune { background: var(--immune); }

.card-body {
    padding: 0 20px 16px;
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-calories {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.card-qr-icon {
    color: var(--text-light);
    font-size: 1.1rem;
}

.card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 20px 16px;
}

.card-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: rgba(45, 138, 78, 0.1);
    color: var(--primary-dark);
    font-weight: 500;
}

/* ============================================
   No Results
   ============================================ */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: sticky;
    top: 16px;
    float: right;
    margin-right: 16px;
    background: var(--bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--secondary);
    color: white;
}

.modal-body {
    padding: 32px;
}

.modal-header {
    margin-bottom: 24px;
}

.modal-recipe-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 8px;
}

.modal-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-tags .tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.modal-left h3,
.modal-right h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-left h3 i,
.modal-right h3 i {
    color: var(--primary);
}

/* Nutrition Card */
.nutrition-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.85rem;
}

.nutrition-item .label {
    color: var(--text-light);
}

.nutrition-item .value {
    font-weight: 600;
    color: var(--text);
}

/* Health Benefits */
.health-benefits ul {
    list-style: none;
}

.health-benefits li {
    padding: 6px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.health-benefits li::before {
    content: "✓";
    color: var(--primary);
    font-weight: bold;
    flex-shrink: 0;
}

/* Evidence */
.evidence-section {
    margin-bottom: 20px;
}

.evidence-section p {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.6;
}

/* QR Code */
.qr-section {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.qr-section p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.qr-code {
    display: inline-block;
}

.qr-code canvas,
.qr-code img {
    border-radius: 8px;
}

/* Recipe Meta */
.recipe-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.recipe-meta span {
    font-size: 0.85rem;
    color: var(--text-light);
}

.recipe-meta strong {
    color: var(--text);
}

/* Ingredients */
.ingredients-list {
    list-style: none;
    margin-bottom: 20px;
}

.ingredients-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ingredients-list li::before {
    content: "•";
    color: var(--primary);
    font-size: 1.2rem;
}

/* Instructions */
.instructions-list {
    margin-left: 20px;
    margin-bottom: 20px;
}

.instructions-list li {
    padding: 8px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Tips */
.tips-list {
    list-style: none;
}

.tips-list li {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    gap: 8px;
}

.tips-list li::before {
    content: "💡";
    flex-shrink: 0;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-print {
    background: var(--primary);
    color: white;
}

.btn-print:hover {
    background: var(--primary-dark);
}

.btn-share {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border) !important;
}

.btn-share:hover {
    background: var(--border);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--text);
    color: white;
    padding: 48px 0 24px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.footer-brand h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.footer-brand p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer-info h4,
.footer-disclaimer h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--accent);
}

.footer-info ul {
    list-style: none;
}

.footer-info li {
    margin-bottom: 6px;
}

.footer-info a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-info a:hover {
    color: white;
    text-decoration: underline;
}

.footer-disclaimer p {
    font-size: 0.8rem;
    opacity: 0.7;
    line-height: 1.5;
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    opacity: 0.6;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header-content .logo h1 {
        font-size: 1.8rem;
    }

    .goal-filters {
        gap: 8px;
    }

    .goal-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
    }

    .recipe-grid {
        grid-template-columns: 1fr;
    }

    .modal-grid {
        grid-template-columns: 1fr;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-recipe-title {
        font-size: 1.5rem;
    }

    .search-section .container {
        flex-direction: column;
    }

    .search-bar {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .goal-btn span {
        display: none;
    }

    .goal-btn {
        padding: 12px 14px;
        font-size: 1.1rem;
    }

    .header-content .logo h1 {
        font-size: 1.4rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .header, .health-goals-nav, .search-section, .footer, .disclaimer,
    .modal-close, .modal-footer, .qr-section, .modal-overlay {
        display: none !important;
    }

    .modal {
        position: static;
        padding: 0;
    }

    .modal-content {
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }

    .modal-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.recipe-card {
    animation: fadeInUp 0.4s ease backwards;
}

.recipe-card:nth-child(1) { animation-delay: 0.05s; }
.recipe-card:nth-child(2) { animation-delay: 0.1s; }
.recipe-card:nth-child(3) { animation-delay: 0.15s; }
.recipe-card:nth-child(4) { animation-delay: 0.2s; }
.recipe-card:nth-child(5) { animation-delay: 0.25s; }
.recipe-card:nth-child(6) { animation-delay: 0.3s; }
