/* ============================================================
   МОДАЛЬНЫЕ ОКНА — карамельный стиль (30.09.2026)
   ============================================================ */

/* Широкая модалка — для сетки карточек */
.modal-content--wide {
    max-width: 900px !important;
    width: 95% !important;
}

/* Сетка карточек рецептов в модалке */
.modal-recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

/* Карточка рецепта */
.modal-recipe-card {
    display: flex;
    flex-direction: column;
    background: #FFF9F0;
    border: 2px solid #E8D5B8;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}
.modal-recipe-card:hover {
    transform: translateY(-3px);
    border-color: #D4A574;
    box-shadow: 0 8px 20px rgba(111, 78, 55, 0.2);
}

.modal-recipe-img {
    width: 100%;
    height: 130px;
    background: #F5EFE3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.modal-recipe-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.modal-recipe-placeholder {
    font-size: 48px;
    opacity: 0.35;
}

.modal-recipe-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}
.modal-recipe-title {
    font-size: 14px;
    font-weight: 800;
    color: #2C1810;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}
.modal-recipe-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #5D4037;
    font-weight: 600;
}

/* Кнопка внизу модалки */
.modal-footer-actions {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed rgba(201, 149, 91, 0.3);
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .modal-content--wide {
        max-width: 100% !important;
        width: 100% !important;
    }
    .modal-recipes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .modal-recipe-img {
        height: 100px;
    }
    .modal-recipe-title {
        font-size: 13px;
        min-height: 33px;
    }
}

/* ============================================================
   🎂 ИМЕНИННИКИ — карточки в модалке (30.09.2026)
   ============================================================ */

.birthday-section-title {
    font-size: 16px;
    font-weight: 800;
    color: #92400E;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #FBBF24;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-birthdays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.modal-birthday-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 12px 14px;
    background: #FFF9F0;
    border: 2px solid #E8D5B8;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.modal-birthday-card:hover {
    transform: translateY(-4px);
    border-color: #FBBF24;
    box-shadow: 0 10px 24px rgba(251, 191, 36, 0.3);
    background: #FFFBEB;
}

/* Особый стиль — именинник СЕГОДНЯ */
.modal-birthday-card.is-today {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border-color: #F59E0B;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}
.modal-birthday-card.is-today::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #F59E0B, #FBBF24, #F59E0B);
    animation: birthdayShine 2s ease-in-out infinite;
}
@keyframes birthdayShine {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.modal-birthday-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4A574, #C9955B);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
    border: 3px solid #C9955B;
    flex-shrink: 0;
}
.modal-birthday-card.is-today .modal-birthday-avatar {
    border-color: #F59E0B;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
}
.modal-birthday-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.modal-birthday-avatar span {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
}

.modal-birthday-name {
    font-size: 15px;
    font-weight: 800;
    color: #2C1810;
    margin-bottom: 4px;
    word-break: break-word;
    max-width: 100%;
}

.modal-birthday-date {
    font-size: 13px;
    color: #92400E;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-birthday-age {
    font-size: 12px;
    color: #5D4037;
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-birthday-days {
    font-size: 12px;
    color: #5D4037;
    font-weight: 700;
    padding: 4px 10px;
    background: #F0E5D2;
    border-radius: 12px;
}

.modal-birthday-badge {
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    padding: 5px 12px;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

@media (max-width: 600px) {
    .modal-birthdays-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .modal-birthday-card {
        padding: 14px 8px 12px;
    }
    .modal-birthday-avatar {
        width: 56px;
        height: 56px;
    }
    .modal-birthday-avatar span {
        font-size: 24px;
    }
    .modal-birthday-name {
        font-size: 13px;
    }
    .modal-birthday-date,
    .modal-birthday-age {
        font-size: 11px;
    }
    .birthday-section-title {
        font-size: 14px;
    }
}

/* 🆕 Усиление z-index для мобильного (шапка выше модалки) */
.modal-overlay {
    z-index: 999999 !important;
}
.modal-content {
    position: relative;
    z-index: 1000000 !important;
}

/* 🆕 Мобильная адаптация — карточки именинников на всю ширину */
@media (max-width: 600px) {
    .modal-overlay {
        padding: 10px !important;
        align-items: flex-start !important;
        padding-top: 60px !important;
    }
    .modal-content {
        max-height: calc(100vh - 80px) !important;
    }
}

/* 🆕 Мобильный тап для карточек */
.mini-stat-card,
.modal-birthday-card,
.modal-recipe-card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* 🆕 Полноэкранная модалка на мобильном */
@media (max-width: 600px) {
    .modal-overlay {
        padding: 0 !important;
        align-items: stretch !important;
    }
    .modal-content {
        max-width: 100vw !important;
        width: 100vw !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        margin: 0 !important;
    }
}

/* ============================================================
   🎉 ПОЗДРАВЛЕНИЯ — кнопки и счётчики (30.09.2026)
   ============================================================ */

/* Карточка именинника — теперь не ссылка целиком */
.modal-birthday-card {
    text-decoration: none;
}
.modal-birthday-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

/* Кнопка «Поздравить» */
.modal-birthday-congrat-btn {
    margin-top: 10px;
    padding: 8px 14px;
    width: 100%;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.modal-birthday-congrat-btn:hover {
    background: linear-gradient(135deg, #D97706, #B45309);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.5);
}
.modal-birthday-congrat-btn:active {
    transform: translateY(0);
}

/* Счётчик поздравлений */
.modal-birthday-congrats-count {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #92400E;
    padding: 3px 10px;
    background: rgba(251, 191, 36, 0.3);
    border-radius: 10px;
}

/* Пресеты поздравлений */
.congrat-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.congrat-presets button {
    padding: 6px 12px;
    background: #FEF3C7;
    color: #92400E;
    border: 2px solid #FBBF24;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.congrat-presets button:hover {
    background: #FDE68A;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(251, 191, 36, 0.4);
}

@media (max-width: 600px) {
    .modal-birthday-congrat-btn {
        padding: 7px 10px;
        font-size: 12px;
    }
    .congrat-presets button {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ============================================================
   🎂 КАРАМЕЛЬНЫЕ КАРТОЧКИ ИМЕНИННИКОВ (30.09.2026 v2)
   ============================================================ */

/* Перебиваем основные стили */
.modal-birthdays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.modal-birthday-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 14px 16px;
    background: linear-gradient(160deg, #FFF9F0 0%, #F5E6CE 100%) !important;
    border: 3px solid #E8D5B8 !important;
    border-radius: 18px !important;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(111, 78, 55, 0.12);
}

/* Декоративные шарики сверху */
.modal-birthday-card::before {
    content: '🎈';
    position: absolute;
    top: -8px;
    left: 8px;
    font-size: 22px;
    opacity: 0.5;
    transform: rotate(-15deg);
    transition: all 0.3s;
}
.modal-birthday-card::after {
    content: '🎈';
    position: absolute;
    top: -6px;
    right: 8px;
    font-size: 20px;
    opacity: 0.5;
    transform: rotate(15deg);
    transition: all 0.3s;
}

.modal-birthday-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: #FBBF24 !important;
    background: linear-gradient(160deg, #FFFBEB 0%, #FDE68A 100%) !important;
    box-shadow: 0 12px 30px rgba(251, 191, 36, 0.4);
}
.modal-birthday-card:hover::before,
.modal-birthday-card:hover::after {
    opacity: 1;
    transform: rotate(0) scale(1.2);
}

/* Особый стиль — именинник СЕГОДНЯ */
.modal-birthday-card.is-today {
    background: linear-gradient(160deg, #FEF3C7 0%, #FDE68A 50%, #FBBF24 100%) !important;
    border: 3px solid #F59E0B !important;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.7);
    animation: birthdayPulse 3s ease-in-out infinite;
}

.modal-birthday-card.is-today::before {
    content: '🎉';
    font-size: 26px;
    top: -4px;
    left: 10px;
}
.modal-birthday-card.is-today::after {
    content: '🎂';
    font-size: 24px;
    top: -2px;
    right: 10px;
}

@keyframes birthdayPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35),
                    inset 0 1px 0 rgba(255, 255, 255, 0.7);
    }
    50% {
        box-shadow: 0 12px 32px rgba(245, 158, 11, 0.55),
                    inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }
}

/* Аватар */
.modal-birthday-avatar {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4A574, #C9955B);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
    border: 3px solid #C9955B;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(160, 114, 45, 0.3);
    position: relative;
    z-index: 1;
}
.modal-birthday-card.is-today .modal-birthday-avatar {
    border-color: #F59E0B;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6),
                0 4px 12px rgba(160, 114, 45, 0.3);
}

.modal-birthday-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.modal-birthday-avatar span {
    font-size: 34px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Имя */
.modal-birthday-name {
    font-size: 15px;
    font-weight: 900;
    color: #78350F;
    margin-bottom: 6px;
    word-break: break-word;
    max-width: 100%;
    letter-spacing: -0.01em;
}

/* Дата */
.modal-birthday-date {
    font-size: 13px;
    color: #92400E;
    font-weight: 800;
    margin-bottom: 4px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
}

/* Возраст */
.modal-birthday-age {
    font-size: 12px;
    color: #78350F;
    font-weight: 700;
    margin-bottom: 6px;
}

/* «Через N дней» */
.modal-birthday-days {
    font-size: 12px;
    color: #78350F;
    font-weight: 800;
    padding: 5px 12px;
    background: rgba(251, 191, 36, 0.35);
    border: 1px solid rgba(251, 191, 36, 0.6);
    border-radius: 14px;
    margin-top: 4px;
}

/* «Сегодня!» — бейдж */
.modal-birthday-badge {
    font-size: 12px;
    font-weight: 900;
    color: #fff;
    padding: 6px 14px;
    background: linear-gradient(135deg, #F59E0B, #D97706, #B45309);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

/* Счётчик поздравлений */
.modal-birthday-congrats-count {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 800;
    color: #92400E;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(251, 191, 36, 0.5);
    border-radius: 12px;
}

/* Кнопка «Поздравить» — усиленная карамель */
.modal-birthday-congrat-btn {
    margin-top: 10px;
    padding: 10px 16px;
    width: 100%;
    background: linear-gradient(135deg, #F59E0B, #D97706) !important;
    color: #fff !important;
    border: none;
    border-radius: 12px;
    font-weight: 900;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.modal-birthday-congrat-btn:hover {
    background: linear-gradient(135deg, #D97706, #B45309) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}
.modal-birthday-congrat-btn:active {
    transform: translateY(0);
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .modal-birthdays-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .modal-birthday-card {
        padding: 16px 10px 14px;
        border-radius: 14px;
    }
    .modal-birthday-card::before,
    .modal-birthday-card::after {
        font-size: 18px;
    }
    .modal-birthday-avatar {
        width: 64px;
        height: 64px;
    }
    .modal-birthday-avatar span {
        font-size: 28px;
    }
    .modal-birthday-name {
        font-size: 13px;
    }
    .modal-birthday-date,
    .modal-birthday-age {
        font-size: 11px;
    }
    .modal-birthday-congrat-btn {
        font-size: 12px;
        padding: 9px 12px;
    }
}

/* ============================================================
   📱 BOTTOM SHEETS (мобильные ≤768px) — 09.10.2026
   Модалки выезжают снизу, а не центрируются.
   ============================================================ */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 0 !important;
        padding-top: 40px !important;
        background: rgba(0,0,0,0.6) !important;
    }

    .modal-content {
        max-width: 100vw !important;
        width: 100vw !important;
        max-height: 88vh !important;
        border-radius: 24px 24px 0 0 !important;
        margin: 0 !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0)) !important;
        animation: bottomSheetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.25) !important;
        overflow-y: auto !important;
    }

    /* «Ручка» сверху для свайпа */
    .modal-content::before {
        content: '';
        display: block;
        width: 44px;
        height: 4px;
        background: #C4A882;
        border-radius: 2px;
        margin: 8px auto 12px;
        opacity: 0.6;
    }

    .modal-header {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

@keyframes bottomSheetSlideUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}
