/* ==========================
   Calendar Wrapper
========================== */
.calendar {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 2rem;
  margin: 2rem auto;
  overflow: hidden;
}
.event-details-text {
  white-space: pre-wrap;
  text-align: left; /* preserves line breaks and spacing */
}
.calendar-event-link .bi-link-45deg {
  color: orangered;
  font-size: 25px;
}
/* ==========================
   Nav
========================== */
.nav-btn-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.nav-btn {
  background: var(--primary, #3b82f6);
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.nav-btn:hover {
  background: var(--primary-dark, #1e3a8a);
}

/* ==========================
   List View
========================== */
.event-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.event-table th,
.event-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 0.9rem;
}

.event-table th {
  background: #f9fafb;
  font-weight: bold;
  color: #333;
}

.event-table tr:hover {
  background: #f3f4f6;
}

.event-table td .badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}
#calendar h3 {
  text-align: center;
}
.event-edit-btn {
  margin: 15px 0;
}
.list-item-add-btn {
  margin-top: 15px;
}

.event-start,
.event-end {
  font-weight: 700;
}

.event-location {
  font-size: 0.8rem;
}
.date-time {
  font-size: 18px;
}

.badge {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  margin-right: 10px;
  text-transform: capitalize;
}

/* Event title/details */
.event-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
}

.event-details {
  font-size: 0.9rem;
  color: #4b5563;
}

/* Action buttons aligned to right */
.event-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}
.list-footer,
.calendar-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}
.event-table td,
.event-table th {
  text-align: center;
}
.event-table td:last-child {
  cursor: pointer;
}
/* ==========================
   Month View
========================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: left;
}

/* Weekday headers */
.calendar-grid .day-name {
  font-weight: 600;
  text-align: center;
  padding: 0.5rem;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #374151;
}

/* Day cells */
.day {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-height: 120px;
  padding: 6px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
}
.day:hover {
  background: #f9fafb;
}
.day .date {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: #333;
}

/* Events inside day cells */
.day .event {
  border-radius: 6px;
  margin-top: 4px;
  padding: 3px 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
}
.event.flying,
.badge.flying {
  background: rgba(59, 130, 246, 0.5);
}
.event.meeting,
.badge.meeting {
  background: rgba(22, 163, 74, 0.5);
}
.event.maintenance,
.badge.maintenance {
  background: rgba(249, 115, 22, 0.5);
}
.event.special,
.badge.special {
  background: rgba(147, 51, 234, 0.5);
}
.event.closure,
.badge.closure {
  background: rgba(220, 38, 38, 0.5);
}

/* ==========================
   Modal
========================== */
.cal-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}
.cal-modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 400px;
  max-width: 95%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.2s ease;
}
.cal-modal-content h3 {
  margin-top: 0;
  font-size: 1.2rem;
}
.cal-modal-content label {
  font-weight: 600;
  margin-top: 12px;
  display: block;
}
.cal-modal-content input,
.cal-modal-content textarea,
.cal-modal-content select {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.cal-modal-content button {
  margin-top: 12px;
  padding: 10px;
  width: 100%;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
@keyframes fadeIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Tooltip styling (browser default uses title, but we can enhance) */

/* Base tooltip */
.has-tooltip {
  position: relative;
  cursor: pointer;
}

/* Shared tooltip styles */
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  background: #111827;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: normal;
  /* max-width: 340px; */
  width: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.has-tooltip::before {
  content: '';
  position: absolute;
  border-width: 6px;
  border-style: solid;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

/* Top */
.has-tooltip.tooltip-top::after {
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
}
.has-tooltip.tooltip-top::before {
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-color: #111827 transparent transparent transparent;
}

/* Bottom */
.has-tooltip.tooltip-bottom::after {
  top: 125%;
  left: 50%;
  transform: translateX(-50%);
}
.has-tooltip.tooltip-bottom::before {
  top: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-color: transparent transparent #111827 transparent;
}

/* Left */
.has-tooltip.tooltip-left::after {
  right: 125%;
  top: 50%;
  transform: translateY(-50%);
}
.has-tooltip.tooltip-left::before {
  right: 115%;
  top: 50%;
  transform: translateY(-50%);
  border-color: transparent transparent transparent #111827;
}

/* Right */
.has-tooltip.tooltip-right::after {
  left: 125%;
  top: 50%;
  transform: translateY(-50%);
}
.has-tooltip.tooltip-right::before {
  left: 115%;
  top: 50%;
  transform: translateY(-50%);
  border-color: transparent #111827 transparent transparent;
}

/* Show tooltip on hover */
.has-tooltip:hover::after,
.has-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

.event[title] {
  /* position: relative; */
  cursor: pointer;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}

.weekday {
  text-align: center;
  font-weight: bold;
  padding: 4px 0;
  background: #f3f4f6;
  border-radius: 4px;
  color: #333;
}

.day.empty {
  background: transparent;
  border: none;
}
.day.today {
  /* border: 2px solid var(--primary, #3b82f6); */
  background: #e0f2fe; /* light blue */
}
.day.today .date {
  color: #1e3a8a; /* darker blue */
  font-weight: bold;
}
