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

body {
    font-family: 'Inter', sans-serif;
    background: var(--tg-theme-bg-color, #f6f2ec);
    color: var(--tg-theme-text-color, #2d2d2d);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ======== ПРЕЛОАДЕР ======== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f6f2ec;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.loader-logo img {
    width: 140px;
    margin-bottom: 30px;
}

.loader-bar {
    width: 200px;
    height: 4px;
    background: rgba(75, 46, 42, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.loader-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #8b5a4b, #4b2e2a);
    transition: width 1.5s;
}

.loader-text {
    margin-top: 16px;
    font-size: 14px;
    color: #4b2e2a;
    opacity: 0.7;
}

/* ======== ШАПКА ======== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.back-button {
    background: none;
    border: none;
    font-size: 18px;
    color: #4b2e2a;
    cursor: pointer;
    padding: 8px 0;
    min-width: 70px;
    text-align: left;
    transition: color 0.3s;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #4b2e2a;
    text-align: center;
    flex: 1;
    transition: color 0.3s;
}

/* ======== ГЛАВНАЯ ======== */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.profile-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(135deg, #8b5a4b, #4b2e2a);
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-logo-small {
    flex: 1;
    text-align: center;
}

.main-logo-small img {
    height: 32px;
    width: auto;
}

.chef-title {
    text-align: center;
    margin-bottom: 20px;
}

.chef-title h1 {
    font-size: 22px;
    font-weight: 600;
    color: #4b2e2a;
    letter-spacing: -0.3px;
}

.chef-title p {
    font-size: 14px;
    color: #8b5a4b;
    margin-top: 4px;
}

.hero img {
    width: 100%;
    border-radius: 24px;
    margin-bottom: 24px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.menu-item {
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s;
}

.menu-item:hover {
    transform: translateY(-4px);
}

.menu-item img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 24px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.menu-item p {
    font-size: 15px;
    font-weight: 500;
    color: #4b2e2a;
}

/* ======== КНИГИ ======== */
.books-grid-square {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.book-square-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.book-square-card:hover {
    transform: translateY(-4px);
}

.book-cover-image {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
}

.book-square-info {
    padding: 12px;
}

.book-square-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.book-square-price {
    font-size: 16px;
    font-weight: 700;
    color: #8b5a4b;
}

.book-square-type {
    font-size: 11px;
    color: #999;
}

/* ======== ВИДЕОРЕЦЕПТЫ ======== */
.video-description {
    background: var(--tg-theme-secondary-bg-color, #ffffff);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.description-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--tg-theme-text-color, #2d2d2d);
    font-weight: 300;
    letter-spacing: 0.3px;
    margin: 0;
}

.video-recipes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.video-recipe-card-full {
    position: relative;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 3/2;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s;
}

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

.recipe-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.recipe-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.5) 100%);
    color: white;
}

.recipe-text-top {
    text-align: left;
}

.recipe-title-caps {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #e0c0a0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-bottom: 6px;
    line-height: 1.2;
}

.recipe-desc {
    font-size: 13px;
    line-height: 1.4;
    font-weight: 300;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    max-width: 85%;
    opacity: 0.9;
}

.recipe-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.recipe-price {
    font-size: 22px;
    font-weight: 300;
    color: #e0c0a0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.15);
    padding: 4px 10px;
    border-radius: 30px;
    backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
}

.buy-now-btn {
    background: rgba(139, 90, 75, 0.95);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 12px 24px;
    border-radius: 40px;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.buy-now-btn:hover {
    background: #4b2e2a;
    transform: scale(1.03);
}

/* ======== КЛУБ ======== */
.club-banner {
    position: relative;
    margin-bottom: 24px;
}

.club-banner img {
    width: 100%;
    border-radius: 24px;
    height: 180px;
    object-fit: cover;
}

.club-banner-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
}

.club-badge {
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.club-header {
    margin-bottom: 24px;
}

.club-title {
    font-size: 24px;
    font-weight: 600;
    color: #4b2e2a;
    margin-bottom: 8px;
}

.club-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.club-benefits-card {
    background: white;
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
}

.benefits-title {
    font-size: 18px;
    font-weight: 600;
    color: #4b2e2a;
    margin-bottom: 16px;
}

.benefits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.benefit-emoji {
    font-size: 24px;
}

.benefit-text {
    font-size: 14px;
    color: #2d2d2d;
}

.club-payment-card {
    background: white;
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    margin-top: 20px;
}

.price-tag {
    margin-bottom: 20px;
}

.price-value {
    font-size: 36px;
    font-weight: 700;
    color: #8b5a4b;
}

.price-period {
    font-size: 14px;
    color: #999;
}

.club-pay-btn {
    width: 100%;
    background: #4b2e2a;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.club-pay-btn:hover {
    background: #8b5a4b;
}

.payment-security {
    font-size: 12px;
    color: #999;
    margin-top: 12px;
}

/* ======== КОФЕЙНЯ ======== */
.cafe-info-block {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
}

.cafe-main-info h2 {
    font-size: 20px;
    font-weight: 600;
    color: #4b2e2a;
    margin-bottom: 8px;
}

.cafe-address-full {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.cafe-hours {
    font-size: 13px;
    color: #8b5a4b;
    margin-top: 8px;
}

.yandex-map-container {
    margin-bottom: 16px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.cafe-description {
    background: rgba(139, 90, 75, 0.05);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #666;
}

.cafe-menu {
    margin-bottom: 30px;
}

.menu-category {
    margin-bottom: 28px;
}

.category-title {
    font-size: 20px;
    font-weight: 500;
    color: #4b2e2a;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(139, 90, 75, 0.2);
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(139, 90, 75, 0.1);
}

.item-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-name {
    font-size: 16px;
    font-weight: 500;
}

.item-price {
    font-size: 16px;
    font-weight: 600;
    color: #8b5a4b;
}

.add-btn {
    width: 36px;
    height: 36px;
    background: #4b2e2a;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-btn:hover {
    background: #8b5a4b;
}

.cafe-cart-section {
    background: white;
    border-radius: 24px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid rgba(139, 90, 75, 0.1);
}

.cafe-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cafe-cart-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #4b2e2a;
}

.clear-cafe-cart {
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
}

.clear-cafe-cart:hover {
    color: #ff4444;
}

.cafe-cart-items {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.empty-cafe-cart {
    text-align: center;
    color: #999;
    padding: 20px;
}

.cafe-cart-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(139, 90, 75, 0.1);
}

.cafe-cart-item-name {
    flex: 1;
    font-size: 14px;
}

.cafe-cart-item-qty {
    margin: 0 8px;
    color: #8b5a4b;
    font-weight: 600;
}

.cafe-cart-item-price {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    color: #4b2e2a;
}

.cafe-cart-item-remove {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    margin-left: 8px;
}

.cafe-cart-item-remove:hover {
    color: #ff4444;
}

.cafe-cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    margin: 16px 0;
    padding-top: 12px;
    border-top: 2px solid rgba(139, 90, 75, 0.2);
}

.cafe-total-price {
    color: #4b2e2a;
    font-size: 20px;
}

.cafe-checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, #8b5a4b, #4b2e2a);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cafe-checkout-btn:hover {
    transform: scale(1.02);
}

.pickup-note {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 12px;
}

/* ======== ПРОФИЛЬ ======== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0e9e0;
}

.profile-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-info p {
    font-size: 13px;
    color: #999;
}

.profile-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #8b5a4b;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #999;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.profile-action-btn {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border: 1px solid rgba(139, 90, 75, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-action-btn:hover {
    background: rgba(139, 90, 75, 0.05);
}

.action-emoji {
    font-size: 24px;
    margin-right: 16px;
    width: 32px;
    text-align: center;
}

.action-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #4b2e2a;
    text-align: left;
}

.action-arrow {
    font-size: 18px;
    color: #8b5a4b;
    opacity: 0.5;
}

.recent-orders {
    margin-bottom: 24px;
}

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

.recent-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #4b2e2a;
}

.view-all-btn {
    background: none;
    border: none;
    color: #8b5a4b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-order-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-order-item:hover {
    background: rgba(139, 90, 75, 0.02);
}

.order-icon {
    font-size: 24px;
    margin-right: 16px;
    width: 32px;
    text-align: center;
}

.order-info {
    flex: 1;
}

.order-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.order-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.order-price {
    color: #8b5a4b;
    font-weight: 600;
}

.no-orders {
    text-align: center;
    color: #999;
    padding: 30px 0;
}

.club-access-section {
    background: linear-gradient(135deg, #8b5a4b10, #4b2e2a20);
    border-radius: 20px;
    padding: 16px;
    margin-top: 16px;
}

.club-access-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-icon {
    font-size: 20px;
}

.badge-text {
    font-size: 14px;
    font-weight: 500;
    color: #4b2e2a;
}

/* ======== ТЕМНАЯ ТЕМА ======== */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    #preloader {
        background: #1a1a1a;
    }
    
    .loader-text {
        color: #e0c0a0;
    }
    
    .back-button {
        color: #e0c0a0;
    }
    
    .page-title {
        color: #e0c0a0;
    }
    
    .menu-item p {
        color: #e0c0a0;
    }
    
    .chef-title h1 {
        color: white;
    }
    
    .video-description,
    .book-square-card,
    .club-benefits-card,
    .club-payment-card,
    .cafe-info-block,
    .cafe-cart-section,
    .profile-header,
    .stat-card,
    .profile-action-btn,
    .recent-order-item {
        background: #2a2a2a;
    }
    
    .book-square-title,
    .club-title,
    .benefits-title,
    .cafe-main-info h2,
    .cafe-cart-header h3,
    .profile-info h2,
    .recent-header h3,
    .action-text,
    .order-title,
    .badge-text {
        color: white;
    }
    
    .book-square-price,
    .item-price,
    .cafe-total-price,
    .stat-value,
    .order-price {
        color: #e0c0a0;
    }
    
    .book-square-type,
    .club-description,
    .cafe-address-full,
    .cafe-description,
    .profile-info p,
    .stat-label,
    .order-meta,
    .empty-cafe-cart,
    .no-orders {
        color: #aaa;
    }
    
    .benefit-text {
        color: #ddd;
    }
    
    .menu-item-card {
        border-bottom-color: #444;
    }
    
    .cafe-cart-item {
        border-bottom-color: #444;
    }
    
    .cafe-cart-total {
        border-top-color: #444;
    }
    
    .profile-action-btn {
        border-color: #444;
    }
    
    .club-access-section {
        background: linear-gradient(135deg, #e0c0a010, #8b5a4b20);
    }
}

/* ======== АДАПТАЦИЯ ПОД МОБИЛЬНЫЕ ======== */
@media (max-width: 400px) {
    .recipe-title-caps {
        font-size: 20px;
    }
    
    .recipe-price {
        font-size: 18px;
    }
    
    .buy-now-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .menu-item p {
        font-size: 13px;
    }
    
    .book-square-title {
        font-size: 13px;
    }
    
    .book-square-price {
        font-size: 14px;
    }
    
    .profile-avatar {
        width: 60px;
        height: 60px;
    }
    
    .profile-info h2 {
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .action-emoji {
        font-size: 20px;
        width: 28px;
    }
    
    .action-text {
        font-size: 14px;
    }
}
