/* ============================================================================
   ОБЩИЕ СТИЛИ
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================================================
   HEADER
   ============================================================================ */

header {
    background: #2c3e50;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 22px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-size: 14px;
}

/* ============================================================================
   АВТОРИЗАЦИЯ
   ============================================================================ */

.auth-box {
    max-width: 400px;
    margin: 80px auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-box h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    color: #2c3e50;
}

.subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 14px;
}

/* ============================================================================
   ФОРМЫ
   ============================================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #34495e;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.input-small {
    width: 100px !important;
}

/* ============================================================================
   КНОПКИ
   ============================================================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

button[type="submit"] {
    width: 100%;
    margin-top: 10px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.form-actions .btn {
    flex: 1;
}

/* ============================================================================
   СТРАНИЦА СПИСКА РЕЦЕПТУР
   ============================================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ============================================================================
   КАРТОЧКИ РЕЦЕПТУР
   ============================================================================ */

.recipe-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.recipe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    gap: 10px;
}

.recipe-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.recipe-card-body {
    margin-bottom: 15px;
}

.recipe-card-body p {
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
}

.recipe-card-footer {
    display: flex;
    gap: 10px;
}

.recipe-card-footer .btn {
    flex: 1;
}

/* ============================================================================
   BADGES (СТАТУСЫ)
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-draft {
    background: #f39c12;
    color: white;
}

.badge-active {
    background: #27ae60;
    color: white;
}

.badge-archived {
    background: #95a5a6;
    color: white;
}

/* ============================================================================
   МАСТЕР СОЗДАНИЯ (WIZARD)
   ============================================================================ */

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.step {
    flex: 1;
    text-align: center;
    padding: 12px;
    position: relative;
    font-size: 13px;
    color: #95a5a6;
    font-weight: 500;
}

.step:not(:last-child)::after {
    content: '→';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    color: #bdc3c7;
}

.step.active {
    color: #3498db;
    background: #ecf0f1;
    border-radius: 4px;
}

.wizard-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.wizard-content h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 25px;
    color: #2c3e50;
}

/* ============================================================================
   ТАБЛИЦЫ
   ============================================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tfoot td {
    font-weight: 600;
    background: #f8f9fa;
    border-top: 2px solid #ddd;
}

/* ============================================================================
   ПРОСМОТР РЕЦЕПТУРЫ
   ============================================================================ */

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.recipe-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
}

.recipe-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.info-item {
    font-size: 14px;
}

.info-item strong {
    color: #2c3e50;
}

.section {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.section pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* ============================================================================
   ЗАМЕЧАНИЯ
   ============================================================================ */

.note-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.note-header strong {
    color: #2c3e50;
}

.note-header span {
    color: #7f8c8d;
}

.note-item p {
    margin: 0;
    font-size: 14px;
}

/* ============================================================================
   СООБЩЕНИЯ И СТАТУСЫ
   ============================================================================ */

.error-message {
    background: #e74c3c;
    color: white;
    padding: 12px 15px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 14px;
}

.info-box {
    background: #d5f4e6;
    border-left: 4px solid #27ae60;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.info-box h4 {
    color: #27ae60;
    margin-bottom: 10px;
    font-size: 16px;
}

.info-box p {
    margin-bottom: 8px;
    color: #2c3e50;
}

.summary-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #ddd;
}

.summary-box h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-size: 16px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #e74c3c;
    font-size: 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ============================================================================
   ТЕКСТОВЫЕ УТИЛИТЫ
   ============================================================================ */

.text-center {
    text-align: center;
}

.text-center a {
    color: #3498db;
    text-decoration: none;
}

.text-center a:hover {
    text-decoration: underline;
}

/* ============================================================================
   АДАПТИВНОСТЬ
   ============================================================================ */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .auth-box {
        margin: 40px auto;
        padding: 30px 20px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .recipes-grid {
        grid-template-columns: 1fr;
    }

    .wizard-steps {
        flex-direction: column;
        gap: 10px;
    }

    .step:not(:last-child)::after {
        content: '↓';
        position: static;
        display: block;
        margin: 5px 0;
    }

    .recipe-info {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 18px;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .recipe-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}