:root {
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;
    --green-900: #14532d;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px;
}

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

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green-700);
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--gray-500);
    font-size: 1rem;
    margin-top: 4px;
}

/* Search Box */
.search-box {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 16px;
    margin-bottom: 16px;
}

.input-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 48px;
}

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

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-100);
    color: var(--green-800);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: chipIn 0.15s ease-out;
}

@keyframes chipIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.chip button {
    background: none;
    border: none;
    color: var(--green-600);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.chip button:hover {
    opacity: 1;
}

#ingredient-input {
    flex: 1;
    min-width: 200px;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    padding: 8px 0;
    background: transparent;
}

#ingredient-input::placeholder {
    color: var(--gray-400);
}

.search-btn {
    width: 100%;
    margin-top: 12px;
    padding: 14px 24px;
    background: var(--green-600);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.search-btn:hover:not(:disabled) {
    background: var(--green-700);
}

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

.search-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* Results Info */
.results-info {
    padding: 12px 0;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Results Grid */
.results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .results {
        grid-template-columns: repeat(2, 1fr);
    }
}

.recipe-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.15s, transform 0.15s;
}

.recipe-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.recipe-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--gray-200);
}

.recipe-thumb-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--green-100), var(--green-200));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.recipe-content {
    padding: 16px;
}

.recipe-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
    line-height: 1.3;
}

.recipe-match {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--green-50);
    color: var(--green-700);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.recipe-meta {
    display: flex;
    gap: 12px;
    color: var(--gray-500);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.recipe-tag {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
}

.recipe-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recipe-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--green-50);
    color: var(--green-700);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s;
}

.recipe-source:hover {
    background: var(--green-100);
}

.recipe-source::after {
    content: '→';
    opacity: 0.6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 1.5rem;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
    max-width: 400px;
    margin: 0 auto;
}

.example-searches {
    margin-top: 24px;
}

.example-searches p {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.example-btn {
    background: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    margin: 4px;
    transition: border-color 0.15s, color 0.15s;
}

.example-btn:hover {
    border-color: var(--green-500);
    color: var(--green-700);
}

/* Loading */
.loading {
    text-align: center;
    padding: 32px;
    color: var(--gray-500);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--green-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-400);
    font-size: 0.8rem;
}
