/* ============================
   Custom Event Calendar - Frontend Styles
   ============================ */

.cec-calendar-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
}

.cec-calendar-wrapper {
    position: relative;
    width: 100%;
}

/* ========================
   HEADER
   ======================== */
.cec-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 0;
    position: relative;
}

.cec-month-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    flex: 1;
    order: 2;
    cursor: default;
    user-select: none;
}

.cec-nav-arrow {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    padding: 6px 12px;
    color: #333;
    transition: all 0.2s ease;
    order: 1;
}

.cec-nav-arrow.cec-next-month {
    order: 3;
}

.cec-nav-arrow:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.cec-today-btn {
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s ease;
    order: 4;
    white-space: nowrap;
}

.cec-today-btn:hover {
    background: #005a87;
}

/* Кнопка мини-календаря */
.cec-minical-toggle {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 10px;
    transition: all 0.2s ease;
    order: 5;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.cec-minical-toggle:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

/* ========================
   SEARCH
   ======================== */
.cec-search-wrap {
    position: relative;
    margin-bottom: 10px;
}

.cec-search-wrap input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
}

.cec-search-wrap input:focus {
    border-color: #007cba;
}

.cec-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cec-search-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 8px;
}

.cec-search-item:last-child {
    border-bottom: none;
}

.cec-search-item:hover {
    background: #f8f8f8;
}

.cec-search-item-date {
    color: #888;
    font-size: 12px;
    white-space: nowrap;
}

.cec-search-item-title {
    font-size: 14px;
}

.cec-search-empty {
    padding: 10px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* ========================
   WEEKDAYS
   ======================== */
.cec-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.cec-weekday {
    padding: 4px;
}

/* ========================
   DAYS GRID
   ======================== */
.cec-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    min-height: 400px;
}

.cec-day-cell {
    background: #fff;
    min-height: 80px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    flex-direction: column;
}

.cec-day-cell.cec-empty {
    background: #fafafa;
    cursor: default;
}

.cec-day-cell:hover {
    background: #f5f8ff;
}

.cec-day-cell.has-events {
    background: #f0f7ff;
}

.cec-day-cell.today {
    background: #fff9e6;
}

.cec-day-cell.today .cec-day-number {
    background: #007cba;
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.cec-day-number {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.cec-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    flex: 1;
}

.cec-event-item {
    font-size: 11px;
    line-height: 1.3;
    color: #007cba;
    background: #e8f4fd;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease;
}

.cec-event-item:hover {
    background: #cce5ff;
}

.cec-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #888;
    background: #fff;
}

/* ========================
   MINI CALENDAR
   ======================== */
.cec-minical-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    padding: 12px;
    width: 220px;
}

.cec-minical-year {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.cec-minical-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.cec-minical-month {
    text-align: center;
    padding: 6px 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cec-minical-month:hover {
    background: #f0f0f0;
}

.cec-minical-month.current {
    background: #e8f4fd;
    color: #007cba;
    font-weight: 600;
}

.cec-minical-month.selected {
    background: #007cba;
    color: #fff;
    font-weight: 600;
}

/* ========================
   MODAL
   ======================== */
.cec-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cec-modal {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.cec-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    transition: color 0.15s;
}

.cec-modal-close:hover {
    color: #333;
}

.cec-modal-img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.cec-modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #333;
}

.cec-modal-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

.cec-modal-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #007cba;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.cec-modal-btn:hover {
    background: #005a87;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 768px) {
    .cec-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .cec-month-title {
        font-size: 16px;
        flex: 1 1 100%;
        order: -1;
    }
    
    .cec-nav-arrow {
        font-size: 14px;
        padding: 4px 10px;
    }
    
    .cec-today-btn {
        font-size: 12px;
        padding: 4px 10px;
    }
    
    .cec-day-cell {
        min-height: 55px;
        padding: 4px;
    }
    
    .cec-day-number {
        font-size: 12px;
    }
    
    .cec-event-item {
        font-size: 10px;
        padding: 1px 3px;
    }
    
    .cec-weekdays {
        font-size: 11px;
    }
    
    .cec-minical-dropdown {
        width: 180px;
        left: 0;
        right: auto;
    }
    
    .cec-minical-month {
        font-size: 11px;
        padding: 4px 2px;
    }
}

@media (max-width: 480px) {
    .cec-day-cell {
        min-height: 45px;
        padding: 2px;
    }
    
    .cec-day-number {
        font-size: 11px;
    }
    
    .cec-event-item {
        font-size: 9px;
    }
}