.bft-calendar-container {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 20px;
    font-family: inherit;
    user-select: none;
}

.bft-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 10px;
}

.bft-cal-title-wrap {
    text-align: center;
}

.bft-cal-selectors {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.bft-cal-select {
    border: none;
    background: transparent;
    font-size: 24px;
    font-weight: 800;
    color: #2c3e50;
    cursor: pointer;
    padding: 0 5px;
    border-radius: 4px;
    transition: background 0.2s;
    font-family: inherit;
    appearance: none; /* Hide default arrow for cleaner look */
    -webkit-appearance: none;
}

.bft-cal-select:hover {
    background: rgba(0,0,0,0.05);
}

.year-select {
    font-weight: 300;
    color: #b2bec3;
}

.bft-cal-today-link {
    background: none;
    border: none;
    padding: 0;
    margin-top: 8px;
    color: #2271b1;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
    display: block;
}

.bft-cal-today-link:hover {
    color: #135e96;
    text-decoration: underline;
}

.bft-cal-nav {
    background: #f0f4f8;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    color: #34495e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bft-cal-nav:hover {
    background: #2271b1;
    color: #fff;
}

.bft-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.bft-cal-day-label {
    text-align: center;
    font-weight: 700;
    color: #95a5a6;
    font-size: 14px;
    padding-bottom: 5px;
}

.bft-cal-weekend {
    color: #e74c3c;
}

.bft-cal-day {
    aspect-ratio: 1;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
    transition: transform 0.2s, background 0.2s;
}

.bft-cal-day.empty {
    background: transparent;
}

.bft-cal-day.today {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.bft-cal-day.weekend {
    color: #e74c3c;
}

.bft-cal-day.is-holiday {
    background: #fff5f5;
}

.bft-cal-day.is-holiday.has-events {
    background: #2271b1; /* Keep blue if events exist */
}

.bft-cal-day.is-holiday::before {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: #e74c3c;
    border-radius: 50%;
}

.bft-cal-day.is-holiday.has-events::before {
    background: #ff7675;
    box-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.bft-cal-day.weekend {
    color: #e74c3c;
}

/* Day hover for all days (to show name day info) */
.bft-cal-day:hover {
    background: #ecf0f1;
    z-index: 5;
}

/* Popover Holiday Header */
.bft-cal-popover-holiday {
    background: #fff5f5;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #ffe3e3;
}

.holiday-icon {
    font-size: 16px;
}

.holiday-name {
    font-size: 13px;
    font-weight: 700;
    color: #c0392b;
}

/* Popover NameDay Section */
.bft-cal-popover-nameday {
    background: #f8f9fa;
    padding: 12px 15px;
    border-top: 1px solid #eee;
    color: #7f8c8d;
    text-align: center;
}

.nameday-value {
    color: #2c3e50;
    font-weight: 700;
    font-size: 14px;
    display: block;
}

.bft-cal-day.has-events {
    background: #2271b1;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.bft-cal-day.has-events:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* Popover Logic - Premium Card Style */
.bft-cal-popover {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 115%; /* Moved slightly closer */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 280px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.1);
    padding: 0;
    z-index: 1000;
    color: #333;
    pointer-events: none; /* Ignore mouse when hidden */
    overflow: visible; /* Allow bridge and arrow to show */
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    transition-delay: 0.1s; /* Small delay when closing to prevent flicker */
}

.bft-cal-popover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.98) transparent transparent transparent;
}

/* Hover Bridge - Prevents popover from disappearing when moving mouse between day and popover */
.bft-cal-popover::before {
    content: "";
    position: absolute;
    top: 100%;
    left: -20px;
    right: -20px;
    height: 40px; /* Taller bridge */
    background: transparent;
}

.bft-cal-day:hover .bft-cal-popover {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto; /* Enable mouse interaction when visible */
    transition-delay: 0s; /* Show instantly */
}

.bft-cal-event-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f4f8;
    padding: 15px;
    transition: background 0.2s;
}

.bft-cal-event-link:last-child {
    border-bottom: none;
}

.bft-cal-event-link:hover {
    background: rgba(0,0,0,0.02);
}

.event-top {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.event-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #34495e;
    flex-shrink: 0;
}

.event-info {
    flex: 1;
}

.event-title {
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 15px;
    line-height: 1.2;
}

.event-loc {
    font-size: 11px;
    color: #7f8c8d;
    font-weight: 500;
}

.event-btn {
    display: block;
    text-align: center;
    background: #27ae60;
    color: #fff !important;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}

.bft-cal-event-link:hover .event-btn {
    background: #2ecc71;
}

@keyframes bftFadeIn {
    from { opacity: 0; transform: translate(-50%, 15px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 500px) {
    .bft-cal-grid { gap: 5px; }
    .bft-cal-popover { 
        width: 220px; 
        left: 50%; 
        transform: translateX(-50%) translateY(10px); 
    }
    .bft-cal-day:hover .bft-cal-popover {
        transform: translateX(-50%) translateY(0);
    }
    .bft-cal-popover::after { 
        left: 50%; 
        transform: translateX(-50%); 
    }
    .bft-cal-nav { width: 35px; height: 35px; }
    .bft-cal-select { font-size: 20px; }
}
