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

:root {
    --primary: #2ecc71;
    --primary-dark: #27ae60;
    --secondary: #3498db;
    --secondary-dark: #2980b9;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --warning: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --white: #ffffff;
    --muted: #7f8c8d;
    --muted-light: #95a5a6;
    --bg-light: #f8f9fa;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-content .inline-form {
    display: inline-block;
    margin: 0;
}

h1 {
    color: var(--dark);
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--muted);
    font-size: 1.1em;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 25px;
    background: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    color: var(--dark);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.tab-btn.active {
    background: var(--primary);
    color: var(--white);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.8em;
    color: var(--dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary);
}

.card h3 {
    color: var(--dark);
    margin-bottom: 15px;
}

.form-section-title {
    margin: 30px 0 20px 0;
    color: var(--dark);
}

.form-actions {
    margin-top: 30px;
}

.card-actions {
    margin-top: 20px;
}

.ingredient-form-section {
    margin-bottom: 30px;
}

.ingredient-form-section h3 {
    color: var(--dark);
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group--inline {
    margin-bottom: 0;
}

.form-errors,
.field-error {
    color: var(--danger);
    font-size: 0.9em;
    margin-top: 5px;
}

.form-errors {
    margin-bottom: 15px;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 2.75em;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1em;
    opacity: 0.7;
    border-radius: 4px;
}

.password-toggle:hover {
    opacity: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
}

.ingredient-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 15px;
    align-items: end;
}

.ingredient-list {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.ingredient-item {
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.nutrition-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.nutrition-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.nutrition-card h4 {
    font-size: 0.9em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.nutrition-card .value {
    font-size: 2em;
    font-weight: 700;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.recipe-card {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    cursor: pointer;
}

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

.recipe-card h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

.recipe-card__description {
    color: var(--muted);
    margin: 10px 0;
}

.recipe-card__actions {
    margin-top: 15px;
}

.recipe-card__author {
    margin-top: 10px;
    font-size: 0.85em;
    color: var(--muted);
}

.recipe-meta {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--muted);
}

.week-planner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.day-card {
    background: var(--white);
    border-radius: 10px;
    padding: 15px;
    box-shadow: var(--shadow);
}

.day-card h3 {
    color: var(--dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.meal-slot {
    margin-bottom: 15px;
}

.meal-slot h4 {
    font-size: 0.9em;
    color: var(--primary);
    margin-bottom: 5px;
}

.meal-slot select {
    font-size: 0.9em;
    padding: 8px;
}

.shopping-list {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.shopping-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--light);
}

.shopping-item:last-child {
    border-bottom: none;
}

.shopping-item input[type="checkbox"] {
    width: auto;
    margin-right: 15px;
    transform: scale(1.3);
}

.shopping-item.checked {
    opacity: 0.6;
    text-decoration: line-through;
}

.date-range {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: end;
}

.date-range .form-group {
    flex: 1;
    margin-bottom: 0;
}

.ingredient-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.ingredient-table th,
.ingredient-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--light);
}

.ingredient-table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}

.ingredient-table tbody tr:hover {
    background: var(--bg-light);
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    padding: 12px 20px;
    border-radius: 25px;
    border: 2px solid var(--light);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted-light);
}

.empty-state--full-width {
    grid-column: 1 / -1;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--muted-light);
}

.close-modal:hover {
    color: var(--dark);
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section p {
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .ingredient-row {
        grid-template-columns: 1fr;
    }

    .nutrition-info {
        grid-template-columns: repeat(2, 1fr);
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    h1 {
        font-size: 1.8em;
    }
}
