/* ============================================
   КАСТОМНЫЕ СТИЛИ ДЛЯ МИНИ ПРИЛОЖЕНИЯ МП-1
   ============================================ */

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

body {
    background-color: #323131;
    min-height: 100vh;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ============================================
   ЗАГЛУШКА ДЛЯ БРАУЗЕРА
   ============================================ */

.restricted-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.restricted-card {
    max-width: 380px;
    padding: 32px 24px;
    background-color: #2a2a2a;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.restricted-title {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
}

.restricted-text {
    font-size: 15px;
    color: #aaaaaa;
    line-height: 1.5;
    margin-bottom: 20px;
}

.restricted-note {
    font-size: 13px;
    color: #777777;
    background-color: #222222;
    padding: 12px;
    border-radius: 10px;
    border-left: 3px solid #555555;
    text-align: left;
}

.restricted-icon {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 8px;
}

/* ============================================
   ОСНОВНОЕ СОДЕРЖИМОЕ ПРИЛОЖЕНИЯ
   ============================================ */

.app-main {
    display: none;
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

body.in-messenger .restricted-message {
    display: none;
}

body.in-messenger .app-main {
    display: block;
}

.page {
    display: none;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 65px;
}

.page.active {
    display: block;
}

/* ============================================
   ЭКРАНЫ — два контейнера по вертикали
   ============================================ */

.top-container {
    height: 9vh;
    background-color: #323131;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.bottom-container {
    height: 91vh;
    background-color: #121213;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 0;
    overflow-y: auto;
}

/* Базовый стиль заголовка страницы */
.page-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 24px;
    text-align: left;
    transition: all 0.2s ease;
}

.page[data-page-title="home"] .page-title {
    font-size: 18px;
}

.page[data-page-title="news"] .page-title,
.page[data-page-title="code"] .page-title {
    font-size: 32px;
}

/* ============================================
   СТРАНИЦА "РАСПИСАНИЕ" — КАЛЕНДАРЬ
   ============================================ */

.calendar-week {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, minmax(44px, 64px));
    justify-content: center;
    gap: 6px;
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.calendar-day {
    aspect-ratio: 1 / 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: 36px;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    padding: 0;
    position: relative;
    z-index: 2;
}

.calendar-day.past {
    opacity: 0.6;
    cursor: not-allowed;
}

.calendar-day.past:active {
    transform: none;
    background: transparent;
}

@media (hover: hover) {
    .calendar-day:not(.past):not(.selected):hover {
        background: rgba(255, 255, 255, 0.08);
    }
}

.calendar-day:not(.past):active {
    transform: scale(0.94);
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.05s ease;
}

.calendar-day .day-name {
    font-size: 14px;
    font-weight: 400;
    color: #e5e5e5;
    margin-bottom: 2px;
    line-height: 1.2;
}

.calendar-day .day-number {
    font-size: 15px;
    font-weight: 400;
    color: #e5e5e5;
    line-height: 1.2;
}

.calendar-day.past .day-name,
.calendar-day.past .day-number {
    color: #848383;
}

/* Обёртка для календаря */
.calendar-week-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
}

/* Индикатор календаря (стеклянный) */
.calendar-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    border-radius: 50%;
    transition: none;
    z-index: 10;
    background: linear-gradient(
        140deg, 
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.6) 5%,
        rgba(255, 255, 255, 0.05) 29%,
        rgba(255, 255, 255, 0.05) 40%,
        rgba(255, 255, 255, 0.1) 55%,
        rgba(255, 255, 255, 0.1) 80%,
        rgba(255, 255, 255, 0.6) 85%,
        rgba(255, 255, 255, 0.6) 100%
    );
    box-shadow: 
        0 0 0 0.5px rgba(255, 255, 255, 0.2) inset,
        0 0 4px 2.5px rgba(255, 255, 255, 0.1) inset,
        1px 2px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* Анимация свайпа календаря */
.calendar-week.swiping {
    transition: none;
}

.calendar-week.swipe-left {
    transform: translateX(-100%);
}

.calendar-week.swipe-right {
    transform: translateX(100%);
}

/* ============================================
   ВЫБРАННЫЙ ДЕНЬ — БЕЗ ФОНА (индикатор за ним)
   ============================================ */

.calendar-day.selected {
    background: transparent;
    box-shadow: none;
}

.calendar-day.selected::before,
.calendar-day.selected::after {
    display: none;
}

.calendar-day.selected .day-name,
.calendar-day.selected .day-number {
    color: #ffffff;
}

.calendar-day.selected:active {
    transform: scale(0.94);
    transition: all 0.05s ease;
}

@media (hover: hover) {
    .calendar-day.selected:hover {
        background: transparent;
    }
}

/* ============================================
   СТРАНИЦА "НОВОСТИ"
   ============================================ */

.news-container {
    padding: 20px 20px 0 20px;
    display: flex;
    flex-direction: column;
}

.news-banner {
    position: relative;
    width: 100%;
    height: 170px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.news-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

.news-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    pointer-events: none;
}

.news-title {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
    z-index: 2;
    line-height: 1.3;
}

.news-date {
    position: absolute;
    bottom: 12px;
    left: 16px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 300;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
    z-index: 2;
    letter-spacing: 0.3px;
}

/* ============================================
   СТРАНИЦА "МОЙ КОД" — ШТРИХ-КОД
   ============================================ */

.barcode-container {
    padding: 20px 20px 0 20px;
    display: flex;
    flex-direction: column;
}

.barcode-wrapper {
    background-color: #ffffff;
    border-radius: 0px;
    padding: 8px;
    margin-bottom: 32px;
    display: block;
    width: 100%;
}

.barcode-canvas {
    display: block;
    width: 100%;
    height: auto;
    background-color: #ffffff;
}

.barcode-number {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #000000;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.promo-info {
    text-align: left;
    padding: 0 16px;
}

.promo-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.promo-discount {
    font-size: 36px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.promo-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, #3a3a3a 0%, #5a5a5a 50%, #3a3a3a 100%);
    margin: 20px 0;
}

.promo-note {
    font-size: 14px;
    font-weight: 500;
    color: #888888;
    letter-spacing: -0.2px;
    margin-top: 8px;
}

/* ============================================
   ТАПБАР (Liquid Glass)
   ============================================ */

.tabbar {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background-color: #121213;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 2px 2px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    border: 0.8px solid #272728;
    z-index: 100;
    gap: 4px;
    user-select: none;
}

/* Зона захвата для перетаскивания (больше тапбара) */
.tabbar-drag-zone {
    position: absolute;
    top: -20px;
    bottom: -20px;
    left: 0;
    right: 0;
    background: transparent;
    z-index: 10;
    cursor: grab;
    pointer-events: auto;
}

.tabbar.dragging .tabbar-drag-zone {
    cursor: grabbing;
}

/* Индикатор скольжения */
.tabbar-indicator {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    width: 0;
    background: linear-gradient(135deg, #343435 0%, #3f3f3f 100%);
    border-radius: 36px;
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1), width 0.2s ease;
    z-index: 5;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Состояние перетаскивания */
.tabbar.dragging .tabbar-indicator {
    transition: none;
    opacity: 0.9;
}

/* Окантовка индикатора */
.tabbar-indicator::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, #9a9a9b 0%, #1b1b1c 20%, #333333 80%, #9a9a9b 100%);
    border-radius: 37px;
    z-index: -1;
    opacity: 1;
}

/* Внутренняя обводка индикатора */
.tabbar-indicator::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;
    background: linear-gradient(135deg, #343435 0%, #3f3f3f 100%);
    border-radius: 35px;
    z-index: -1;
}

/* Кнопки тапбара */
.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0px;
    padding: 4px 4px;
    border-radius: 36px;
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    position: relative;
    z-index: 11;
    pointer-events: auto;
}

/* Активная кнопка — без фона (индикатор за ней) */
.tabbar-item.active {
    background: transparent;
    box-shadow: none;
}

.tabbar-item.active::before,
.tabbar-item.active::after {
    display: none;
}

.tabbar-item:active {
    transform: scale(0.94);
    transition: all 0.05s ease;
}

/* Во время перетаскивания — кнопки пропускают события */
.tabbar.dragging .tabbar-item {
    pointer-events: none;
}

.tabbar-icon {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: all 0.2s ease;
}

.tabbar-label {
    font-size: 10px;
    font-weight: 500;
    color: #ffffff;
    transition: all 0.2s ease;
    opacity: 0.7;
    margin-top: 0px;
}

.tabbar-item.active .tabbar-label {
    opacity: 1;
}

.tabbar-item:focus-visible {
    outline: none;
}

@media (hover: hover) {
    .tabbar-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}
