* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #d4956a;
    --primary-hover: #c4854a;
    --accent: #4ecdc4;
    --accent-light: #45b7aa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border: #e8e8e8;
    --bg-hover: #f9f9f9;
    --bg-light: #fafafa;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-card: 0 4px 12px rgba(212,149,106,0.08);
}

body {
    font-family: 'Google Sans', 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,107,107,0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(78,205,196,0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255,107,107,0.03) 0%, transparent 50%),
        linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: var(--text-primary);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(255,107,107,0.06) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(78,205,196,0.06) 1px, transparent 1px);
    background-size: 60px 60px, 40px 40px;
    background-position: 0 0, 30px 30px;
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
}

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: #3dbdb5;
    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.7);
    transition: all 0.3s ease;
}

.header-search:hover {
    background: #fff;
    box-shadow: var(--shadow);
    border-color: rgba(78,205,196,0.3);
}

.header-search:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(78,205,196,0.1);
    border-color: var(--accent);
}

.header-search::placeholder {
    color: var(--text-secondary);
}

.filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
}

.filter-toggle:hover {
    background: #fff;
    border-color: rgba(78,205,196,0.3);
}

.filter-toggle.active {
    background: rgba(78,205,196,0.15);
    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-secondary);
    font-size: 0.875rem;
}

.nav-link {
    color: var(--primary);
    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: rgba(255,107,107,0.08);
    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: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    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-primary);
    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(255,255,255,0.7);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    margin-top: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
    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: linear-gradient(90deg, rgba(255,107,107,0.02) 0%, rgba(78,205,196,0.02) 100%);
    border-top: 1px solid rgba(232,232,232,0.5);
    color: var(--text-secondary);
    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 var(--border);
}

.page-header h2 {
    color: var(--text-primary);
    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.7);
    transition: all 0.2s ease;
}

.search-input:hover {
    background: #fff;
    box-shadow: var(--shadow);
    border-color: rgba(78,205,196,0.3);
}

.search-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(78,205,196,0.1);
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.no-recipes {
    color: var(--text-secondary);
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(255,107,107,0.02) 0%, rgba(78,205,196,0.02) 100%);
    border-radius: 12px;
    border: 1px dashed rgba(78,205,196,0.2);
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.recipe-card {
    background: #fff;
    border: 1px solid rgba(180, 180, 180, 0.6);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    position: relative;
}

.recipe-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-8px);
}

.recipe-title {
    padding: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    order: -1;
    background: linear-gradient(135deg, rgba(255,107,107,0.02) 0%, rgba(78,205,196,0.02) 100%);
    border-bottom: 2px solid rgba(78,205,196,0.1);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    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 {
    height: 220px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    overflow: hidden;
    position: relative;
}

.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-secondary);
    font-size: 0.875rem;
    background: linear-gradient(135deg, #fff8f7 0%, #f7fffe 100%);
}

/* Recipe Detail Styles */
.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    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-primary);
    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-primary);
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.ingredient-section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    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-primary);
    font-size: 0.875rem;
}

.steps-content {
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 0.875rem;
}

.not-found {
    text-align: center;
    padding: 4rem;
}

.not-found h2 {
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.not-found p {
    color: var(--text-secondary);
    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: 4px;
    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: linear-gradient(135deg, #4ecdc4 0%, #6ed9d2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #45b7aa 0%, #5fd4cb 100%);
    box-shadow: 0 4px 16px rgba(78,205,196,0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-cancel {
    background: #fff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    background: var(--bg-hover);
}

.btn-remove {
    background: transparent;
    color: var(--text-secondary);
    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-primary);
    font-size: 1.375rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
}

.recipe-form {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid rgba(232,232,232,0.5);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    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-primary);
    transition: all 0.2s ease;
    background: #fff;
}

.form-control:hover {
    border-color: rgba(78,205,196,0.3);
    box-shadow: 0 2px 8px rgba(78,205,196,0.05);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(78,205,196,0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Ingredients */
.ingredient-section {
    border: 1px solid rgba(232,232,232,0.5);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(255,107,107,0.02) 0%, rgba(78,205,196,0.02) 100%);
}

.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-secondary);
    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(--primary);
    color: var(--primary);
}

.instruction-number {
    width: 24px;
    flex-shrink: 0;
    color: var(--text-secondary);
    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-primary);
    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 var(--border);
}

/* 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: #fff;
    border: 1px solid rgba(232,232,232,0.5);
    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-primary);
}

.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-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.auth-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-actions-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
