/* ==========================================
   CALENDAR.CSS
   ========================================== */
.calendar-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: auto;
    min-height: calc(100vh - 180px);
    padding-bottom: 2rem;
}

.calendar-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-bg-card);
    backdrop-filter: blur(20px);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    border-bottom: 3px solid var(--color-primary);
    flex-wrap: wrap;
    gap: 1.5rem;
    box-shadow: var(--shadow-xl);
}

.cal-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cal-nav-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: 0.2s;
}

.cal-nav-btn:hover {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.05);
}

.cal-current-date {
    font-weight: 700;
    font-size: 1rem;
    text-transform: capitalize;
    min-width: 130px;
    text-align: center;
}

.calendar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--color-bg-card);
    position: relative;
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 0;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 1px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    flex: 1;
    gap: 1px;
    background: var(--color-border);
}

.cal-day {
    background: var(--color-bg-card);
    min-height: 85px;
    padding: 6px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
}

.cal-day:hover {
    background: rgba(255, 255, 255, 0.05);
}

.cal-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.cal-day-number {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.cal-day.today .cal-day-number {
    background: var(--color-primary);
    color: white;
}

.cal-day.empty {
    background: rgba(0, 0, 0, 0.2);
    cursor: default;
}

.cal-event-dot {
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    margin-bottom: 2px;
}

.cal-event-preview {
    font-size: 0.75rem;
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    border-left: 2px solid var(--color-primary);
}

/* View Switcher Buttons */
.cal-view-switch {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.cal-view-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: 6px 16px;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.cal-view-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.cal-view-btn.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Event Modal Items */
.event-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.event-desc {
    font-weight: 500;
    margin-bottom: 2px;
}

.event-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Done States */
.cal-event-preview.done {
    text-decoration: line-through;
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.2);
}

.event-item div.done .event-desc {
    text-decoration: line-through;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .calendar-header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .cal-nav-group {
        justify-content: space-between;
    }

    .cal-day {
        min-height: 80px;
    }
}

/* Cycle Day Badge */
.cycle-day-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #d8b4fe;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Event Checkbox */
.event-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* Custom Scrollbar removed - now global */

/* Blur Overlay for missing recipe */
.calendar-blur-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.calendar-container:has(.calendar-blur-overlay.active) {
    overflow: hidden;
}

.calendar-blur-overlay.active {
    display: flex;
}

.blur-content h3 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1rem;
}

.blur-content p {
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.blur-link {
    background: var(--color-primary);
    color: white !important;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: 0.3s;
    text-decoration: none;
}

.blur-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}