/* ============================================================
   NOWTIVA - Apple Components CSS
   Carousel, Shop Cards, Search, and Interactive Components
   ============================================================ */

/* ============================================
   CAROUSEL
   ============================================ */
.apple-carousel-wrapper {
  position: relative;
  width: 100%;
  padding: 0 16px;
}

.apple-carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 16px 0 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.apple-carousel-track::-webkit-scrollbar {
  display: none;
}

.apple-carousel-track > * {
  scroll-snap-align: center;
  flex-shrink: 0;
}

.apple-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-thick, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid var(--glass-border-light, rgba(255, 255, 255, 0.45));
  border-radius: 50%;
  font-size: 24px;
  font-weight: 300;
  color: var(--apple-label, #000);
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 10;
}

.apple-carousel-nav:hover {
  background: var(--glass-chrome, rgba(255, 255, 255, 0.92));
  transform: translateY(-50%) scale(1.05);
  box-shadow: var(--shadow-lg, 0 16px 48px rgba(0, 0, 0, 0.16));
}

.apple-carousel-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.apple-carousel-nav.prev {
  left: 8px;
}

.apple-carousel-nav.next {
  right: 8px;
}

.apple-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
}

.apple-carousel-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-fill-tertiary, rgba(120, 120, 128, 0.12));
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.apple-carousel-dots .dot:hover {
  background: var(--apple-fill-secondary, rgba(120, 120, 128, 0.16));
  transform: scale(1.2);
}

.apple-carousel-dots .dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--apple-blue, #007AFF);
}

/* ============================================
   SHOP CARD (Enhanced)
   ============================================ */
.apple-shop-card {
  width: 320px;
  min-width: 320px;
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  .apple-shop-card {
    background: #1C1C1E;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  }
}

.apple-shop-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-xl, 0 24px 64px rgba(0, 0, 0, 0.20));
}

.apple-shop-card-image-wrapper {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
}

.apple-shop-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.apple-shop-card:hover .apple-shop-card-image {
  transform: scale(1.05);
}

.apple-shop-card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--apple-blue, #007AFF) 0%, var(--apple-blue-light, #5AC8FA) 100%);
  font-size: 48px;
}

.apple-shop-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  background: var(--glass-thick, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--apple-label, #000);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.apple-shop-card-content {
  padding: 16px;
}

.apple-shop-card-name {
  font-family: var(--apple-font-display, -apple-system, BlinkMacSystemFont, system-ui, sans-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--apple-label, #000);
  margin: 0 0 8px;
  line-height: 1.3;
}

.apple-shop-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.apple-shop-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}

.apple-shop-card-rating .stars {
  color: #FF9500;
  font-size: 14px;
  letter-spacing: -1px;
}

.apple-shop-card-rating .rating-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--apple-label, #000);
}

.apple-shop-card-distance {
  font-size: 13px;
  color: var(--apple-label-secondary, rgba(0, 0, 0, 0.55));
}

.apple-shop-card-hours {
  font-size: 13px;
  color: var(--apple-label-secondary, rgba(0, 0, 0, 0.55));
  margin: 0 0 8px;
}

.apple-shop-card-route {
  min-height: 24px;
}

.apple-shop-card-route .route-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(0, 122, 255, 0.12);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--apple-blue, #007AFF);
}

.apple-shop-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 0.5px solid var(--glass-border-separator, rgba(255, 255, 255, 0.25));
  background: var(--glass-ultra-thin, rgba(255, 255, 255, 0.35));
}

.apple-shop-card-actions .apple-button {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
}

/* ============================================
   SEARCH BAR
   ============================================ */
.apple-search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--glass-regular, rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(50px) saturate(200%);
  -webkit-backdrop-filter: blur(50px) saturate(200%);
  border: 0.5px solid var(--glass-border-light, rgba(255, 255, 255, 0.45));
  border-radius: 16px;
  transition: all 0.2s ease;
}

.apple-search-wrapper.focused {
  border-color: var(--apple-blue, #007AFF);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.apple-search-input {
  flex: 1;
  padding: 10px 12px;
  font-family: var(--apple-font-text, -apple-system, BlinkMacSystemFont, system-ui, sans-serif);
  font-size: 16px;
  color: var(--apple-label, #000);
  background: transparent;
  border: none;
  outline: none;
}

.apple-search-input::placeholder {
  color: var(--apple-label-tertiary, rgba(0, 0, 0, 0.35));
}

.apple-button-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apple-button-icon.loading {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   CATEGORY FILTER
   ============================================ */
.apple-filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.apple-filter-scroll::-webkit-scrollbar {
  display: none;
}

.apple-filter-scroll .apple-chip {
  scroll-snap-align: start;
  white-space: nowrap;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.apple-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.apple-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.apple-empty-state .apple-title3 {
  margin-bottom: 8px;
  color: var(--apple-label, #000);
}

.apple-empty-state .apple-subheadline {
  color: var(--apple-label-secondary, rgba(0, 0, 0, 0.55));
  max-width: 280px;
}

/* ============================================
   MAP OVERLAY (Bottom Panel)
   ============================================ */
.apple-bottom-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--glass-chrome, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(80px) saturate(220%);
  -webkit-backdrop-filter: blur(80px) saturate(220%);
  border-top: 0.5px solid var(--glass-border-light, rgba(255, 255, 255, 0.45));
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  z-index: 100;
  max-height: 60vh;
  overflow: hidden;
}

.apple-bottom-panel-handle {
  width: 36px;
  height: 5px;
  background: var(--apple-fill-tertiary, rgba(120, 120, 128, 0.12));
  border-radius: 3px;
  margin: 8px auto 0;
}

/* ============================================
   TOP BAR
   ============================================ */
.apple-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--glass-thin, rgba(255, 255, 255, 0.55));
  backdrop-filter: blur(50px) saturate(200%);
  -webkit-backdrop-filter: blur(50px) saturate(200%);
  border-bottom: 0.5px solid var(--glass-border-separator, rgba(255, 255, 255, 0.25));
}

.apple-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.apple-logo-image {
  height: 36px;
  width: auto;
  filter: none;
  transition: transform 0.2s ease;
}

.apple-logo:hover .apple-logo-image {
  transform: scale(1.05);
}

.apple-logo-text {
  font-family: var(--apple-font-display, -apple-system, BlinkMacSystemFont, system-ui, sans-serif);
  font-size: 18px;
  font-weight: 800;
  color: var(--apple-blue, #007AFF);
  letter-spacing: 1.2px;
}

/* ============================================
   LOADING STATE
   ============================================ */
body.loading .apple-bottom-panel {
  opacity: 0;
  transform: translateY(100%);
}

body.loading .apple-top-bar {
  opacity: 0;
  transform: translateY(-100%);
}

body:not(.loading) .apple-bottom-panel {
  animation: slide-up 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

body:not(.loading) .apple-top-bar {
  animation: slide-down 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   ERROR TOAST
   ============================================ */
.apple-error-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--apple-red, #FF3B30);
  color: white;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  animation: toast-in 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .apple-shop-card {
    width: 280px;
    min-width: 280px;
  }

  .apple-carousel-nav {
    display: none;
  }

  .apple-shop-card-image-wrapper {
    height: 140px;
  }
}

@media (min-width: 1024px) {
  .apple-shop-card {
    width: 360px;
    min-width: 360px;
  }

  .apple-shop-card-image-wrapper {
    height: 180px;
  }
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
@media (prefers-color-scheme: dark) {
  .apple-shop-card {
    background: rgba(40, 40, 40, 0.75);
  }

  .apple-shop-card-badge {
    background: rgba(50, 50, 50, 0.85);
  }

  .apple-shop-card-actions {
    background: rgba(30, 30, 30, 0.5);
  }

  .apple-search-wrapper {
    background: rgba(40, 40, 40, 0.75);
  }

  .apple-bottom-panel {
    background: rgba(28, 28, 30, 0.95);
  }

  .apple-top-bar {
    background: rgba(28, 28, 30, 0.85);
  }

  .apple-carousel-nav {
    background: rgba(50, 50, 50, 0.85);
    color: white;
  }

  .apple-shop-card-image-placeholder {
    background: linear-gradient(135deg, #0A84FF 0%, #64D2FF 100%);
  }
}

/* ============================================
   FOOTER
   ============================================ */
.apple-footer {
  background: linear-gradient(180deg, #0E2A5E 0%, #173A7A 100%);
  padding: 24px 16px 20px;
  margin-top: 16px;
  border-radius: 20px 20px 0 0;
}

.apple-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .apple-footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.apple-footer-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.apple-footer-title {
  font-size: 12px;
  font-weight: 700;
  color: white;
  margin: 0 0 8px;
  letter-spacing: 0.2px;
}

.apple-footer-link {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1.5;
}

.apple-footer-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.apple-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.apple-footer-copyright {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
}

.apple-footer-social {
  display: flex;
  gap: 8px;
}

.apple-social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.apple-social-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: scale(1.1);
}

.apple-social-icon svg {
  width: 16px;
  height: 16px;
}
