:root {
    --primary: #007AFF;
    --primary-gradient: linear-gradient(135deg, #007AFF 0%, #0051D4 100%);
    --bg: var(--tg-theme-bg-color, #f2f2f7);
    --card-bg: var(--tg-theme-secondary-bg-color, #fff);
    --text: var(--tg-theme-text-color, #000);
    --sec: var(--tg-theme-secondary-bg-color, #fff);
    --hint: var(--tg-theme-hint-color, #8e8e93);
    --orange: #FF9500;
    --red: #FF3B30;
    --green: #34C759;
    --purple: #AF52DE;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    --shadow-button: 0 4px 12px rgba(0, 122, 255, 0.25);
    --radius-card: 16px;
    --radius-button: 14px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 16px;
    padding-bottom: 120px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* APP HEADER */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 0;
    border-bottom: none;
}

/* PROFILE BUTTON */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--card-bg);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.profile-btn:active {
    transform: scale(0.97);
    background: rgba(0, 0, 0, 0.04);
}
.profile-icon {
    font-size: 18px;
}
.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

/* ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА */
.lang-switcher {
    display: flex;
    gap: 4px;
    background: rgba(118, 118, 128, 0.12);
    padding: 3px;
    border-radius: 10px;
}
.lang-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.lang-btn.active {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.lang-btn:active {
    transform: scale(0.95);
}

/* ТАБЫ */
.tabs-container {
    display: flex;
    background: rgba(118, 118, 128, 0.12);
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 20px;
}
.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
    letter-spacing: -0.2px;
}
.tab-btn.active {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* КАЛЕНДАРЬ */
.month-header {
    margin: 25px 0 12px;
    font-size: 18px;
    font-weight: 700;
    text-transform: lowercase;
    letter-spacing: -0.3px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.day {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    padding: 14px 6px;
    min-height: 85px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}
.day:active {
    transform: scale(0.97);
}
.day.has-slots {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.15);
}
.day-week {
    font-size: 11px;
    font-weight: 600;
    color: var(--hint);
    text-transform: uppercase;
}
.day-num {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.day-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
}

/* СЕТКА ВРЕМЕНИ (АДМИНКА) */
.time-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
    margin: 15px 0 25px;
    width: 100%;
}
.time-chip {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 12px 0;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.time-chip:active {
    transform: scale(0.97);
}
.time-chip.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}
.time-chip.exists {
    opacity: 0.3;
    pointer-events: none;
}

/* АДМИНСКИЙ ИНПУТ (iOS Native Style) */
.admin-controls-wrapper {
    margin-top: 16px;
    padding-bottom: 20px;
}
.price-input-container {
    position: relative;
    margin-bottom: 20px;
}
.price-input-styled {
    width: 100%;
    background: rgba(120, 120, 128, 0.12);
    border: none;
    border-radius: 12px;
    padding: 16px 70px 16px 20px;
    font-size: 24px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    text-align: left;
    letter-spacing: 0.5px;
}
.price-input-styled::placeholder {
    color: var(--hint);
    opacity: 0.5;
}
.price-input-styled:focus {
    background: rgba(120, 120, 128, 0.18);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}
.price-currency-label {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hint);
    font-weight: 500;
    font-size: 18px;
    pointer-events: none;
    opacity: 0.6;
}
.admin-hint {
    font-size: 13px;
    color: var(--hint);
    margin-bottom: 12px;
    font-weight: 500;
    padding-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dark mode adjustments for price input */
@media (prefers-color-scheme: dark) {
    .price-input-styled {
        background: rgba(255, 255, 255, 0.08);
    }
    .price-input-styled:focus {
        background: rgba(255, 255, 255, 0.12);
    }
}

/* Telegram dark theme support */
body[style*="--tg-theme-bg-color"] .price-input-styled {
    background: rgba(255, 255, 255, 0.08);
}
body[style*="--tg-theme-bg-color"] .price-input-styled:focus {
    background: rgba(255, 255, 255, 0.12);
}

/* ЗАКАЗЫ */
.order-card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    border: none;
}
.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.order-date {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
}
.order-price {
    font-weight: 600;
    color: var(--hint);
    font-size: 14px;
}

/* СТАТУС БЕЙДЖИ (Apple Style) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    margin-top: 8px;
    letter-spacing: -0.2px;
}
.status-review {
    background: rgba(255, 149, 0, 0.12);
    color: #C67600;
}
.status-payment {
    background: rgba(0, 122, 255, 0.12);
    color: #0051D4;
}
.status-confirmed {
    background: rgba(52, 199, 89, 0.12);
    color: #248A3D;
}
.status-rejected {
    background: rgba(255, 59, 48, 0.12);
    color: #D70015;
}
.status-published {
    background: rgba(52, 199, 89, 0.15);
    color: #248A3D;
}

/* МОДАЛКИ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2000;
    align-items: flex-end;
}
.modal.active {
    display: flex;
    animation: slideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-content {
    background: var(--card-bg);
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-content.modal-compact {
    max-height: 70vh;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.modal-header b {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
}
.modal-scroll {
    overflow-y: auto;
    padding: 20px;
    flex-grow: 1;
    transition: padding-bottom 0.3s ease;
}
.keyboard-open .modal-scroll {
    padding-bottom: 450px !important;
}
.keyboard-open .checkout-list {
    max-height: 110px !important;
}

/* КНОПКА ЗАКРЫТИЯ */
.close-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(118, 118, 128, 0.12);
    border-radius: 50%;
    cursor: pointer;
    color: var(--hint);
    transition: all 0.2s ease;
    line-height: 1;
}
.close-btn:active {
    background: rgba(118, 118, 128, 0.2);
    transform: scale(0.95);
}

/* LK HEADER */
.lk-header {
    margin-bottom: 20px;
}
.lk-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -0.5px;
}
.lk-header p {
    font-size: 15px;
    color: var(--hint);
    margin: 0;
}

/* ЧЕКАУТ */
.checkout-list {
    max-height: 200px;
    overflow-y: auto;
}
.checkout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.checkout-item:last-child {
    border-bottom: none;
}

/* КНОПКА УДАЛЕНИЯ В КОРЗИНЕ */
.remove-item-btn {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border: none;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin-left: 12px;
}
.remove-item-btn:active {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(0.95);
}

/* ИТОГО */
.checkout-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 8px;
    font-size: 18px;
    font-weight: 700;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 12px;
    letter-spacing: -0.3px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    background: var(--card-bg);
}
.btn-secondary {
    flex: 1;
    height: 50px;
    background: rgba(118, 118, 128, 0.12);
    color: var(--text);
    border: none;
    border-radius: var(--radius-button);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: -0.2px;
}
.btn-secondary:active {
    transform: scale(0.98);
    background: rgba(118, 118, 128, 0.18);
}
.btn-primary {
    flex: 1.5;
    height: 50px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-button);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: all 0.15s ease;
    letter-spacing: -0.2px;
}
.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* СЛОТЫ */
.slot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: var(--card-bg);
    border-radius: var(--radius-card);
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}
.slot-row.in-cart {
    background: rgba(0, 122, 255, 0.06) !important;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.15);
}

/* ТЕКСТОВОЕ ПОЛЕ */
#adText {
    width: 100%;
    min-height: 100px;
    padding: 16px;
    border: 2px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-card);
    background: var(--card-bg);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 20px;
    outline: none;
    resize: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}
#adText:focus {
    border-color: var(--primary);
}

/* ГЛАВНАЯ КНОПКА ДЕЙСТВИЯ */
button.action {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-button);
    font-weight: 700;
    font-size: 17px;
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-button);
    transition: all 0.15s ease;
    cursor: pointer;
    letter-spacing: -0.3px;
}
button.action:active {
    transform: scale(0.98);
    opacity: 0.9;
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ========== PROFILE STYLES ========== */

.profile-greeting {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 24px;
    text-align: center;
}
.profile-username {
    color: var(--primary);
}

.profile-section {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
}
.profile-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--hint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.profile-value {
    font-size: 16px;
    font-weight: 600;
}
.profile-hint {
    font-size: 13px;
    color: var(--hint);
    margin-top: 6px;
    line-height: 1.4;
}

.status-ok { color: var(--green); }
.status-warn { color: var(--orange); }

/* PLAN BADGES */
.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
}
.plan-pro {
    background: linear-gradient(135deg, #FFD60A 0%, #FF9F0A 100%);
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(255, 159, 10, 0.3);
}
.plan-free {
    background: rgba(118, 118, 128, 0.12);
    color: var(--hint);
}
.plan-icon {
    font-size: 14px;
}
.plan-name {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.plan-details {
    font-size: 14px;
    color: var(--text);
    margin-top: 10px;
    font-weight: 600;
}
.plan-details-muted {
    color: var(--hint);
}
.plan-features {
    font-size: 12px;
    color: var(--primary);
    margin-top: 6px;
    font-weight: 700;
}

/* PRO BUTTON */
.action-pro {
    background: linear-gradient(135deg, #AF52DE 0%, #7B3FA0 100%);
    box-shadow: 0 4px 16px rgba(175, 82, 222, 0.3);
    margin-top: 20px;
}
.action-pro:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* STICKY CART BUTTON */
.sticky-cart {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 80%, transparent);
    z-index: 1000;
}
.cart-btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: var(--radius-button);
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.35);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    transition: all 0.15s ease;
    letter-spacing: -0.3px;
}
.cart-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}
.cart-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* КНОПКА КОРЗИНЫ В СЛОТЕ */
.btn-cart-toggle {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-button);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
}
.btn-cart-toggle.active {
    background: var(--red);
    color: #fff;
}
.btn-cart-toggle:active {
    transform: scale(0.97);
}

/* TIME BOX */
.time-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.time-box small {
    color: var(--hint);
    font-size: 12px;
}

/* LOCAL TIME HINT */
.local-time-hint {
    color: var(--hint);
    font-size: 12px;
}

/* ========== RESPONSIVE / MOBILE ========== */
@media (max-width: 480px) {
    body {
        padding: 12px;
        padding-bottom: 110px;
    }
    
    .calendar-grid {
        gap: 8px;
    }
    
    .day {
        padding: 12px 4px;
        min-height: 80px;
        border-radius: 14px;
    }
    
    .day-num {
        font-size: 18px;
    }
    
    .order-card {
        padding: 16px;
    }
    
    .slot-row {
        padding: 14px 16px;
    }
    
    .modal-scroll {
        padding: 16px;
    }
    
    .modal-header {
        padding: 18px 16px;
    }
    
    .modal-footer {
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    }
    
    button.action {
        height: 50px;
        font-size: 16px;
    }
    
    .btn-primary, .btn-secondary {
        height: 48px;
        font-size: 15px;
    }
}

/* Prevent content sticking to edges */
@media (max-width: 380px) {
    body {
        padding: 10px;
    }
    
    .calendar-grid {
        gap: 6px;
    }
    
    .day {
        padding: 10px 2px;
        min-height: 75px;
        border-radius: 12px;
    }
}
