/* SparkleTour - Mobile-Friendly Map Controls */

/* ============================================
   MODERN LEAFLET CONTROL STYLING
   ============================================ */

/* Make top-left control container use flexbox for ordering */
.leaflet-top.leaflet-left {
  display: flex;
  flex-direction: column;
}

/* Hide redundant controls - they're now in the Options menu */
.leaflet-control-locate,
.filter-control {
  display: none !important;
}

/* Fix Leaflet zoom control order - ensure + is on top, - is on bottom */
.leaflet-control-zoom {
  display: flex;
  flex-direction: column;
}

.leaflet-control-zoom-in {
  order: 1;
  border-radius: 12px 12px 0 0 !important;
}

.leaflet-control-zoom-out {
  order: 2;
  border-radius: 0 0 12px 12px !important;
  border-top: 1px solid #ccc;
}

/* Override default Leaflet control sizes for mobile */
.leaflet-control-container .leaflet-bar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 12px;
}

/* Ensure Options button has rounded corners */
.leaflet-bar .options-button {
  border-radius: 12px !important;
}

.leaflet-control-container .leaflet-bar a {
  width: 48px;
  height: 48px;
  line-height: 48px;
  font-size: 20px;
  border: none;
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
}

.leaflet-control-container .leaflet-bar a:hover {
  background-color: #f0f0f0;
  transform: scale(1.05);
}

.leaflet-control-container .leaflet-bar a:active {
  background-color: #e0e0e0;
  transform: scale(0.98);
}

/* Control labels for better clarity */
.leaflet-control-label {
  font-size: 9px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
  line-height: 1;
  text-align: center;
}

/* Icon sizing */
.leaflet-bar a img {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto;
}

.leaflet-bar a .bi {
  font-size: 24px;
  line-height: 1;
}

/* Active state for toggleable controls */
.leaflet-bar a.active {
  background: #dc3545;
  color: white;
}

.leaflet-bar a.active .leaflet-control-label {
  color: white;
}

.leaflet-bar a.bestof-active {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #333;
}

.leaflet-bar a.bestof-active .bi {
  color: #333;
}

/* ============================================
   FILTER INDICATOR CONTROL
   ============================================ */

.filter-indicator-control {
  margin-top: 8px;
  animation: slideInDown 0.3s ease-out;
  order: 10; /* Ensure it appears after Options button */
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-indicator-button {
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  color: white !important;
  position: relative;
  border-radius: 12px !important;
}

.filter-indicator-button:hover {
  background: #c82333 !important;
  transform: scale(1.05);
}

.filter-indicator-button .bi {
  color: white;
}

.filter-count-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ffd700;
  color: #333;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

/* Pulse animation for filter indicator */
.filter-indicator-control {
  animation: slideInDown 0.3s ease-out, pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
  }
  50% {
    box-shadow: 0 2px 12px rgba(46, 125, 50, 0.6);
  }
}

/* ============================================
   ACTION SHEET BACKDROP
   ============================================ */

.action-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1999;
}

.action-sheet-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   BOTTOM ACTION SHEET
   ============================================ */

.map-action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-action-sheet.open {
  transform: translateY(0);
}

/* Action sheet handle */
.action-sheet-handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 12px auto 8px;
  cursor: grab;
}

.action-sheet-handle:active {
  cursor: grabbing;
}

/* Action sheet header */
.action-sheet-header {
  padding: 0 20px 12px;
  border-bottom: 1px solid #e0e0e0;
}

.action-sheet-title {
  font-size: 18px;
  font-weight: 700;
  color: #000000;
  margin: 0;
}

/* Action sheet content */
.action-sheet-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Action buttons grid */
.action-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.action-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #333;
  min-height: 100px;
}

.action-button:hover {
  border-color: #2e7d32;
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
}

.action-button:active {
  transform: translateY(0);
}

.action-button.active {
  background: #dc3545;
  color: white;
}

.action-button-icon {
  font-size: 32px;
  margin-bottom: 8px;
  color: #2e7d32;
}

/* Mix of green and red icon colors for variety */
.action-button[data-action="community"] .action-button-icon {
  color: #c41e3a; /* Red */
}

.action-button[data-action="list"] .action-button-icon {
  color: #2e7d32; /* Green */
}

.action-button[data-action="print"] .action-button-icon {
  color: #c41e3a; /* Red */
}

.action-button[data-action="bestof"] .action-button-icon {
  color: #ffd700; /* Gold */
}

.action-button[data-action="locate"] .action-button-icon {
  color: #2e7d32; /* Green */
}

.action-button[data-action="filters"] .action-button-icon {
  color: #c41e3a; /* Red */
}

.action-button[data-action="submit"] .action-button-icon {
  color: #2e7d32; /* Green */
}

.action-button.active .action-button-icon {
  color: white;
}

.action-button-label {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.action-button-description {
  font-size: 11px;
  color: #666;
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
}

.action-button.active .action-button-description {
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   FLOATING ACTION MENU (Speed Dial)
   ============================================ */

.fab-menu {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1500;
}

.fab-menu-items {
  position: absolute;
  bottom: 80px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-menu.open .fab-menu-items {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.fab-menu-label {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.2s ease;
}

.fab-menu.open .fab-menu-label {
  opacity: 1;
  transform: translateX(0);
}

.fab-mini {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: white;
  color: #2e7d32;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fab-mini:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.fab-mini:active {
  transform: scale(1.05);
}

.fab-main {
  transition: all 0.3s ease;
}

.fab-menu.open .fab-main {
  transform: rotate(45deg);
  background: linear-gradient(135deg, #c41e3a, #a01729);
}

/* ============================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .leaflet-control-container .leaflet-bar a {
    width: 44px;
    height: 44px;
    line-height: 44px;
  }
  
  .leaflet-control-label {
    font-size: 8px;
  }
  
  .action-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .fab-menu {
    bottom: 1.5rem;
    right: 1.5rem;
}

/* ============================================
   ADDRESS LIST FLYUP SHEET
   ============================================ */

.address-list-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.address-list-sheet.open {
  transform: translateY(0);
}

/* Sheet close button in header */
.address-list-sheet .sheet-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s ease;
}

.address-list-sheet .sheet-close-btn:hover {
  color: #c41e3a;
}

/* Address list content area */
.address-list-content {
  overflow-y: auto;
  flex: 1;
  padding: 0;
}

.address-list-info {
  padding: 0 0 12px 0;
  border-bottom: 1px solid #e0e0e0;
}

/* Style the list items from leaflet-list-markers */
.address-list-content .list-markers-ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.address-list-content .list-markers-li {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
  font-size: 14px;
  line-height: 1.5;
}

.address-list-content .list-markers-li:hover {
  background: #f8f9fa;
}

.address-list-content .list-markers-li:last-child {
  border-bottom: none;
}

/* Footer buttons */
.address-list-sheet .action-sheet-footer {
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  background: #f8f9fa;
}

.address-list-sheet .btn {
  flex: 1;
  background: white !important;
  border: 2px solid;
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s ease;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.address-list-sheet .btn-close-sheet {
  color: var(--christmas-red);
  border-color: var(--christmas-red);
}

.address-list-sheet .btn-close-sheet:hover {
  background: var(--christmas-red) !important;
  color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.address-list-sheet .btn-print {
  color: var(--christmas-green);
  border-color: var(--christmas-green);
}

.address-list-sheet .btn-print:hover {
  background: var(--christmas-green) !important;
  color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .address-list-sheet {
    left: 50%;
    transform: translate(-50%, 100%);
    max-width: 600px;
    border-radius: 20px 20px 0 0;
  }
  
  .address-list-sheet.open {
    transform: translate(-50%, 0);
  }
}

@media (max-width: 576px) {
  .address-list-sheet .action-sheet-footer {
    flex-direction: column;
    gap: 8px;
  }
  
  .address-list-sheet .btn {
    width: 100%;
  }
  }

/* ============================================
   FILTERS FLYUP ACTION SHEET
   ============================================ */

/* Filters backdrop */
.filters-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filters-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* Filters sheet */
.filters-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 2000;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Filters sheet header */
.filters-sheet .action-sheet-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.filters-sheet .action-sheet-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--christmas-red);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Filters sheet content */
.filters-sheet .action-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Section headers */
.filters-sheet .filter-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--christmas-green);
  margin-bottom: 12px;
  display: block;
}

/* Quick filters container */
.filters-sheet .quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* Filter chips */
.filters-sheet .filter-chip {
  background: white;
  border: 2px solid #dee2e6;
  color: #212529;
  font-weight: 600;
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filters-sheet .filter-chip:hover {
  background: #f8f9fa;
  border-color: var(--christmas-red);
  transform: translateY(-2px);
}

.filters-sheet .filter-chip.active {
  background: var(--christmas-red);
  color: white;
  border-color: var(--christmas-red);
}

/* Feature filters grid */
.filters-sheet .feature-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.filters-sheet .feature-chip-wrapper {
  display: block;
}

.filters-sheet .feature-chip-label {
  cursor: pointer;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  background: white;
  border: 2px solid #dee2e6;
  color: #212529;
  font-weight: normal;
  min-height: 44px;
}

.filters-sheet .feature-chip-label:hover {
  background: #f8f9fa;
  border-color: var(--christmas-red);
  transform: translateY(-1px);
}

.filters-sheet .feature-chip-label.active {
  background: var(--christmas-red);
  color: white;
  border-color: var(--christmas-red);
}

.filters-sheet .feature-chip-label input[type="checkbox"] {
  display: none;
}

/* Active filters count */
.filters-sheet .active-filters-alert {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0c5460;
}

.filters-sheet .active-filters-alert.hidden {
  display: none;
}

/* Filters sheet footer */
.filters-sheet .action-sheet-footer {
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.filters-sheet .btn {
  background: white !important;
  border: 2px solid !important;
  font-weight: 600 !important;
  border-radius: 50px !important;
  transition: all 0.3s ease !important;
  padding: 12px 24px !important;
  font-size: 0.95rem !important;
  flex: 1;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
}

.filters-sheet .btn-clear {
  color: var(--christmas-red) !important;
  border-color: var(--christmas-red) !important;
}

.filters-sheet .btn-clear:hover {
  background: var(--christmas-red) !important;
  color: white !important;
  transform: translateY(-2px) !important;
}

.filters-sheet .btn-apply {
  color: var(--christmas-green) !important;
  border-color: var(--christmas-green) !important;
}

.filters-sheet .btn-apply:hover {
  background: var(--christmas-green) !important;
  color: white !important;
  transform: translateY(-2px) !important;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .filters-sheet {
    left: 50%;
    transform: translate(-50%, 100%);
    max-width: 600px;
    border-radius: 20px 20px 0 0;
  }
  
  .filters-sheet.open {
    transform: translate(-50%, 0);
  }
  
  .filters-sheet .feature-filters-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 576px) {
  .filters-sheet .action-sheet-footer {
    flex-direction: column;
    gap: 8px;
  }
  
  .filters-sheet .btn {
    width: 100%;
  }
  
  .filters-sheet .feature-filters-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
}

@media (max-width: 576px) {
  .leaflet-control-container .leaflet-bar a {
    width: 42px;
    height: 42px;
    line-height: 42px;
  }
  
  .leaflet-bar a .bi {
    font-size: 20px;
  }
  
  .leaflet-bar a img {
    width: 20px;
    height: 20px;
  }
  
  .action-sheet-content {
    padding: 16px;
  }
  
  .action-buttons-grid {
    gap: 10px;
  }
  
  .action-button {
    padding: 12px;
    min-height: 90px;
  }
  
  .action-button-icon {
    font-size: 28px;
  }
  
  .action-button-label {
    font-size: 12px;
  }
  
  .fab-menu {
    bottom: 1rem;
    right: 1rem;
  }
  
  
  .fab-mini {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  /* Action sheets - reduce height for landscape */
  .map-action-sheet {
    max-height: 75vh;
  }
  
  /* FAB menu positioning */
  .fab-menu {
    bottom: 0.5rem;
    right: 0.5rem;
  }
  
  
  /* Compact FAB mini buttons */
  .fab-mini {
    width: 40px;
    height: 40px;
  }
  
  .fab-mini i {
    font-size: 1rem;
  }
  
  /* Adjust control positioning for landscape */
  .filter-indicator-control {
    margin-top: 4px;
  }
  
  .filter-indicator-button {
    width: 44px;
    height: 44px;
  }
  
  .filter-indicator-button .bi {
    font-size: 1.125rem;
  }
  
  .filter-count-badge {
    width: 18px;
    height: 18px;
    font-size: 10px;
    top: -6px;
    right: -6px;
  }
  
  /* Leaflet controls positioning - keep below logo and overlay controls */
  .leaflet-top.leaflet-left {
    top: 4rem;
  }
  
  .leaflet-top.leaflet-right {
    top: 4rem;
  }
  
  /* Compact leaflet control buttons */
  .leaflet-bar a {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 18px;
  }
  
  /* Action buttons in landscape */
  .action-button {
    width: 44px;
    height: 44px;
  }
  
  .action-button-icon {
    font-size: 20px;
  }
  
  .action-button-label {
    font-size: 10px;
  }
  
  /* Compact action sheet content */
  .action-sheet-content {
    padding: 12px 16px;
  }
  
  .action-sheet-header {
    padding: 12px 16px;
  }
  
  .action-sheet-footer {
    padding: 12px 16px;
  }
  
  /* List items in action sheets */
  .action-sheet-list-item {
    padding: 10px 12px;
  }
  
  .action-sheet-list-item-title {
    font-size: 0.9375rem;
  }
  
  .action-sheet-list-item-subtitle {
    font-size: 0.8125rem;
  }
}

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

/* Focus states */
.leaflet-bar a:focus,
.action-button:focus,
.fab:focus,
.fab-mini:focus {
  outline: 3px solid #2e7d32;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .leaflet-bar a,
  .action-button,
  .fab,
  .fab-mini,
  .map-action-sheet,
  .fab-menu-items,
  .fab-menu-label {
    transition: none;
  }
  
  .leaflet-bar a:hover,
  .action-button:hover,
  .fab-mini:hover {
    transform: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .leaflet-bar a,
  .action-button,
  .fab,
  .fab-mini {
    border: 2px solid currentColor;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */

.action-button.loading {
  pointer-events: none;
  opacity: 0.6;
}

.action-button.loading .action-button-icon::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid #2e7d32;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   BACKDROP FOR ACTION SHEET
   ============================================ */

.action-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1999;
}

.action-sheet-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}