:root {
    --primary-green: #7FB069;
    --dark-green: #5a8049;
    --soft-beige: #FFF9E6;
    --warm-cream: #F5EBD9;
    --text-dark: #2C3E2F;
    --text-gray: #666;
    --border-light: #E8DCC4;
    --shadow-light: rgba(127, 176, 105, 0.1);
    --white: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    background: var(--soft-beige);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Search Container */
.search-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px var(--shadow-light);
    margin-bottom: 30px;
}

.header {
    text-align: center;
    margin-bottom: 25px;
}

.header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

#ingredientInput {
    flex: 1;
    padding: 14px 18px;
    font-size: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

#ingredientInput:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px var(--shadow-light);
}

#searchBtn {
    padding: 14px 30px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#searchBtn:hover {
    background: var(--dark-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

#searchBtn:active {
    transform: translateY(0);
}

/* Status Message */
.status-message {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 15px;
    display: none;
}

.status-message.info {
    background: #E3F2FD;
    color: #1976D2;
    border-left: 4px solid #1976D2;
}

.status-message.success {
    background: #E8F5E9;
    color: #388E3C;
    border-left: 4px solid #388E3C;
}

.status-message.warning {
    background: #FFF3E0;
    color: #F57C00;
    border-left: 4px solid #F57C00;
}

.status-message.error {
    background: #FFEBEE;
    color: #D32F2F;
    border-left: 4px solid #D32F2F;
}

/* Results Container */
.results-container {
    min-height: 200px;
}

.results-header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.results-header h3 {
    font-family: 'Playfair Display', serif;
    color: var(--text-dark);
    font-size: 1.5rem;
}

/* No Results */
.no-results {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.no-results p {
    margin-bottom: 10px;
    color: var(--text-gray);
}

.no-results .hint {
    font-size: 0.9rem;
    font-style: italic;
    color: #999;
}

/* Category Section */
.category-section {
    margin-bottom: 35px;
}

.category-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-green);
}

/* Products Grid - Layout vertical (fila) */
.products-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 12px var(--shadow-light);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px var(--shadow-light);
}

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

.product-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--text-dark);
    line-height: 1.3;
    flex: 1;
}

.product-price {
    font-weight: 700;
    color: var(--primary-green);
    font-size: 1.1rem;
    white-space: nowrap;
}

.product-description {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.product-format {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 12px;
    font-style: italic;
}

/* Ingredient Context (legacy) */
.ingredient-context {
    background: var(--warm-cream);
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    border-left: 3px solid var(--primary-green);
}

.ingredient-context strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.ingredient-context p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-gray);
}

.ingredient-context mark {
    background: #FFE082;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Ingredient Section (new - full display) */
.ingredient-section {
    background: #FFF9E6;
    padding: 14px;
    border-radius: 10px;
    margin: 14px 0;
    border-left: 4px solid var(--primary-green);
}

.ingredient-section strong {
    display: block;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 600;
}

.ingredient-text {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.ingredient-text mark {
    background: #FFD54F;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 700;
    color: var(--text-dark);
}

.ingredient-text br {
    display: block;
    margin: 4px 0;
    content: "";
}

/* Info Buttons */
.info-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.info-btn {
    padding: 8px 14px;
    background: var(--warm-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.info-btn:hover {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
    transform: translateY(-1px);
}

/* Buy Button */
.buy-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--primary-green);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    margin-top: auto;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    background: var(--dark-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid var(--border-light);
}

.modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0;
}

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

.modal-close:hover {
    background: var(--soft-beige);
    color: var(--text-dark);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.modal-text {
    line-height: 1.8;
    color: var(--text-dark);
    white-space: pre-line;
}

.modal-loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 3px solid var(--soft-beige);
    border-top: 3px solid var(--primary-green);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-loading p {
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .search-container {
        padding: 20px;
    }

    .header h2 {
        font-size: 1.6rem;
    }

    .search-box {
        flex-direction: column;
    }

    #searchBtn {
        width: 100%;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        max-width: 100%;
        max-height: 90vh;
    }

    .modal-header h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .header h2 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    #ingredientInput {
        font-size: 0.95rem;
        padding: 12px 16px;
    }

    .info-buttons {
        flex-direction: column;
    }

    .info-btn {
        width: 100%;
    }
}
