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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--tg-theme-bg-color, #f5f5f5);
    color: var(--tg-theme-text-color, #333);
    line-height: 1.6;
}

#app {
    max-width: 100vw;
    margin: 0 auto;
    min-height: 100vh;
}

/* Экраны */
.screen {
    display: none;
    padding: 0;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Заголовок */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--tg-theme-secondary-bg-color, #fff);
    border-bottom: 1px solid var(--tg-theme-hint-color, #e0e0e0);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.add-btn, .back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--tg-theme-button-color, #0088cc);
    color: var(--tg-theme-button-text-color, #fff);
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn {
    background: transparent;
    color: var(--tg-theme-button-color, #0088cc);
    font-size: 24px;
}

/* Список рецептов */
.recipes-container {
    padding: 20px;
}

.recipe-card {
    background: var(--tg-theme-secondary-bg-color, #fff);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.recipe-card:hover {
    transform: translateY(-2px);
}

.recipe-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f0f0f0;
}

.recipe-info {
    padding: 16px;
}

.recipe-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--tg-theme-hint-color, #666);
    font-size: 14px;
}

.recipe-category {
    background: var(--tg-theme-button-color, #0088cc);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--tg-theme-hint-color, #666);
}

.empty-state button {
    margin-top: 20px;
    padding: 12px 24px;
    background: var(--tg-theme-button-color, #0088cc);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

/* Форма создания рецепта */
.recipe-form {
    padding: 20px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.form-section {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--tg-theme-hint-color, #e0e0e0);
}

.form-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--tg-theme-text-color, #333);
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-hint-color, #e0e0e0);
    border-radius: 8px;
    font-size: 16px;
    background: var(--tg-theme-secondary-bg-color, #fff);
    color: var(--tg-theme-text-color, #333);
}

input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px dashed var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    background: var(--tg-theme-secondary-bg-color, #fff);
}

.image-preview {
    margin-top: 12px;
}

.image-preview img {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
}

/* Динамические поля */
.ingredient-item,
.step-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.ingredient-item input {
    flex: 1;
}

.step-item {
    flex-direction: column;
    background: var(--tg-theme-secondary-bg-color, #fff);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--tg-theme-hint-color, #e0e0e0);
}

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

.step-number {
    background: var(--tg-theme-button-color, #0088cc);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.remove-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.add-ingredient-btn,
.add-step-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px dashed var(--tg-theme-button-color, #0088cc);
    color: var(--tg-theme-button-color, #0088cc);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 12px;
}

.save-btn {
    width: 100%;
    padding: 16px;
    background: var(--tg-theme-button-color, #0088cc);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 32px;
}

/* Просмотр рецепта */
.recipe-details {
    padding: 20px;
}

.recipe-hero {
    text-align: center;
    margin-bottom: 32px;
}

.recipe-hero img {
    width: 100%;
    max-width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
}

.recipe-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--tg-theme-secondary-bg-color, #fff);
    border-radius: 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--tg-theme-button-color, #0088cc);
}

.stat-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #666);
    margin-top: 4px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 16px;
    border-bottom: 2px solid var(--tg-theme-button-color, #0088cc);
    padding-bottom: 8px;
}

.ingredients-list {
    list-style: none;
}

.ingredients-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--tg-theme-hint-color, #f0f0f0);
}

.steps-list {
    list-style: none;
}

.step-item-view {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--tg-theme-secondary-bg-color, #fff);
    border-radius: 8px;
}

.step-item-view img {
    width: 100%;
    max-width: 200px;
    border-radius: 8px;
    margin-top: 12px;
}

/* Адаптивность */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .recipe-stats {
        grid-template-columns: 1fr;
    }
} 