/* mini-app/style.css */

/* Сброс для корректного масштабирования */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
    color: #fff;
    background-color: transparent !important;
    touch-action: manipulation; /* Улучшает обработку касаний */
}

/* Для фона Telegram - делаем полностью прозрачным */
body {
    background: transparent !important;
}

.calendar-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: transparent !important;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Фоновое изображение */
.advent-background-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: -1;
    pointer-events: none;
    opacity: 1;
}

.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
    z-index: 1000;
}

/* Верхнее окошко (1 декабря) */
.top-day-container {
    width: 15vmin; 
    height: 20vmin;
    margin-top: 23vmin;
    margin-left: 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

/* Основная сетка календаря */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 1fr;
    width: 70vmin;
    height: 75vmin;
    margin-top: 5vmin;
    gap: 1.5vmin;
    position: relative;
    z-index: 1;
}

/* Ячейки дней */
.calendar-day {
    position: relative;
    width: 90%;
    height: 90%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: top;
    background-repeat: no-repeat;
    border-radius: 4px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.calendar-day.can-click {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.calendar-day.can-click:active {
    transform: scale(0.95);
}
.calendar-day.locked {
    cursor: default;
    opacity: 0.6;
}
.calendar-day.no-poster.can-click::after {
    content: attr(data-day);
    position: absolute;
    color: white;
    font-size: 1.8vmin;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    z-index: 2;
}

/* Оверлей постера */
.poster-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    backdrop-filter: blur(5px);
}
.poster-overlay-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    justify-content: center;
    align-items: center;
}
#fullSizePoster {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.close-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.7);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    transition: background 0.3s ease;
}
.close-overlay:hover,
.close-overlay:focus {
    background: rgba(0,0,0,0.5);
}

/* Виджет пользователя */
.user-widget {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    background: transparent; /* прозрачный фон */
    border-radius: 50%;
    padding: 0;
    z-index: 9999;
}

.user-widget img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}


/* Медиа-запросы */
@media (max-aspect-ratio: 9/16) {
    .top-day-container {
        width: 13vmin;
        height: 16vmin;
        margin-top: 36vmin;
    }
    .calendar-grid {
        width: 72vmin;
        height: 101vmin;
        gap: 1vmin;
    }
}
@media (min-width: 1200px) {
    .top-day-container {
        width: 78px;
        height: 100px;
        margin-top: 104px;
    }
    .calendar-grid {
        width: 454px;
        height: 620px;
        gap: 8px;
    }
}
