/**
 * HaxDB Events - Component Styles
 * Event-specific styles (calendar, event cards, etc.)
 * Base styles are in haxdb.css
 */

/* ==========================================================================
   Header Menu (Knox Makers style)
   ========================================================================== */

#header-menu {
  gap: 20px;
  flex-wrap: nowrap;
  font-family: 'Jost', sans-serif;
}

#header-menu .nav-item {
  list-style: none;
}

#header-menu .nav-link {
  color: #ffffff !important;
  text-decoration: none;
  padding: 10px;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

#header-menu .nav-link:hover,
#header-menu .nav-link:focus {
  color: #ffffff !important;
  text-decoration: none;
}

/* Hide Bootstrap's default caret everywhere (replaced by chevron icon) */
#header-menu .dropdown-toggle::after {
  display: none;
}

/* Chevron icon: mobile only, rotates when open */
#header-menu .dropdown-chevron {
  display: none;
  font-size: 0.75em;
  transition: transform 0.2s ease;
}
@media (max-width: 991.98px) {
  #header-menu .dropdown-chevron {
    display: inline;
  }
  #header-menu .dropdown-toggle[aria-expanded="true"] .dropdown-chevron {
    transform: rotate(180deg);
  }
}

/* Dropdown base styles */
#header-menu .dropdown-menu {
  background: rgb(104, 104, 104);
  border: none;
  border-radius: 0;
  margin-top: 0;
  min-width: 180px;
  padding: 0;
}

/* Mobile: slide open/close using max-height (no space taken when closed) */
@media (max-width: 991.98px) {
  #header-menu .dropdown-menu {
    display: block !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: #000;
    padding-left: 1rem;
  }
  #header-menu .dropdown-menu.show {
    max-height: 500px;
  }
}

/* Desktop: fade in/out, open on hover */
@media (min-width: 992px) {
  #header-menu .dropdown-menu {
    display: block !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
  }
  #header-menu .dropdown-menu.show,
  #header-menu .nav-item.dropdown:hover .dropdown-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
}

#header-menu .dropdown-item {
  color: #ffffff;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  padding: 10px 12px;
  text-decoration: none;
}

#header-menu .dropdown-item:hover,
#header-menu .dropdown-item:focus {
  background: rgb(70, 70, 70);
  color: #ffffff;
  text-decoration: none;
}

/* ==========================================================================
   User Info (navbar)
   ========================================================================== */

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--hax-text-muted);
}

.user-info .user-name {
  color: var(--hax-text);
  font-weight: 500;
}

.logout-link {
  color: var(--hax-text-muted);
  margin-left: 8px;
  padding: 4px;
  transition: color 0.15s;
}

.logout-link:hover {
  color: var(--hax-text);
}

/* ==========================================================================
   Calendar Grid
   ========================================================================== */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--hax-border);
  border: 1px solid var(--hax-border);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-header {
  background: var(--hax-bg-elevated);
  padding: 12px;
  text-align: center;
  font-weight: 600;
  color: var(--hax-text-muted);
  font-size: 0.875rem;
}

.calendar-day {
  background: var(--hax-bg-card);
  min-height: 120px;
  min-width: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.calendar-day.other-month {
  background: var(--hax-bg-darker);
  opacity: 0.5;
}

.calendar-day.today {
  background: var(--hax-bg-elevated);
}

.calendar-day.today .day-number {
  background: var(--hax-accent);
}

.day-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.day-number {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--hax-text);
  padding: 4px 8px;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px 4px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for day events */
.day-events::-webkit-scrollbar {
  width: 4px;
}

.day-events::-webkit-scrollbar-track {
  background: transparent;
}

.day-events::-webkit-scrollbar-thumb {
  background: var(--hax-border);
  border-radius: 2px;
}

.day-events::-webkit-scrollbar-thumb:hover {
  background: var(--hax-text-muted);
}

/* ==========================================================================
   Day Event Card (in calendar)
   ========================================================================== */

.day-event-card {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border-radius: 6px;
  background: var(--hax-bg-elevated);
  border: 1px solid var(--hax-border);
}

.day-event-card:hover {
  z-index: 10;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border-color: var(--hax-accent);
}

.day-event-card.sold-out {
  opacity: 0.6;
}

/* Cover image container */
.day-event-cover {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
}

.day-event-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.day-event-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--hax-accent) 0%, var(--hax-accent-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-event-placeholder i {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
}

/* Event title below image */
.day-event-title {
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 500;
  background: #000;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Event Hover Popup
   ========================================================================== */

.event-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--hax-bg-elevated);
  border: 1px solid var(--hax-border);
  border-radius: 8px;
  padding: 12px;
  min-width: 200px;
  max-width: 280px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.day-event:hover .event-popup {
  opacity: 1;
}

.event-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--hax-border);
}

.event-popup-image {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

.event-popup-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 4px;
  color: var(--hax-text);
}

.event-popup-meta {
  font-size: 0.75rem;
  color: var(--hax-text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-popup-meta i {
  margin-right: 4px;
}

.event-popup-spots {
  font-size: 0.75rem;
  margin-top: 4px;
}

.event-popup-spots.available {
  color: var(--hax-success);
}

.event-popup-spots.limited {
  color: var(--hax-warning);
}

.event-popup-spots.sold-out {
  color: var(--hax-danger);
}

/* ==========================================================================
   List View
   ========================================================================== */

body.list-view #monthNavigation {
  display: none !important;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.event-card {
  background: var(--hax-bg-card);
  border: 1px solid var(--hax-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.event-card:hover {
  border-color: var(--hax-accent);
  transform: translateY(-2px);
}

.event-card-inner {
  display: flex;
  gap: 16px;
}

.event-image {
  width: 200px;
  height: 150px;
  object-fit: cover;
  flex-shrink: 0;
}

.event-image-placeholder {
  width: 200px;
  height: 150px;
  background: var(--hax-bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.event-image-placeholder i {
  font-size: 3rem;
  color: var(--hax-text-muted);
}

.event-info {
  padding: 16px 16px 16px 0;
  flex: 1;
  min-width: 0;
}

.event-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--hax-text);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--hax-text-muted);
  margin-bottom: 12px;
}

.event-meta i {
  margin-right: 4px;
}

.event-spots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.event-spots.available {
  color: var(--hax-success);
}

.event-spots.limited {
  color: var(--hax-warning);
}

.event-spots.sold-out {
  color: var(--hax-danger);
}

/* ==========================================================================
   Date Group (List View)
   ========================================================================== */

.date-group {
  margin-bottom: 24px;
}

.date-group-header {
  background: var(--hax-bg-elevated);
  padding: 8px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}

.date-group-events {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   Ticket Components
   ========================================================================== */

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-item {
  background: var(--hax-bg-elevated);
  padding: 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-name {
  font-weight: 500;
}

.ticket-price {
  color: var(--hax-accent);
  font-weight: 600;
}

.ticket-spots {
  font-size: 0.875rem;
  color: var(--hax-text-muted);
}

/* ==========================================================================
   Modal Overrides
   ========================================================================== */

.modal-event-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h6 {
  color: var(--hax-text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .calendar-day {
    min-height: 80px;
  }

  .calendar-header {
    padding: 8px 4px;
    font-size: 0.75rem;
  }

  .day-number {
    font-size: 0.65rem;
    padding: 2px 4px;
  }

  .day-event-card {
    border-radius: 4px;
  }

  .day-event-cover {
    padding-bottom: 50%; /* Slightly shorter on mobile */
  }

  .day-event-placeholder i {
    font-size: 0.875rem;
  }

  .day-event-title {
    font-size: 0.6rem;
    padding: 2px 4px;
  }

  .event-popup {
    display: none;
  }

  .event-card-inner {
    flex-direction: column;
  }

  .event-image,
  .event-image-placeholder {
    width: 100%;
    height: 200px;
  }

  .event-info {
    padding: 16px;
  }
}
