/* Plik: app.css
   Ścieżka: /smartcookfinder/assets/css/app.css
   Rola: Główny arkusz stylów aplikacji SmartCook Finder */

:root {
    --sc-primary:    #e85d04;
    --sc-primary-dk: #c44e00;
    --sc-secondary:  #ffd166;
    --sc-bg:         #f8f9fa;
    --sc-card-bg:    #ffffff;
    --sc-text:       #212529;
    --sc-muted:      #6c757d;
    --sc-border:     #dee2e6;
    --sc-radius:     14px;
    --sc-shadow:     0 2px 16px rgba(0,0,0,.08);
    --sc-shadow-hov: 0 8px 32px rgba(232,93,4,.18);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--sc-bg);
    color: var(--sc-text);
    min-height: 100vh;
}

a { color: var(--sc-primary); text-decoration: none; }
a:hover { color: var(--sc-primary-dk); }

/* ---- Navbar ---- */
.navbar {
    background: #fff !important;
    border-bottom: 1px solid var(--sc-border);
    box-shadow: 0 1px 8px rgba(0,0,0,.05);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--sc-primary) !important;
    letter-spacing: -0.3px;
}

/* ---- Hero ---- */
.hero-section {
    background: linear-gradient(135deg, #fff7f0 0%, #fef3e2 50%, #fce4c8 100%);
    padding: 72px 0 64px;
    border-bottom: 1px solid #fde8cc;
}

.hero-section h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.12;
}

.hero-section h1 span { color: var(--sc-primary); }

.hero-section .lead {
    color: var(--sc-muted);
    font-size: 1.1rem;
    max-width: 480px;
}

/* ---- Search box ---- */
.search-box {
    background: #fff;
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    padding: 32px;
}

.search-textarea {
    border: 2px solid var(--sc-border);
    border-radius: 10px;
    font-size: 1.05rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color .2s, box-shadow .2s;
}

.search-textarea:focus {
    border-color: var(--sc-primary);
    box-shadow: 0 0 0 3px rgba(232,93,4,.12);
    outline: none;
}

.btn-search {
    background: var(--sc-primary);
    color: #fff !important;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: .7rem 1.8rem;
    font-size: 1rem;
    transition: background .2s, transform .1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-search:hover {
    background: var(--sc-primary-dk);
    transform: translateY(-1px);
}

.btn-search:active { transform: translateY(0); }
.btn-search:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Quick tags */
.quick-tag {
    display: inline-block;
    background: #fff3e8;
    color: var(--sc-primary);
    border: 1px solid #ffd6b0;
    border-radius: 50px;
    padding: 5px 14px;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}

.quick-tag:hover,
.quick-tag.active {
    background: var(--sc-primary);
    color: #fff;
    border-color: var(--sc-primary);
}

.all-ingredients-panel {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

/* ---- Feature icons ---- */
.feature-icon { font-size: 2.8rem; }

/* ---- Filter bar ---- */
.filter-bar {
    background: #fff;
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    padding: 16px 20px;
}

.filter-bar .form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--sc-muted);
    margin-bottom: 4px;
}

/* ---- Results header ---- */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.results-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

/* ---- Recipe cards ---- */
.recipe-card {
    background: #fff;
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    border: 1px solid var(--sc-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow .25s, transform .25s;
}

.recipe-card:hover {
    box-shadow: var(--sc-shadow-hov);
    transform: translateY(-3px);
}

.recipe-card-img-wrapper {
    height: 185px;
    background: linear-gradient(135deg, #ffe4c4, #ffd6a0);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.recipe-card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-card-img-placeholder { font-size: 3.5rem; opacity: .45; }

.score-badge-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: .75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 50px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.recipe-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recipe-card-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    line-height: 1.35;
    color: var(--sc-text);
}

.recipe-card-title a {
    color: inherit;
}

.recipe-card-title a:hover {
    color: var(--sc-primary);
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: .8rem;
    color: var(--sc-muted);
}

.recipe-meta span { display: inline-flex; align-items: center; gap: 3px; }

.score-bar-wrapper { margin-top: 2px; }

.ingredients-matched {
    font-size: .8rem;
    color: #198754;
}

.ingredients-matched .label { font-weight: 600; }

.ingredients-missing {
    font-size: .8rem;
    color: #dc3545;
}

.ingredients-missing .label { font-weight: 600; }

.recipe-card-footer {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-cookidoo {
    flex: 1;
    background: var(--sc-primary);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    padding: 7px 12px;
    text-align: center;
    transition: background .2s;
    display: inline-block;
}

.btn-cookidoo:hover { background: var(--sc-primary-dk); }

.btn-favorite {
    background: transparent;
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    font-size: 1.1rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: all .2s;
    line-height: 1;
}

.btn-favorite:hover,
.btn-favorite.active {
    background: #fff3e8;
    border-color: var(--sc-primary);
}

/* ---- Debug box — widoczny TYLKO w trybie admina ---- */
.debug-box {
    background: #fffbf0;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: .73rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 8px;
}

.debug-box strong { color: #333; }

/* ---- Status Cookidoo na karcie (publiczny, spokojny) ---- */
.cookidoo-status-row {
    font-size: .8rem;
    margin-bottom: 4px;
}

.cookidoo-status-ok {
    color: #198754;
    font-weight: 600;
}

.cookidoo-status-none {
    color: var(--sc-muted);
    line-height: 1.4;
    display: block;
}

/* ---- Przycisk Cookidoo — niedostępny (disabled) ---- */
.btn-cookidoo-disabled {
    background: #f0f0f0 !important;
    color: #aaa !important;
    border: 1px solid #ddd !important;
    cursor: not-allowed !important;
    opacity: 1;
    font-weight: 500;
}

.btn-cookidoo-disabled:hover { background: #f0f0f0 !important; }

/* ---- Legacy alias ---- */
.btn-cookidoo-missing {
    flex: 1;
    background: #f8f9fa;
    color: var(--sc-muted);
    border: 1px dashed var(--sc-border);
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 500;
    padding: 7px 12px;
    text-align: center;
    display: inline-block;
}

/* ---- No results ---- */
.no-results {
    text-align: center;
    padding: 80px 20px;
}

.no-results-icon { font-size: 4rem; margin-bottom: 16px; }

/* ---- Recipe detail ---- */
.recipe-detail-header {
    background: linear-gradient(135deg, #fff7f0, #fce4c8);
    border-radius: var(--sc-radius);
    padding: 32px;
}

/* ---- Footer ---- */
footer {
    background: #fff;
    border-top: 1px solid var(--sc-border);
    padding: 24px 0;
    margin-top: 48px;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.col:nth-child(1) .recipe-card { animation: fadeInUp .3s ease both; }
.col:nth-child(2) .recipe-card { animation: fadeInUp .3s .05s ease both; }
.col:nth-child(3) .recipe-card { animation: fadeInUp .3s .10s ease both; }
.col:nth-child(4) .recipe-card { animation: fadeInUp .3s .15s ease both; }
.col:nth-child(5) .recipe-card { animation: fadeInUp .3s .20s ease both; }
.col:nth-child(6) .recipe-card { animation: fadeInUp .3s .25s ease both; }

/* ---- Admin styles ---- */
.admin-sidebar {
    width: 220px;
    min-height: 100vh;
    background: #1a1a2e;
    flex-shrink: 0;
}

.admin-sidebar .brand {
    color: var(--sc-primary);
    font-weight: 800;
    font-size: 1.05rem;
    padding: 20px 16px 8px;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,.7);
    border-radius: 8px;
    margin: 1px 8px;
    padding: 8px 12px;
    font-size: .9rem;
    transition: all .15s;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.admin-sidebar .nav-link.danger { color: rgba(255,100,100,.8); }
.admin-sidebar .nav-link.danger:hover { background: rgba(255,50,50,.15); color: #ff8080; }

.admin-main {
    flex: 1;
    background: var(--sc-bg);
    min-height: 100vh;
    padding: 28px;
}

.admin-stat {
    background: #fff;
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    padding: 20px;
    text-align: center;
}

/* ---- Responsive ---- */
@media (max-width: 576px) {
    body { overflow-x: hidden; }

    .navbar .container {
        gap: .75rem;
    }

    .navbar-brand {
        font-size: 1.05rem;
    }

    .navbar form {
        order: 3;
        flex-basis: 100%;
        margin: 0 !important;
    }

    .hero-section { padding: 40px 0 32px; }

    .hero-section .d-flex {
        flex-wrap: wrap;
    }

    .search-box {
        padding: 20px;
        border-radius: 16px;
    }

    .quick-tag {
        padding: 7px 14px;
        font-size: .88rem;
    }

    .all-ingredients-panel {
        max-height: 220px;
        border-top: 1px solid #f1e1d0;
        padding-top: 12px;
    }

    .filter-bar .ms-md-auto {
        width: 100%;
    }

    .filter-bar .ms-md-auto .btn {
        flex: 1;
    }

    .recipe-card-img-wrapper { height: 150px; }

    .recipe-card-footer {
        flex-wrap: wrap;
    }

    .btn-cookidoo {
        flex-basis: calc(100% - 52px);
    }

    .admin-sidebar { width: 180px; }
    .admin-main { padding: 16px; }
}
