/**
 * FullCalendar Custom Styles
 * Matches the Operations Dashboard dark theme
 */

/* ========== MAIN CALENDAR CONTAINER ========== */
#fullcalendar {
    background: rgba(30, 30, 35, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    color: #e5e7eb;
}

/* ========== TOOLBAR ========== */
.fc .fc-toolbar {
    background: rgba(30, 30, 35, 0.95);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.fc .fc-toolbar-title {
    color: #ffffff;
    font-size: 1.8em;
    font-weight: 700;
}

/* Toolbar buttons */
.fc .fc-button {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #ffffff;
    text-transform: capitalize;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.fc .fc-button:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
    color: #ffffff;
}

.fc .fc-button-active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
    color: #ffffff;
}

.fc .fc-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
}

/* ========== CALENDAR GRID ========== */
.fc .fc-view-harness {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

/* Day header (weekdays) */
.fc .fc-col-header-cell {
    background: rgba(30, 30, 35, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    padding: 15px 5px;
}

.fc .fc-col-header-cell-cushion {
    color: #9ca3af;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 1px;
}

/* Day cells */
.fc .fc-daygrid-day {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.fc .fc-daygrid-day:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Today */
.fc .fc-day-today {
    background: rgba(59, 130, 246, 0.15) !important;
    border: 2px solid rgba(59, 130, 246, 0.5) !important;
}

.fc .fc-day-today .fc-daygrid-day-number {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    line-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Day numbers */
.fc .fc-daygrid-day-number {
    color: #e5e7eb;
    font-weight: 600;
    padding: 8px;
    font-size: 0.95em;
}

/* Other month days */
.fc .fc-day-other {
    background: rgba(255, 255, 255, 0.01);
    opacity: 0.4;
}

.fc .fc-day-other .fc-daygrid-day-number {
    color: #6b7280;
}

/* ========== EVENTS ========== */
.fc-event {
    border-radius: 6px;
    padding: 4px 8px;
    margin: 2px 4px;
    border-width: 1px;
    border-style: solid;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
}

.fc-event-title {
    font-weight: 600;
    color: #ffffff;
}

/* Multi-date events - make them stand out */
.fc-event.event-multi-date {
    background: linear-gradient(90deg,
        var(--fc-event-bg-color) 0%,
        var(--fc-event-bg-color) 50%,
        rgba(59, 130, 246, 0.3) 100%
    );
    border-left: 4px solid var(--fc-event-border-color);
}

/* Status-based colors (matching your theme) */
.fc-event.event-status-quote {
    background-color: #f59e0b !important;
    border-color: #d97706 !important;
}

.fc-event.event-status-pending {
    background-color: #8b5cf6 !important;
    border-color: #7c3aed !important;
}

.fc-event.event-status-confirmed {
    background-color: #10b981 !important;
    border-color: #059669 !important;
}

.fc-event.event-status-completed {
    background-color: #6b7280 !important;
    border-color: #4b5563 !important;
}

.fc-event.event-status-cancelled {
    background-color: #ef4444 !important;
    border-color: #dc2626 !important;
    text-decoration: line-through;
    opacity: 0.7;
}

/* ========== MORE LINK ========== */
.fc .fc-more-link {
    color: #3b82f6;
    font-weight: 600;
}

.fc .fc-more-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ========== POPOVER (when clicking "+X more") ========== */
.fc .fc-popover {
    background: rgba(30, 30, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.fc .fc-popover-header {
    background: rgba(59, 130, 246, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 10px 15px;
}

.fc .fc-popover-close {
    color: #ffffff;
    opacity: 0.7;
}

.fc .fc-popover-close:hover {
    opacity: 1;
}

/* ========== LIST VIEW ========== */
.fc .fc-list {
    border-color: rgba(255, 255, 255, 0.1);
}

.fc .fc-list-day-cushion {
    background: rgba(30, 30, 35, 0.8);
    color: #ffffff;
}

.fc .fc-list-event {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.fc .fc-list-event:hover {
    background: rgba(255, 255, 255, 0.06);
}

.fc .fc-list-event-time {
    color: #9ca3af;
}

.fc .fc-list-event-title {
    color: #e5e7eb;
}

.fc .fc-list-empty {
    background: rgba(255, 255, 255, 0.02);
    color: #9ca3af;
}

/* ========== WEEK VIEW ========== */
.fc .fc-timegrid-slot {
    height: 3em;
    border-color: rgba(255, 255, 255, 0.05);
}

.fc .fc-timegrid-slot-label {
    color: #9ca3af;
}

/* ========== SCROLLBARS ========== */
.fc-scroller::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.fc-scroller::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.fc-scroller::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

.fc-scroller::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc .fc-toolbar-title {
        font-size: 1.4em;
    }

    .fc .fc-button {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .fc-event {
        font-size: 0.75em;
        padding: 2px 6px;
    }
}

/* ========== LOADING STATE ========== */
.fc .fc-loading {
    background: rgba(30, 30, 35, 0.95);
}

/* ========== HOVER TOOLTIP (optional enhancement) ========== */
.fc-event[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* ========== EVENT DATE BADGES ========== */
.fc-event-date-badges {
    display: flex;
    gap: 2px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.date-type-mini {
    display: inline-block;
    font-size: 0.9em;
    padding: 1px 3px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.3);
    cursor: help;
}

/* ========== EVENT TOOLTIP ========== */
.event-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    padding: 15px;
    min-width: 250px;
    max-width: 350px;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: tooltipFadeIn 0.2s ease;
    pointer-events: none;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-100% - 5px));
    }
    to {
        opacity: 1;
        transform: translate(-50%, -100%);
    }
}

.event-tooltip .tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.event-tooltip .tooltip-header strong {
    color: #ffffff;
    font-size: 1em;
}

.event-tooltip .tooltip-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

.event-tooltip .tooltip-status.status-quote {
    background: #f59e0b;
    color: #ffffff;
}

.event-tooltip .tooltip-status.status-pending {
    background: #8b5cf6;
    color: #ffffff;
}

.event-tooltip .tooltip-status.status-confirmed {
    background: #10b981;
    color: #ffffff;
}

.event-tooltip .tooltip-status.status-completed {
    background: #6b7280;
    color: #ffffff;
}

.event-tooltip .tooltip-status.status-cancelled {
    background: #ef4444;
    color: #ffffff;
}

.event-tooltip .tooltip-body {
    color: #e5e7eb;
    font-size: 0.9em;
}

.event-tooltip .tooltip-row {
    margin-bottom: 5px;
}

.event-tooltip .tooltip-row strong {
    color: #9ca3af;
    font-weight: 600;
}

.event-tooltip .tooltip-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8em;
    color: #9ca3af;
    font-style: italic;
}

/* ========== FILTER MODAL ========== */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.checkbox-group label:hover {
    background: rgba(59, 130, 246, 0.1);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.help-text {
    font-size: 0.85em;
    color: #9ca3af;
    margin-top: 5px;
    margin-bottom: 0;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ========== ENHANCED CALENDAR EVENTS ========== */
.fc-event {
    position: relative;
    overflow: visible;
}

.fc-event .fc-event-title-container {
    display: flex;
    flex-direction: column;
}

/* ========== TIME GRID WEEK VIEW ========== */
.fc .fc-timegrid-col-events {
    margin: 0 !important;
}

.fc .fc-timegrid-event {
    border-radius: 4px;
}

/* ========== RESPONSIVE TOOLTIPS ========== */
@media (max-width: 768px) {
    .event-tooltip {
        min-width: 200px;
        max-width: 250px;
        font-size: 0.9em;
    }

    .date-type-mini {
        font-size: 0.8em;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .fc .fc-toolbar {
        display: none;
    }

    .event-tooltip {
        display: none !important;
    }

    #fullcalendar {
        background: white;
        color: black;
    }

    .fc-event {
        page-break-inside: avoid;
    }
}
