/* ================== Общие настройки ================== */
.bizcal-widget {
    width: 100%;
    max-width: 420px;           /* компактный, как колонка новостей */
    margin: 0 auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bizcal-inner {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.08);
    padding: 16px 18px 14px;
    border: 1px solid rgba(0,44,96,0.06);
    overflow: visible; /* ничего не обрезаем */
    box-sizing: border-box;
}

/* Цвета */
:root {
    --bizcal-color-event:   #138551;
    --bizcal-color-holiday: #00a0bd;
    --bizcal-color-tax:     #ef4444;
    --bizcal-color-deadline:#facc15;
    --bizcal-text-main:     #0f172a;
}

/* ================== Экраны ================== */
.bizcal-screen {
    position: absolute;
    inset: 0;
    padding: 4px 0 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(0);
    transition: transform .22s ease-out, opacity .18s ease-out;
}

.bizcal-screen--active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

/* Анимация переходов (календарь ↔ день) */
.bizcal-screen--hide-left {
    transform: translateX(-6%);
    opacity: 0;
}
.bizcal-screen--hide-right {
    transform: translateX(6%);
    opacity: 0;
}

/* экран дня скроллится внутри фиксированной высоты */
#bizcal-screen-day {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ================== Шапка ================== */
.bizcal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bizcal-header-text {
    max-width: 60%;
}

.bizcal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #002c60;
}

.bizcal-subtitle {
    margin: 4px 0 0;
    font-size: 12px;
    color: #6b7280;
}

/* Шапка экрана дня */
.bizcal-header--day {
    margin-bottom: 12px;
}

/* ================== Кнопка экспорта ================== */
.bizcal-btn-export {
    position: relative;
    border-radius: 999px;
    border: 1px solid rgba(0,44,96,0.15);
    background: #f5f3ff;
    color: #002c60;
    font-size: 11px;
    font-weight: 500;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(15,23,42,0.08);
    white-space: nowrap;
    transition: background .12s ease, transform .12s ease, box-shadow .12s ease;
}

.bizcal-btn-export::before {
    content: "📅";
    font-size: 12px;
}

.bizcal-btn-export:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(15,23,42,0.14);
}

/* Тултип */
.bizcal-btn-export::after {
    content: attr(data-bizcal-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    background: #111827;
    color: #f9fafb;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.3;
    max-width: 220px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    transition: opacity .12s ease;
    z-index: 20;
    white-space: normal;
}

.bizcal-btn-export:hover::after {
    opacity: 1;
}

/* ================== Навигация месяца ================== */
.bizcal-month-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 4px;
    gap: 8px;
}

.bizcal-nav-btn {
    border: none;
    background: #f3f4f6;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #4b5563;
    transition: background .12s ease;
}

.bizcal-nav-btn:hover {
    background: #e5e7eb;
}

.bizcal-month-label {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--bizcal-text-main);
}

/* ================== Дни недели ================== */
.bizcal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

/* ================== Сетка дней ================== */
/* ВАЖНО: 6 строк всегда, фиксированная высота → календарь не прыгает и не обрезается */
.bizcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr); /* шесть недель максимум */
    gap: 4px;
    margin-bottom: 8px;
    height: 240px; /* общая высота сетки на десктопе */
}

/* ================== Ячейка дня ================== */
.bizcal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    padding: 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s ease, box-shadow .12s ease, transform .12s ease;
    position: relative;
    min-height: 0; /* чтобы grid-ряд не раздувался */
}

.bizcal-day--empty {
    cursor: default;
}

.bizcal-day:hover {
    background: #f3f4ff;
    box-shadow: 0 4px 10px rgba(15,23,42,0.08);
    transform: translateY(-1px);
}

/* цифра дня — кружок */
.bizcal-day-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    font-size: 12px;
    font-weight: 500;
    color: var(--bizcal-text-main);
    margin: 0 auto;
    line-height: normal;
}

/* текущая дата */
.bizcal-day--today .bizcal-day-number {
    background: #1a3880;
    color: #fff;
    font-weight: 600;
}

/* точки событий */
.bizcal-day-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 3px;
    align-items: center;
    justify-content: center;
}

.bizcal-dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
}

.bizcal-dot--event {
    background: var(--bizcal-color-event);
}
.bizcal-dot--holiday {
    background: var(--bizcal-color-holiday);
}
.bizcal-dot--tax {
    background: var(--bizcal-color-tax);
}
.bizcal-dot--deadline {
    background: var(--bizcal-color-deadline);
}

.bizcal-day-more {
    font-size: 9px;
    color: #6b7280;
}

/* ================== Легенда ================== */
.bizcal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
    margin-right: 4px;
}

.legend-dot--event {
    background: var(--bizcal-color-event);
}
.legend-dot--holiday {
    background: var(--bizcal-color-holiday);
}
.legend-dot--tax {
    background: var(--bizcal-color-tax);
}
.legend-dot--deadline {
    background: var(--bizcal-color-deadline);
}

/* ================== Экран дня ================== */
.bizcal-back-btn {
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 6px 12px;
    font-size: 11px;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .12s ease, box-shadow .12s ease, transform .12s ease;
}

.bizcal-back-btn:hover {
    background: #eef2ff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(15,23,42,0.1);
}

.bizcal-day-content {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #e5e7eb;
}

.bizcal-day-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bizcal-text-main);
}

.bizcal-day-empty {
    font-size: 12px;
    color: #9ca3af;
}

/* События в дне */
.bizcal-event {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.bizcal-event:last-child {
    border-bottom: none;
}

.bizcal-event-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 2px;
}

.bizcal-event-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--bizcal-text-main);
}

.bizcal-event-desc {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

/* ================== Поповер ================== */
.bizcal-popover {
    position: absolute;
    z-index: 9999;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.18);
    padding: 8px 10px;
    min-width: 160px;
    max-width: 220px;
    font-size: 12px;
    line-height: 1.3;
    color: var(--bizcal-text-main);
    transform: translate(-50%, -8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease-out, transform .12s ease-out;
}

.bizcal-popover--visible {
    opacity: 1;
    transform: translate(-50%, -12px);
}

.bizcal-pop-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
}

.bizcal-pop-item:last-child {
    margin-bottom: 0;
}

.bizcal-pop-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    margin-top: 4px;
    flex-shrink: 0;
}

.bizcal-pop-dot--event {
    background: var(--bizcal-color-event);
}
.bizcal-pop-dot--holiday {
    background: var(--bizcal-color-holiday);
}
.bizcal-pop-dot--tax {
    background: var(--bizcal-color-tax);
}
.bizcal-pop-dot--deadline {
    background: var(--bizcal-color-deadline);
}

.bizcal-pop-text {
    flex: 1;
}

/* Отключаем поповер на мобилке */
@media (max-width: 991.98px) {
    .bizcal-popover {
        display: none !important;
    }
}

/* ================== Мобилка ================== */
@media (max-width: 575.98px) {

    .bizcal-inner {
        padding: 14px 12px 12px;
    }

    .bizcal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .bizcal-header-text {
        max-width: 100%;
    }

    .bizcal-btn-export {
        align-self: stretch;
        justify-content: center;
        margin-top: 10px;
    }

    /* на мобилке даём сетке побольше высоты */
    .bizcal-grid {
        height: 280px;
    }
}
.bizcal-event-link {
    margin-top: 6px;
    font-size: 11px;
    color: #002c60;
}

.bizcal-event-link a {
    color: #002c60;
    text-decoration: underline;
}

/* ===== Адаптация календаря под стиль новостного блока damu.kz ===== */

.bizcal-inner {
    border-radius: 0 !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
    padding: 20px 20px 16px !important;
}

.bizcal-title {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 20px !important;
    font-weight: 600 !important;
}

.bizcal-btn-export {
    background: #f6f7f9 !important;
    border: 1px solid #d1d5db !important;
    color: #002c60 !important;
}

.bizcal-btn-export:hover {
    background: #eef2f7 !important;
}

.bizcal-subtitle {
    font-size: 13px !important;
    color: #6b7280 !important;
}

.bizcal-legend {
    margin-top: 10px !important;
}
