/**
 * Стили для Thistle Calendar
 * Цвета и стили управляются UIKit
 */

.thistle-calendar {
    max-width: 100%;
    margin: 0 auto;
}

/* Заголовок календаря */
.thistle-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.thistle-calendar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thistle-calendar-title {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.thistle-calendar-view-switcher {
    display: flex;
    gap: 5px;
}

.thistle-calendar-view-btn {
    cursor: pointer;
}

/* Месячный вид */
.thistle-calendar-month {
    border-top: 1px solid;
    border-bottom: 0px solid;
    border-left: 1px solid;
    border-right: 1px solid;
    border-radius: 0;
    overflow: hidden;
}

.thistle-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid;
}

.thistle-calendar-weekday {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid;
}

.thistle-calendar-weekday:last-child {
    border-right: none;
}

.thistle-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid;
}

.thistle-calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
   
    border-right: 1px solid;
}

.thistle-calendar-day {
    border-right: 1px solid;
    border-bottom: 1px solid;
    padding: 8px;
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
}

.thistle-calendar-day:last-child {
    border-right: none;
}

.thistle-calendar-day-number {
    font-size: 14px;
    margin-bottom: 4px;
}

/* Убрали старые стили для .thistle-calendar-day-events */

.thistle-calendar-event {
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.2;
}

/* UIKit карточки - не переопределяем стили */

.thistle-calendar-event-link {
    display: block;
    padding: 2px 4px;
    text-decoration: none;
    border-radius: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Недельный вид */
.thistle-calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-left: 1px solid;
    border-right: 1px solid;
    border-radius: 0;
    overflow: hidden;
}

.thistle-calendar-week-column {
    display: flex;
    flex-direction: column;
    border-right: 1px solid;
}

.thistle-calendar-week-column:last-child {
    border-right: none;
}

.thistle-calendar-week-day-header {
    padding: 12px 8px;
    text-align: center;
    flex-shrink: 0;
    border-bottom: 1px solid;
}

.thistle-calendar-week-day-name {
    font-size: 12px;
    margin-bottom: 4px;
}

.thistle-calendar-week-day-number {
    font-size: 18px;
    font-weight: 600;
}

.thistle-calendar-week-day-content {
    flex: 1;
    padding: 8px;
    min-height: 300px;
}

/* Убираем отладочную подсветку */

/* Время событий - используем UIKit классы */

.thistle-calendar-event-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
}

.thistle-calendar-event-location {
    font-size: 10px;
}

/* Списковый вид */
.thistle-calendar-list {
    border: 1px solid;
    border-radius: 0;
    overflow: hidden;
}

.thistle-calendar-month-section {
    border-bottom: 1px solid;
}

.thistle-calendar-month-section:last-child {
    border-bottom: none;
}

.thistle-calendar-month-header {
    background: rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
    border-bottom: 1px solid;
}

/* Заголовки месяцев - используем UIKit классы */



.thistle-calendar-list-event {
    display: flex;
    border-bottom: 1px solid;
    padding: 15px;
}

.thistle-calendar-list-event:last-child {
    border-bottom: none;
}

/* Используем UIKit классы */

.thistle-calendar-list-event-content {
    flex: 1;
}

.thistle-calendar-list-event-link {
    text-decoration: none;
    color: inherit;
}

.thistle-calendar-list-event-link:hover {
    text-decoration: none;
    color: inherit;
}

/* Адаптивность */
@media (max-width: 768px) {
    .thistle-calendar-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .thistle-calendar-controls {
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .thistle-calendar-view-switcher {
        justify-content: center;
    }
    
    .thistle-calendar-weekday {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .thistle-calendar-day {
        min-height: 80px;
        padding: 4px;
    }
    
   
    
    .thistle-calendar-event {
        font-size: 10px;
    }
    
    .thistle-calendar-week-content {
        min-height: 200px;
    }
    
    .thistle-calendar-week-day-content {
        min-height: 200px;
        padding: 4px;
    }
    
    .thistle-calendar-list-event {
        flex-direction: column;
        padding: 10px;
    }
    
    .thistle-calendar-list-event-date {
        margin-bottom: 5px;
        margin-right: 0;
    }
    
    .thistle-calendar-list-event-details {
        flex-direction: column;
        gap: 5px;
    }
}

/* Мобильные устройства - только месячный вид */
@media (max-width: 768px) {
    /* Контролы навигации остаются на мобильном */
    .thistle-calendar-controls {
        display: flex !important;
    }
    
    /* Стили для кнопок навигации на мобильном */
    .thistle-calendar-prev,
    .thistle-calendar-next {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Скрываем неделю и список на мобильном */
    .thistle-calendar-week,
    .thistle-calendar-list {
        display: none !important;
    }
    
    /* Показываем только месяц на мобильном */
    .thistle-calendar-month {
        display: block !important;
    }
    
    /* Сетка дней на мобильном */
    .thistle-calendar-days {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        border: 1px solid !important;
    }
    
    /* Дни на мобильном */
    .thistle-calendar-day {
        display: flex !important;
        flex-direction: column !important;
        min-height: 60px !important;
        padding: 4px !important;
        border-right: 1px solid !important;
        border-bottom: 1px solid !important;
    }
    
    /* Контент дня на мобильном */
    .thistle-calendar-day-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        height: 100% !important;
        gap: 5px !important;
       
    }
    
    /* Номер дня на мобильном */
    .thistle-calendar-day-number {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 24px !important;
        font-weight: bold !important;
        flex-shrink: 0 !important;
    }
    
    /* Кнопка событий на мобильном */
    .thistle-calendar-day-events-btn {
        font-size: 9px !important;
        padding: 2px 4px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
    }
    
    /* Скрываем текст "Событий:" на мобильном */
    .thistle-calendar-day-events-btn .thistle-calendar-events-text {
        display: none !important;
    }
    
    /* Показываем только иконку и число на мобильном */
    .thistle-calendar-day-events-btn span[uk-icon] {
        display: inline-block !important;
    }
    
    /* Скрываем весь переключатель видов на мобильном */
    .thistle-calendar-view-switcher {
        display: none !important;
    }
    
    .thistle-calendar-month-header {
        padding: 12px 15px;
    }
    
    .thistle-calendar-list-event {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .thistle-calendar-day {
        min-height: 80px;
        padding: 8px 4px;
    }
    
    .thistle-calendar-day-number {
        font-size: 16px;
    }
    
    .thistle-calendar-day-events-btn {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .thistle-calendar-event {
        font-size: 9px;
    }
    
    .thistle-calendar-month-header {
        padding: 10px 12px;
    }
    
    .thistle-calendar-list-event {
        padding: 10px 12px;
    }
}

/* Загрузка */
.thistle-calendar-loading {
    text-align: center;
    padding: 20px;
}

.thistle-calendar-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #a80a0a;
    border-radius: 50%;
    animation: thistle-spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes thistle-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ошибки */
.thistle-calendar-error {
    padding: 15px;
    border-radius: 0;
    margin: 10px 0;
}

/* Кнопки навигации */
.thistle-calendar-prev,
.thistle-calendar-next {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.thistle-calendar-prev:disabled,
.thistle-calendar-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Иконки в кнопках навигации */
.thistle-calendar-prev span,
.thistle-calendar-next span {
    display: inline-block;
    width: 16px;
    height: 16px;
}

/* Прокрутка для списка событий */
.thistle-calendar-list {
    max-height: 620px !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    position: relative;
    z-index: 10;
}

/* Прокрутка для месяца и недели */
.thistle-calendar-month,
.thistle-calendar-week {
    position: relative;
    z-index: 10;
}

/* Контент дня */
.thistle-calendar-day-content {
    display: flex;
    align-items: center;
    
    width: 100%;
    height: 100%;
    gap: 10px;
    z-index: 1;
    position: relative;
}

/* Номер дня */
.thistle-calendar-day-number {
  
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 38px;
    flex-shrink: 0;
}



/* Модалка событий дня */
.thistle-calendar-day-modal-events {
    
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* Кнопка событий в дне */
.thistle-calendar-day-events-btn {
    font-size: 9px;
    padding: 3px 5px;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: fit-content;
}

/* Иконки в кнопках событий */
.thistle-calendar-day-events-btn span {
   
    width: 16px;
    height: 16px;
}

/* Широкая модалка */
.uk-modal-dialog {
    max-width: 800px;
}

/* События в модалке - стек */
.thistle-calendar-modal-event {
    border-bottom: 1px dotted;
    padding: 15px 0;
}

.thistle-calendar-modal-event:last-child {
    border-bottom: none;
}

/* Кнопка "Открыть" в модалке */
.thistle-calendar-modal-event .uk-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.thistle-calendar-day-modal-events::-webkit-scrollbar {
    width: 8px;
}

.thistle-calendar-day-modal-events::-webkit-scrollbar-track {
    background: transparent;
}

.thistle-calendar-day-modal-events::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.thistle-calendar-day-modal-events::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}

.thistle-calendar-week-day-events {
    /* Скроллинг убран */
}

/* Webkit скроллбары только для списка */
.thistle-calendar-list::-webkit-scrollbar {
    width: 8px;
}

.thistle-calendar-list::-webkit-scrollbar-track {
    background: transparent;
}

.thistle-calendar-list::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.thistle-calendar-list::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}
