/**
 * Climax Berlin - Table Map CSS
 * Styling for interactive table selection map with details panel
 * @version 2.0.0
 * @author Marco Nötzold (Hagalaz Design)
 */

/* ============================================================================
   FLOOR PLAN LAYOUT
   ============================================================================ */

/**
 * Two-column layout: map on left, details panel on right (desktop)
 * Stacked layout: map then panel (mobile)
 */
.floor-plan-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
  /* Positioning context for desktop-absolute zoom controls */
  position: relative;
}

@media (min-width: 1024px) {
  .floor-plan-layout {
    grid-template-columns: 1fr 350px;
    gap: 2rem;
  }
}

.floor-plan-map-section {
  min-width: 0;
}

/* ============================================================================
   DETAILS PANEL
   ============================================================================ */

.floor-plan-details-panel {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 0.75rem;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 400px;
}

.panel-header {
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
  padding-bottom: 1rem;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.panel-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel-default-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  height: 100%;
  padding: 2rem 1rem;
}

.panel-icon {
  opacity: 0.4;
}

.panel-selected-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-content-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.panel-media {
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.panel-image,
.panel-video {
  width: 100%;
  height: auto;
  display: block;
  max-height: 200px;
  object-fit: cover;
}

.panel-description {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.panel-reserve-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  border: none;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  width: 100%;
}

.panel-reserve-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.4);
}

.panel-reserve-btn:active {
  transform: translateY(0);
}

/* ============================================================================
   IMAGE MAP WRAPPER
   ============================================================================ */

.table-map-controls {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 1rem;
}

.table-map-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
}

.table-map-container {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: grab;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  border-radius: 0.375rem;
  overflow: hidden;
}

.table-map-container.dragging {
  cursor: grabbing;
}

.table-map-container img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* ============================================================================
   ZOOM CONTROLS
   ============================================================================ */

.zoom-controls {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  backdrop-filter: blur(10px);
}

.zoom-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 0.375rem;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.zoom-btn:hover {
  background: rgba(168, 85, 247, 0.4);
  border-color: rgba(168, 85, 247, 0.6);
  transform: scale(1.05);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.zoom-level {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.25rem 0.5rem;
  user-select: none;
}

/* ============================================================================
   TABLE LEGEND
   ============================================================================ */

.table-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  border: 1px solid rgba(168, 85, 247, 0.15);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.375rem;
  border: 1px solid rgba(168, 85, 247, 0.2);
  transition: all 0.3s ease;
}

.legend-item:hover {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.4);
  transform: translateY(-2px);
}

.legend-color {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.legend-color.standard {
  background: #3b82f6;
}

.legend-color.pool {
  background: #06b6d4;
}

.legend-color.vip {
  background: #a855f7;
}

.legend-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

/* ============================================================================
   HELPER TEXT
   ============================================================================ */

.table-map-help {
  text-align: center;
  font-size: 0.875rem;
  color: rgba(168, 85, 247, 0.8);
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(168, 85, 247, 0.05);
  border-radius: 0.375rem;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.table-map-help i {
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet */
@media (max-width: 768px) {
  .floor-plan-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .floor-plan-details-panel {
    min-height: 300px;
  }

  .table-legend {
    gap: 1rem;
    padding: 1rem;
  }

  .legend-item {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }

  .zoom-controls {
    padding: 0.5rem 0.75rem;
  }

  .zoom-btn {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .floor-plan-details-panel {
    padding: 1rem;
    min-height: 250px;
  }

  .panel-title {
    font-size: 1.125rem;
  }

  .panel-content-title {
    font-size: 1rem;
  }

  .panel-reserve-btn {
    font-size: 0.9375rem;
    padding: 0.75rem 1.25rem;
  }

  .table-legend {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .legend-item {
    width: 100%;
    justify-content: center;
  }

  .table-map-help {
    font-size: 0.8125rem;
  }

  .zoom-controls {
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .zoom-btn {
    width: 48px;
    height: 48px;
    font-size: 1.375rem;
  }

  .zoom-level {
    font-size: 0.75rem;
  }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus styles for keyboard navigation */
.table-map-wrapper:focus-within {
  outline: 2px solid #a855f7;
  outline-offset: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .legend-item {
    border-color: #a855f7;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .legend-item:hover {
    transform: none;
  }

  .table-map-wrapper::after {
    transition: none;
  }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Touch-friendly interaction */
@media (hover: none) and (pointer: coarse) {
  .legend-item {
    padding: 0.75rem 1rem;
  }

  .table-map-wrapper img {
    -webkit-tap-highlight-color: rgba(168, 85, 247, 0.3);
  }
}

/* ============================================================================
   FLOOR PLAN TOOLTIP
   ============================================================================ */

/**
 * Minimal tooltip for quick hints on hover
 * Positioned absolutely relative to viewport
 */
.floor-plan-tooltip {
  --tooltip-bg: color-mix(
    in oklab,
    var(--color-primary, #a855f7) 10%,
    transparent
  );
  --tooltip-border: color-mix(
    in oklab,
    var(--color-primary) 35%,
    rgba(255, 255, 255, 0.08)
  );
  position: absolute;
  z-index: 10000;
  background: var(--tooltip-bg, rgba(2, 6, 18, 0.94));
  border: 1px solid var(--tooltip-border);
  color: #ffffff;
  padding: 0.625rem 0.875rem;
  border-radius: 0.375rem;
  box-shadow: var(
      --tooltip-shadow,
      0 8px 20px rgba(0, 0, 0, 0.35),
      0 0 0 1px rgba(255, 255, 255, 0.04)
    );
  font-size: 0.8125rem;
  max-width: 200px;
  pointer-events: none;
  backdrop-filter: blur(10px);
  animation: tooltip-fade-in 0.2s ease-out;
}

/* Tooltip arrow pointing down */
.floor-plan-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--tooltip-bg, rgba(2, 6, 18, 0.94));
}

/* Tooltip text content */
.floor-plan-tooltip .tooltip-text {
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  margin-bottom: 0.25rem;
}

/* Tooltip hint for clickable areas */
.floor-plan-tooltip .tooltip-hint {
  font-size: 0.6875rem;
  color: rgba(168, 85, 247, 0.9);
  text-align: center;
  font-style: italic;
}

/* Tooltip fade-in animation */
@keyframes tooltip-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================================
   MAP AREA STYLES
   ============================================================================ */

/**
 * Focus styles for keyboard navigation of map areas
 */
map[name="climax-berlin-map"] area:focus {
  outline: 2px solid #a855f7;
  outline-offset: 2px;
}

/* Info-only areas get a different cursor */
map[name="climax-berlin-map"] area.map-info {
  cursor: help;
}

/* Table areas get pointer cursor */
map[name="climax-berlin-map"] area:not(.map-info) {
  cursor: pointer;
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/* High contrast mode support for tooltips */
@media (prefers-contrast: high) {
  .floor-plan-tooltip {
    border-color: #a855f7;
    border-width: 2px;
    background: rgba(0, 0, 0, 1);
  }

  .floor-plan-tooltip .tooltip-text {
    font-weight: 600;
  }
}

/* Reduced motion support for tooltips */
@media (prefers-reduced-motion: reduce) {
  .floor-plan-tooltip {
    animation: none;
  }
}

/* ============================================================================
   RESPONSIVE TOOLTIP
   ============================================================================ */

/* Tablet and mobile adjustments */
@media (max-width: 768px) {
  .floor-plan-tooltip {
    max-width: 180px;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .floor-plan-tooltip .tooltip-hint {
    font-size: 0.625rem;
  }
}

@media (max-width: 640px) {
  .floor-plan-tooltip {
    max-width: 160px;
    font-size: 0.6875rem;
    padding: 0.5rem 0.625rem;
  }

  .floor-plan-tooltip .tooltip-hint {
    font-size: 0.5625rem;
  }
}
