* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Sage green design tokens */
    --bg: #6A8674;
    --accent: #2A4E38;
    --accent-soft: rgba(42,78,56,0.12);
    --accent-light: #3d6b50;
    --surface: rgba(200,212,206,0.44);
    --surface-light: rgba(220,230,225,0.55);
    --text: #1a2e22;
    --text-muted: #4a6657;
    --border: rgba(42,78,56,0.22);

    /* Compatibility aliases used in inline styles */
    --primary: #2A4E38;
    --primary-hover: #1e3a28;
    --text-primary: #1a2e22;
    --text-secondary: #4a6657;
    --bg-hover: rgba(42,78,56,0.07);
    --bg-light: rgba(220,230,225,0.3);
    --shadow: 0 2px 12px rgba(0,0,0,0.14);
    --shadow-hover: 0 8px 28px rgba(0,0,0,0.22);
    --shadow-card: 0 4px 16px rgba(42,78,56,0.10);
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 15% 85%, rgba(255,255,248,0.42) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 15%, rgba(0,0,0,0.32) 0%, transparent 50%),
        radial-gradient(ellipse at 55% 60%, rgba(0,0,0,0.14) 0%, transparent 45%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    position: relative;
}

body::before {
    display: none;
}

header {
    background: transparent;
    border-bottom: none;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 100;
    height: auto;
}

header nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.nav-icon:hover {
    background: var(--accent-light);
    transform: scale(1.05);
}

.nav-logo {
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-logo:hover .logo-icon {
    opacity: 1;
}

.header-search {
    flex: 1;
    max-width: 600px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: inherit;
    background: rgba(255,255,255,0.5);
    transition: all 0.3s ease;
}

.header-search:hover {
    background: rgba(255,255,255,0.65);
    box-shadow: var(--shadow);
    border-color: rgba(42,78,56,0.3);
}

.header-search:focus {
    outline: none;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 0 0 3px rgba(42,78,56,0.15);
    border-color: var(--accent);
}

.header-search::placeholder {
    color: var(--text-muted);
}

.filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
}

.filter-toggle:hover {
    background: rgba(255,255,255,0.65);
    border-color: rgba(42,78,56,0.3);
}

.filter-toggle.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.nav-user {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.nav-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--accent-soft);
    color: var(--primary-hover);
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}

.user-menu-trigger:hover {
    background: var(--bg-hover);
}

.user-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(200,212,206,0.88);
    backdrop-filter: blur(22px) saturate(1.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    min-width: 140px;
    z-index: 200;
    overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.user-menu-item:hover {
    background: var(--bg-hover);
}

/* Friend Request Badge */
.friend-request-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: #ea4335;
    border-radius: 9px;
    margin-left: 0.5rem;
}

main {
    flex: 1;
    padding: 0;
    width: 100%;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    background: rgba(200,212,206,0.44);
    backdrop-filter: blur(22px) saturate(1.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    margin-top: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    position: relative;
}

body.no-header .content-wrapper {
    margin-top: 0;
    padding-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

footer {
    background: transparent;
    border-top: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted);
    text-align: center;
    padding: 1rem 2rem;
    font-size: 0.75rem;
}

/* Recipe List Styles */
.recipes-container {
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.18);
}

.page-header h2 {
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-input {
    width: 280px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: rgba(255,255,255,0.5);
    transition: all 0.2s ease;
}

.search-input:hover {
    background: rgba(255,255,255,0.65);
    box-shadow: var(--shadow);
    border-color: rgba(42,78,56,0.3);
}

.search-input:focus {
    outline: none;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 0 0 3px rgba(42,78,56,0.15);
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.no-recipes {
    color: var(--text-muted);
    text-align: center;
    padding: 4rem 2rem;
    background: var(--accent-soft);
    border-radius: 12px;
    border: 1px dashed rgba(42,78,56,0.3);
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 1rem 0;
}

.recipe-card {
    background: rgba(200,212,206,0.44);
    backdrop-filter: blur(22px) saturate(1.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 16px;
    padding: 12px;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.recipe-card:hover {
    transform: translateY(-4px);
    border-color: rgba(106,134,116,0.45);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.recipe-title {
    padding: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.recipe-card.shared-recipe .recipe-title,
.recipe-card.pinned .recipe-title {
    padding-right: 2.5rem;
}

.recipe-title span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: calc(1.4em * 2);
}

.recipe-image {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    background: var(--accent-soft);
    overflow: hidden;
    position: relative;
    border-radius: 12px;
}

.recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.320, 1);
}

.recipe-card:hover .recipe-image img {
    transform: scale(1.08);
}

.recipe-image .no-image {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    background: var(--accent-soft);
}

/* Recipe Detail Styles */
.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.recipe-detail {
    max-width: 800px;
}

.recipe-header {
    margin-bottom: 2rem;
}

.recipe-detail-image {
    width: 100%;
    max-width: 400px;
    max-height: 250px;
    object-fit: cover;
    border-radius: 8px;
}

.recipe-header h2 {
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

.ingredients-section,
.instructions-section {
    margin-bottom: 2rem;
}

.ingredients-section h3,
.instructions-section h3 {
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.18);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.ingredient-section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0 0 0.5rem 0;
    letter-spacing: 0.05em;
}

.ingredients-columns {
    columns: 2;
    column-gap: 2rem;
}

.ingredient-group {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
}

.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ingredients-list li {
    padding: 0.15rem 0;
    color: var(--text);
    font-size: 0.875rem;
}

.steps-content {
    color: var(--text);
    line-height: 1.75;
    font-size: 0.875rem;
}

.not-found {
    text-align: center;
    padding: 4rem;
}

.not-found h2 {
    color: var(--text);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.not-found p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Recipes Header */
.recipes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.recipes-header h2 {
    margin-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s;
    min-height: 36px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 16px rgba(42,78,56,0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255,255,255,0.5);
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.7);
}

.btn-cancel {
    background: rgba(255,255,255,0.4);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    background: rgba(255,255,255,0.6);
    color: var(--text);
}

.btn-remove {
    background: transparent;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 50%;
    min-height: auto;
}

.btn-remove:hover {
    background: var(--bg-hover);
}

/* Add Recipe Form */
.add-recipe-container {
    max-width: 680px;
}

.add-recipe-container h2 {
    color: var(--text);
    font-size: 1.375rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
}

.recipe-form {
    background: rgba(200,212,206,0.44);
    backdrop-filter: blur(22px) saturate(1.1);
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.55);
}

.form-control:hover {
    border-color: rgba(42,78,56,0.35);
    box-shadow: 0 2px 8px rgba(42,78,56,0.05);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(42,78,56,0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Ingredients */
.ingredient-section {
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(200,212,206,0.44);
    backdrop-filter: blur(12px) saturate(1.1);
}

.section-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.section-name {
    flex: 1;
    font-weight: 500;
}

.section-ingredients {
    margin-bottom: 0.5rem;
}

.ingredient-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.ingredient-qty {
    width: 70px !important;
    flex-shrink: 0;
}

.ingredient-unit {
    width: 90px !important;
    flex-shrink: 0;
}

.ingredient-name {
    flex: 1;
}

#ingredients-sections-container {
    margin-bottom: 0.75rem;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Instructions */
.instruction-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.instruction-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-reorder {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    width: 20px;
    height: 16px;
    font-size: 8px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.btn-reorder:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.instruction-number {
    width: 24px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
}

.instruction-input {
    flex: 1;
}

#instructions-container {
    margin-bottom: 0.75rem;
}

.instructions-list {
    padding-left: 1.5rem;
    margin: 0;
}

.instructions-list li {
    padding: 0.15rem 0;
    color: var(--text);
    font-size: 0.875rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.18);
}

/* Error message */
.error-message {
    background: linear-gradient(135deg, rgba(229,57,53,0.1) 0%, rgba(229,57,53,0.05) 100%) !important;
    color: #c5221f !important;
    border: 1px solid rgba(229,57,53,0.2) !important;
    border-radius: 8px;
    padding: 1rem !important;
    font-size: 0.875rem;
    margin-bottom: 1rem !important;
    box-shadow: 0 2px 8px rgba(229,57,53,0.08);
}

.error-message strong {
    font-weight: 500;
}

/* Success message */
.success-message {
    background: linear-gradient(135deg, rgba(56,142,60,0.1) 0%, rgba(56,142,60,0.05) 100%);
    color: #137333;
    border: 1px solid rgba(56,142,60,0.2);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(56,142,60,0.08);
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

.auth-card {
    background: rgba(200,212,206,0.44);
    backdrop-filter: blur(22px) saturate(1.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-card);
}

.auth-logo {
    display: block;
    margin: 0 auto 0.75rem;
}

.auth-card h2 {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-form .form-group {
    margin-bottom: 0;
}

.auth-form .checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-form .checkbox-group label {
    margin-bottom: 0;
    font-weight: 400;
}

.auth-form .btn {
    margin-top: 0.25rem;
}

.auth-info {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.auth-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.18);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-actions-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
