/* BaseCloud Calendar Styles */

/* Hide only the 15-minute quarter lines while keeping hour and half-hour lines */
.fc-timegrid .fc-timegrid-slot[data-time$=":15:00"],
.fc-timegrid .fc-timegrid-slot[data-time$=":45:00"] {
	border-top: none !important;
}

/* Ensure half-hour lines have a subtle dotted border */
.fc-timegrid .fc-timegrid-slot[data-time$=":30:00"] {
	border-top: 1px dotted #dee2e6 !important;
}

/* Calendar Container Sizing Fix */
#calendar {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}

/* Ensure FullCalendar content is properly sized */
.fc {
	width: 100% !important;
	max-width: 100% !important;
}

.fc-view-harness {
	width: 100% !important;
	max-width: 100% !important;
}

.fc-scrollgrid {
	width: 100% !important;
	max-width: 100% !important;
}

.fc-scroller {
	width: 100% !important;
	max-width: 100% !important;
}

/* Fix for initial render sizing issues */
.fc-daygrid-body,
.fc-timegrid-body {
	width: 100% !important;
	min-width: 100% !important;
}

.fc-scrollgrid-sync-table {
	width: 100% !important;
}


/* FullCalendar customization */
.fc-event {
	border-radius: 4px;
	font-size: 0.875rem;
	position: relative;
}

.fc-button-group .fc-button {
	background-color: #6c757d;
	border-color: #6c757d;
	font-size: 0.875rem;
}

.fc-button-group .fc-button:hover {
	background-color: #5c636a;
	border-color: #565e64;
}

.fc-button-group .fc-button-active {
	background-color: #0d6efd !important;
	border-color: #0d6efd !important;
}

.fc-today-button {
	background-color: #198754 !important;
	border-color: #198754 !important;
}

.fc-today-button:hover {
	background-color: #157347 !important;
	border-color: #146c43 !important;
}

/* Loading overlay */
.calendar-loading {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}


#bc_calendar_menu {
	overflow-y: auto;
	overscroll-behavior: contain;
	max-height: 90vh;
	width: 700px;
}

#bc_calendar_menu .fc {
    max-width: 100%;
}

/* Event Popover Container */
#eventPopover {
    max-width: 350px;
    min-width: 280px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#eventPopover .card-body {
    padding: 0;
}

#eventPopover .card {
    border: 1px solid rgba(0, 0, 0, 0.125);
}


/* Event Popover Styling */
.event-popover-content {
    padding: 1rem;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popover-expand-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.popover-expand-btn i {
    font-size: 0.75rem;
}

.event-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-right: 2rem;
    color: #212529;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.event-detail-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    min-width: 0; /* Allow flex items to shrink */
}

.event-detail-row:last-of-type {
    margin-bottom: 1rem;
}

.event-detail-icon {
    width: 20px;
    flex-shrink: 0;
    margin-right: 0.75rem;
    margin-top: 0.1rem;
    color: #6c757d;
}

.event-detail-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    min-width: 0; /* Allow content to shrink */
}

.organizer-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* Attendee status styling */
.attendee-status {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.attendee-status:last-child {
    margin-bottom: 0;
}

.attendee-status i {
    font-size: 0.8em;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.attendee-status .attendee-list {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.status-accepted {
    color: #28a745;
}

.status-declined {
    color: #dc3545;
}

.status-tentative {
    color: #ffc107;
}

.status-pending {
    color: #6c757d;
}

/* Enhanced organizer display */
.organizer-you {
    font-weight: 600;
    color: #207AF9;
}

/* Calendar invite response section in popover */
.calendar-invite-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 0.75rem 0;
    margin: 0.75rem 0;
}

.calendar-invite-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.calendar-invite-actions .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

#popoverResponseButtons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#popoverResponseStatus .badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
}

.event-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.event-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Arrow positioning */
#eventPopover::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

#eventPopover.arrow-top::before {
    top: -16px;
    left: var(--arrow-left, 20px);
    border-bottom-color: rgba(0, 0, 0, 0.125);
}

#eventPopover.arrow-top::after {
    content: '';
    position: absolute;
    top: -15px;
    left: calc(var(--arrow-left, 20px) + 1px);
    width: 0;
    height: 0;
    border: 7px solid transparent;
    border-bottom-color: white;
}

#eventPopover.arrow-bottom::before {
    bottom: -16px;
    left: var(--arrow-left, 20px);
    border-top-color: rgba(0, 0, 0, 0.125);
}

#eventPopover.arrow-bottom::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: calc(var(--arrow-left, 20px) + 1px);
    width: 0;
    height: 0;
    border: 7px solid transparent;
    border-top-color: white;
}

#eventPopover.arrow-left::before {
    left: -16px;
    top: var(--arrow-top, 30px);
    border-right-color: rgba(0, 0, 0, 0.125);
}

#eventPopover.arrow-left::after {
    content: '';
    position: absolute;
    left: -14px;
    top: calc(var(--arrow-top, 30px) + 1px);
    width: 0;
    height: 0;
    border: 7px solid transparent;
    border-right-color: white;
}

#eventPopover.arrow-right::before {
    right: -16px;
    top: var(--arrow-top, 30px);
    border-left-color: rgba(0, 0, 0, 0.125);
}

#eventPopover.arrow-right::after {
    content: '';
    position: absolute;
    right: -14px;
    top: calc(var(--arrow-top, 30px) + 1px);
    width: 0;
    height: 0;
    border: 7px solid transparent;
    border-left-color: white;
}


/* Event Highlighting Animation - Optimized to prevent layout shifts */
@keyframes eventPulse {
    0% { 
        transform: scale(1); 
        background-color: var(--event-original-color, #0d6efd) !important;
        box-shadow: 0 0 8px rgba(13, 110, 253, 0.4);
        border: 2px solid rgba(13, 110, 253, 0.5) !important;
    }
    50% { 
        transform: scale(1.08); 
        background-color: #28a745 !important;
        box-shadow: 0 0 20px rgba(40, 167, 69, 0.7);
        border: 2px solid #28a745 !important;
    }
    100% { 
        transform: scale(1); 
        background-color: var(--event-original-color, #0d6efd) !important;
        box-shadow: 0 0 8px rgba(13, 110, 253, 0.4);
        border-color: rgba(13, 110, 253, 0.5) !important;
    }
}

/* Event highlight class for applying animation */
.event-highlight {
    border-radius: 4px;
    transition: all 0.3s ease;
    /* Ensure the element doesn't affect layout during animation */
    will-change: background-color, box-shadow, border-color;
}

/* Specific rule for FullCalendar events with pulse animation */
.fc-event.event-highlight {
    /* Override any FullCalendar positioning that might interfere */
    transform-origin: center center;
    /* Ensure animations are smooth and don't cause reflows */
    backface-visibility: hidden;
    perspective: 1000px;
}




/* Modal-specific styles only */
#eventModal .time-slot {
  border-color: #e9ecef;
}

#eventModal .time-labels .time-slot {
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#eventModal .flex-grow-1 .time-slot:hover {
  background-color: #f8f9fa;
  cursor: pointer;
}

/* Borderless form controls - scoped to this modal */
#eventModal .form-control.border-0:focus {
  box-shadow: none;
}

/* Content editable placeholder - scoped to this modal */
#eventModal [contenteditable]:empty:before {
  content: attr(placeholder);
  color: #6c757d;
  font-style: italic;
}

#eventModal [contenteditable]:focus:before {
  content: "";
}

/* Recurring Event Styles */
.recurring-icon {
  color: white !important;
  font-size: 11px;
  position: absolute;
  top: 2px;
  right: 3px;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  opacity: 1;
}

/* Remove the dot indicator since we now have the icon in top-right */
.fc-event.recurring-event:after {
  display: none;
}



/* Google Maps Autocomplete Styling */
.pac-container {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 0.375rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    z-index: 2000; /* Ensure it appears above modals */
}

.pac-item {
    border-bottom: 1px solid #e9ecef;
    padding: 8px 12px;
    cursor: pointer;
    line-height: 1.4;
}

.pac-item:hover {
    background-color: #f8f9fa;
}

.pac-item:last-child {
    border-bottom: none;
}

.pac-item-selected,
.pac-item-selected:hover {
    background-color: #007bff;
    color: white;
}

.pac-matched {
    font-weight: 600;
}

.pac-item-query {
    color: #333;
    font-size: 14px;
}

.pac-secondary-text {
    color: #6c757d;
    font-size: 12px;
}

/* Location input with Google Maps integration */
#eventLocation {
    position: relative;
}

#eventLocation:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}



/* Location link styling in popover */
.event-detail-content a {
    transition: opacity 0.2s ease;
}

.event-detail-content a:hover {
    opacity: 0.8;
}

.event-detail-content a .fa-external-link-alt {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.event-detail-content a:hover .fa-external-link-alt {
    opacity: 1;
}

/* Google Maps autocomplete loading state */
.location-loading {
    position: relative;
}

.location-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Event popover description HTML content styling */
#popoverDescriptionText {
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
}

/* Custom scrollbar for description text */
#popoverDescriptionText::-webkit-scrollbar {
    width: 4px;
}

#popoverDescriptionText::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

#popoverDescriptionText::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

#popoverDescriptionText::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

#popoverDescriptionText p {
    margin: 0 0 8px 0;
}

#popoverDescriptionText p:last-child {
    margin-bottom: 0;
}

#popoverDescriptionText h1,
#popoverDescriptionText h2,
#popoverDescriptionText h3,
#popoverDescriptionText h4,
#popoverDescriptionText h5,
#popoverDescriptionText h6 {
    margin: 8px 0 4px 0;
    font-size: 1em;
    font-weight: 600;
}

#popoverDescriptionText ul,
#popoverDescriptionText ol {
    margin: 4px 0;
    padding-left: 20px;
}

#popoverDescriptionText li {
    margin: 2px 0;
}

#popoverDescriptionText strong,
#popoverDescriptionText b {
    font-weight: 600;
}

#popoverDescriptionText em,
#popoverDescriptionText i {
    font-style: italic;
}

#popoverDescriptionText u {
    text-decoration: underline;
}

#popoverDescriptionText a {
    color: #007bff;
    text-decoration: none;
}

#popoverDescriptionText a:hover {
    text-decoration: underline;
}

#popoverDescriptionText br {
    line-height: 1.5;
}

/* Ensure good spacing for HTML content */
#popoverDescriptionText div + div,
#popoverDescriptionText p + div,
#popoverDescriptionText div + p {
    margin-top: 8px;
}

/* Event popover attendees scrollable list */
#popoverAttendeesText {
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.4;
}

/* Individual attendee status styling */
.attendee-status {
    margin: 4px 0;
    padding: 2px 0;
}

.attendee-status:first-child {
    margin-top: 0;
}

.attendee-status:last-child {
    margin-bottom: 0;
}

/* Organizer styling */
.attendee-list.organizer-you {
    font-weight: 600;
    color: #207AF9 !important;
    border-left: 3px solid #207AF9;
    padding-left: 8px;
}

/* Attendee status colors */
.attendee-list.status-accepted {
    color: #28a745 !important;
}

.attendee-list.status-declined {
    color: #dc3545 !important;
}

.attendee-list.status-tentative {
    color: #ffc107 !important;
}

.attendee-list.status-pending {
    color: #6c757d !important;
}

/* Custom scrollbar for attendees list */
#popoverAttendeesText::-webkit-scrollbar {
    width: 4px;
}

#popoverAttendeesText::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

#popoverAttendeesText::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

#popoverAttendeesText::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Event styling for future events where user hasn't responded */
.fc-event.pending-response {
    border: 2px dotted currentColor !important;
    background-color: rgba(0, 86, 179, 0.7) !important;
    opacity: 0.8 !important;
}

.fc-event.pending-response .fc-event-main {
    /* Keep text fully readable */
    opacity: 1;
}

.fc-event.pending-response .fc-event-title {
    /* Keep title readable, just add subtle styling */
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* Add a subtle "pending" indicator */
.fc-event.pending-response::after {
    content: "?";
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 11px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
    line-height: 1;
}

/* Ensure the dotted border is visible on all event types */
.fc-event.pending-response.fc-event-past {
    border-style: dotted !important;
}

/* Override any existing styles that might conflict */
.fc-event.pending-response:hover {
    opacity: 0.9 !important;
    background-color: rgba(0, 86, 179, 0.85) !important;
    transform: translateY(-1px);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 86, 179, 0.3);
}

/* Calendar Response Button Styles */
.calendar-response-buttons .btn-group {
    width: 100%;
}

.calendar-response-buttons .btn-group .btn {
    flex: 1;
}

/* Change response link styling */
.change-response-link {
    color: #007bff !important;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
}

.change-response-link:hover {
    color: #0056b3 !important;
    text-decoration: none;
}
