* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --bg-hover: #f1f3f4;
    --shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-hover: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

body {
    font-family: 'Google Sans', 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: var(--text-primary);
}

header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

header nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: background 0.2s;
    flex-shrink: 0;
}

.nav-icon:hover {
    background: var(--bg-hover);
}

.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: 24px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-hover);
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.header-search:hover {
    background: #fff;
    box-shadow: var(--shadow);
}

.header-search:focus {
    outline: none;
    background: #fff;
    box-shadow: var(--shadow);
    border-color: transparent;
}

.header-search::placeholder {
    color: var(--text-secondary);
}

.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: 4px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--bg-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: 28px;
    height: 28px;
    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: 200px;
    z-index: 200;
    overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

.user-menu-email {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}

.user-menu-item {
    display: block;
    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);
}

main {
    flex: 1;
    padding: 0;
    width: 100%;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

footer {
    background: #fff;
    border-top: 1px solid var(--border);
    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: var(--bg-hover);
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.search-input:hover {
    background: #fff;
    box-shadow: var(--shadow);
}

.search-input:focus {
    outline: none;
    background: #fff;
    box-shadow: var(--shadow);
    border-color: transparent;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.no-recipes {
    color: var(--text-secondary);
    text-align: center;
    padding: 3rem;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.recipe-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.recipe-title {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    order: -1;
}

.recipe-image {
    height: 200px;
    background: var(--bg-hover);
    overflow: hidden;
}

.recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-image .no-image {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 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;
    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: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.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 var(--border);
    border-radius: 8px;
}

.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: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Ingredients */
.ingredient-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-hover);
}

.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: #fce8e6 !important;
    color: #c5221f !important;
    border: none !important;
    border-radius: 4px;
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem;
    margin-bottom: 1rem !important;
}

.error-message strong {
    font-weight: 500;
}

/* Success message */
.success-message {
    background: #e6f4ea;
    color: #137333;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.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.5rem;
}

.auth-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: center;
}

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    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;
}
