/* ==============================================
   RESET & ZÁKLADNÍ NASTAVENÍ
   ============================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f5f5f5;
}


/* ==============================================
   LOADING OVERLAY
   ============================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.loading-box {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90%;
    width: 350px;
}

.loading-box p {
    margin: 15px 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.spinner {
    margin: 0 auto;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top-color: #2ecc71;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ==============================================
   TOP BAR & NAVIGACE
   ============================================== */
.top-bar {
    background-color: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e67e22;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active-page {
    color: #e67e22;
}

.nav-links a.active-page {
    border-bottom: 2px solid #e67e22;
    padding-bottom: 4px;
}

/* Mobilní odkaz "Přísady" — skrytý na desktopu */
.mobile-only {
    display: none;
}

.mobile-link {
    color: #e67e22;
    font-weight: bold;
}


/* ==============================================
   LAYOUT — HLAVNÍ KONTEJNER (index.html)
   ============================================== */
.app-container {
    display: flex;
    flex: 1;
}


/* ==============================================
   SIDEBAR
   ============================================== */
.side-bar {
    width: 300px;
    background-color: white;
    border-right: 1px solid #ddd;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fridge-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fridge-section h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.ingredient-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.date-of-expiration {
    display: flex;
    gap: 2%;
}

.btn-add {
    width: 100%;
    padding: 0.75rem;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-add:hover {
    background-color: #219653;
}

.ingredients-list {
    flex: 1;
    border: 2px dashed #ccc;
    border-radius: 4px;
    padding: 1rem;
    background-color: #eee;
    overflow-y: auto;
}

.empty-fridge-text {
    text-align: center;
    color: #aaa;
}


/* ==============================================
   POLOŽKY V LEDNICI (harmonika)
   ============================================== */
.fridge-item {
    background-color: #fff;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    border-left: 4px solid #27ae60;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.2s;
}

.fridge-item:hover {
    background-color: #fcfcfc;
}

.fridge-item.expired {
    border-left-color: #e74c3c;
}

.fridge-item.expired .item-name {
    color: #c0392b;
}

.fridge-item-summary {
    padding: 0.75rem;
}

.item-name {
    font-weight: bold;
    color: #2c3e50;
}

/* Detaily (datum + smazat) — skryté, otevírají se kliknutím */
.fridge-item-details {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem 0.75rem;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.fridge-item-details.active {
    display: flex;
}

.item-expiry {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 500;
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem;
    transition: transform 0.2s;
}

.btn-delete:hover {
    transform: scale(1.2);
}


/* ==============================================
   HLAVNÍ OBSAH & MŘÍŽKA RECEPTŮ
   ============================================== */
.main-content {
    flex: 1;
    padding: 2rem;
}

.recipes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
}

.empty-recipes-text,
.loading-text {
    grid-column: 1 / -1;
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}


/* ==============================================
   KARTY RECEPTŮ
   ============================================== */
.recipe-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.recipe-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recipe-img-placeholder {
    width: 100%;
    height: 150px;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.recipe-info {
    padding: 1rem;
}

.recipe-category {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.recipe-ingredient-counter {
    font-size: 0.85rem;
    color: #27ae60;
    font-weight: 500;
    margin: 0.25rem 0;
}

.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}


/* ==============================================
   TLAČÍTKO OBLÍBENÝCH (srdíčko)
   ============================================== */
.btn-fav {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    padding: 0;
}

.btn-fav:hover {
    transform: scale(1.2);
    color: #e74c3c;
}

.btn-fav.is-favourite {
    color: #e74c3c;
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}


/* ==============================================
   MODAL (detail receptu)
   ============================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

.modal-recipe-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-recipe-header img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.modal-recipe-content h3 {
    color: #2c3e50;
    margin: 1.5rem 0 0.5rem;
}

.modal-recipe-content ul {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
    color: #34495e;
}

.modal-recipe-content li {
    margin-bottom: 0.25rem;
}

.recipe-instructions {
    line-height: 1.6;
    color: #34495e;
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}

.modal-content hr {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 2rem 0 1.5rem;
}


/* ==============================================
   KOMENTÁŘE
   ============================================== */
.comments-section h3 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.comments-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
    background: #f5f5f5;
    padding: 0.5rem;
    border-radius: 6px;
}

.comment-item {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.comment-content {
    flex: 1;
}

.comment-body {
    margin: 0 0 0.25rem;
    color: #2c3e50;
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.75rem;
    color: #95a5a6;
}

.no-comments {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    font-size: 0.9rem;
    padding: 1rem 0;
}

.comment-form textarea {
    width: 100%;
    height: 80px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #e67e22;
}

.btn-delete-comment {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.3rem;
    opacity: 0.6;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-delete-comment:hover {
    transform: scale(1.2);
    opacity: 1;
}


/* ==============================================
   OBLÍBENÉ (Favourites.html)
   ============================================== */
.recipes-grid.is-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.no-favourites-message {
    text-align: center;
    background-color: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    max-width: 400px;
    width: 100%;
}

.message-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.no-favourites-message p {
    color: #555;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.btn-browse {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #e67e22;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-browse:hover {
    background-color: #d35400;
}


/* ==============================================
   NEWSLETTER (Newsletter.html)
   ============================================== */
.newsletter-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 2rem 1rem;
}

.form-container {
    background-color: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    max-width: 600px;
    width: 100%;
}

.form-container h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.form-subtitle {
    color: #7f8c8d;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
    width: 100%;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #34495e;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"] {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #e67e22;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
}

.checkbox-group label,
.checkbox-gdpr label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.input-error {
    border: 2px solid #ff4d4d !important;
}

.error-message {
    display: none;
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.success-message {
    text-align: center;
    padding: 2rem;
}

.btn-newsletter {
    width: 100%;
    margin-top: 15px;
    padding: 12px 24px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.2s;
}

.btn-newsletter:hover {
    background-color: #27ae60;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.btn-newsletter:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}


/* ==============================================
   PŘÍSADY — MOBILNÍ STRÁNKA (Resources.html)
   ============================================== */
.resources-page {
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.resources-container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.resources-header h2 {
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.resources-header p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.ingredients-list-full {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ingredients-list-full h3 {
    color: #34495e;
    font-size: 1.1rem;
    border-bottom: 2px solid #f5f5f5;
    padding-bottom: 0.5rem;
}

.ingredients-list-container {
    border: 2px dashed #ccc;
    border-radius: 4px;
    padding: 1rem;
    background-color: #fafafa;
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
}

.btn-find-recipes {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background-color: #e67e22;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 0.5rem;
    transition: background 0.3s;
}

.btn-find-recipes:hover {
    background-color: #d35400;
}

/* Na desktopu zobrazí upozornění místo obsahu stránky */
@media (min-width: 769px) {
    .resources-page {
        position: relative;
    }

    .resources-container::before {
        content: "Pro správu přísad použijte Sidebar na hlavní stránce.";
        position: absolute;
        inset: 0;
        background-color: #f5f5f5;
        color: #7f8c8d;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.2rem;
        font-weight: 500;
        text-align: center;
        padding: 2rem;
    }
}


/* ==============================================
   RESPONZIVITA — MOBIL (max 768px)
   ============================================== */
@media (max-width: 768px) {
    .top-bar {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .nav-links {
        gap: 0.6rem;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 2px 0;
    }

    .nav-links a.active-page {
        border-bottom-width: 1px;
        padding-bottom: 2px;
    }

    /* Layout */
    .app-container {
        flex-direction: column;
    }

    .side-bar {
        width: 100%;
        display: none;
    }

    .mobile-only {
        display: block;
    }

    /* Hlavní obsah */
    .main-content {
        padding: 1rem 0.75rem;
    }

    /* Mřížka — 2 karty vedle sebe */
    .recipes-grid {
        gap: 0.75rem;
    }

    .recipe-card {
        width: calc(50% - 0.375rem);
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }

    .recipe-img,
    .recipe-img-placeholder {
        height: 120px;
    }

    .recipe-info {
        padding: 0.5rem;
    }

    .recipe-info h4 {
        font-size: 0.95rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }

    .recipe-ingredient-counter {
        font-size: 0.75rem;
    }

    .recipe-meta {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }

    .btn-fav {
        font-size: 1.1rem;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }

    /* Newsletter form */
    .form-row {
        flex-wrap: wrap;
    }
}