@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Lato:wght@400;700&display=swap');

:root {
    --color-bg: #faf8f3;
    --color-surface: #ffffff;
    --color-border: #e2d9c8;
    --color-text: #2c2416;
    --color-muted: #7a6e5f;
    --color-accent: #2d7d62;
    --color-accent-hover: #1f5c47;
    --color-cream: #f5f0e8;
    --max-width: 780px;
    --font-body: 'Lato', sans-serif;
    --font-heading: 'Playfair Display', Georgia, serif;
}

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

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-text);
}

h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.3rem; }

/* Header */
.site-header {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    padding: 1rem 1.5rem;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.site-nav {
    display: flex;
    gap: 1rem;
    flex: 1;
    font-size: 0.95rem;
}

.account-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* Page container */
.page-container {
    max-width: var(--max-width);
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.page-subtitle {
    color: var(--color-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* Recipe grid on home/search/profile */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Recipe cards */
.recipe-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.recipe-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.1rem 1.25rem 1.25rem;
    border-top: 3px solid var(--color-cream);
}

.card-body h2 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.card-body p {
    font-size: 0.92rem;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}

.tag-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-list li a {
    font-size: 0.78rem;
    background: var(--color-cream);
    color: var(--color-accent);
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    text-decoration: none;
    border: 1px solid var(--color-border);
}

.tag-list li a:hover {
    background: var(--color-accent);
    color: white;
    text-decoration: none;
}

/* Recipe detail page */
.recipe-info {
    display: flex;
    gap: 1.5rem;
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
    font-size: 0.92rem;
}

.recipe-info p {
    margin: 0;
}

.recipe-columns {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    margin-top: 1.5rem;
}

.recipe-columns > div {
    flex: 1;
}

.recipe-columns ul,
.recipe-columns ol {
    padding-left: 1.25rem;
}

.recipe-columns li {
    margin-bottom: 0.4rem;
}

/* Profile page */
.profile-intro {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.profile-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

/* Search page */
.search-block {
    margin-bottom: 1.5rem;
}

.search-block input {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    margin-left: 0.5rem;
}

.search-block button {
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    margin-left: 0.4rem;
}

.search-block button:hover {
    background: var(--color-accent-hover);
}

/* Login form */
.login-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 2rem;
    max-width: 380px;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    margin-top: 0.3rem;
}

.login-form button {
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    align-self: flex-start;
}

.login-form button:hover {
    background: var(--color-accent-hover);
}

/* Comments */
.comments-section {
    margin-top: 2.5rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
}

.comment {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.comment-meta {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.comment-date {
    font-size: 0.85rem;
    color: var(--color-muted);
}

#comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

#comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    resize: vertical;
    font-family: var(--font-body);
}

#comment-form button {
    align-self: flex-start;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    font-size: 1rem;
}

#comment-form button:hover:not(:disabled) {
    background: var(--color-accent-hover);
}

#comment-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.char-count {
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* Shopping List */
.add-to-list-btn {
    margin-top: 1.5rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
}

.add-to-list-btn:hover {
    background: var(--color-accent-hover);
}

.list-hint {
    color: var(--color-muted);
    margin-bottom: 1rem;
}

#shopping-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shopping-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.shopping-item:hover {
    border-color: var(--color-accent);
}

.shopping-item.checked .item-text {
    text-decoration: line-through;
    color: var(--color-muted);
}

.item-source {
    font-size: 0.8rem;
    color: var(--color-muted);
}

/* Form error / footer */
.form-error {
    color: #c0392b;
    background: #fdecea;
    border: 1px solid #f5c6c2;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.form-footer {
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* Add Recipe form */
.recipe-form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-weight: 700;
    font-size: 0.92rem;
}

.form-group input,
.form-group textarea {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--color-surface);
}

.form-group input:disabled {
    background: var(--color-cream);
    color: var(--color-muted);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 120px;
}

.form-section {
    border-top: 1px solid var(--color-border);
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ingredient-row,
.step-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ingredient-amount {
    width: 160px;
    flex-shrink: 0;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--font-body);
}

.ingredient-name {
    flex: 1;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--font-body);
}

.step-row .step-number {
    font-weight: 700;
    min-width: 1.5rem;
    color: var(--color-accent);
}

.step-row textarea {
    flex: 1;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--font-body);
    resize: vertical;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
}

.remove-btn:hover {
    color: #c0392b;
    background: #fdecea;
}

.add-row-btn {
    align-self: flex-start;
    background: none;
    border: 1px dashed var(--color-accent);
    color: var(--color-accent);
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.add-row-btn:hover {
    background: var(--color-cream);
}

.submit-btn {
    align-self: flex-start;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: var(--color-accent-hover);
}
