@use "../../../../styles/mixins.scss";

// Header section
.headerSection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;

  @include mixins.respond-below(md) {
    flex-direction: column;
    align-items: stretch;
    font-size: 0.7rem;
  }
}

.pageTitle {
  margin: 0;
  flex: 1;
}

.currencySelector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--mantine-color-gray-6);
  background: transparent;
  border: 1px solid var(--mantine-color-gray-3);
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;

  &:hover:not(:disabled) {
    background: var(--mantine-color-gray-0);
    border-color: var(--mantine-color-gray-4);
    color: var(--mantine-color-gray-7);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  @include mixins.respond-below(md) {
    margin-left: auto;
  }
}

.currencyText {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', monospace;
  letter-spacing: 0.02em;
}

.currencyIcon {
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.currencySelector:hover .currencyIcon {
  transform: translateY(1px);
}

.currencyOption {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0; // Allow flexbox shrinking
}

.currencyCode {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', monospace;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--mantine-color-gray-9);
  min-width: 45px;
  flex-shrink: 0;
}

.currencyLabel {
  font-size: 0.75rem;
  color: var(--mantine-color-gray-6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0; // Allow text truncation
}

.selectedCurrency {
  background: var(--mantine-color-secondary-0);

  .currencyCode {
    color: var(--mantine-color-secondary-5);
  }
}

.currencyDropdown {
  padding: 4px;
  max-height: 320px;
  overflow: hidden;
}

.currencyScrollArea {
  max-height: 312px;
  overflow-y: auto;
  overflow-x: hidden;
  
  // Custom scrollbar styling
  &::-webkit-scrollbar {
    width: 6px;
  }
  
  &::-webkit-scrollbar-track {
    background: transparent;
  }
  
  &::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    
    &:hover {
      background: rgba(0, 0, 0, 0.25);
    }
  }
  
  // Firefox scrollbar styling
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

// Statistics grid
.statisticsContainer {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 2rem;

  > * {
    flex: 1 1 300px;
    min-width: 0;
  }

  @include mixins.respond-below(sm) {
    gap: 1rem;

    > * {
      flex: 1 1 100%;
    }
  }
}

.statisticsSkeletonContainer {
  @extend .statisticsContainer;
}

// Recent items section
.recentItemsGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;

  @include mixins.respond-above(lg) {
    grid-template-columns: minmax(300px, 1fr) 2fr;
    gap: 1.5rem;
    align-items: stretch;
  }
}

.recentSection {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}

// Mobile-first ordering
.eventsSection {
  order: 1;
}

.ordersSection {
  order: 2;
}

@include mixins.respond-above(lg) {
  .eventsSection {
    order: 2;
  }

  .ordersSection {
    order: 1;
  }
}

.sectionTitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--mantine-color-gray-9);
  margin: 0;
  letter-spacing: -0.02em;
}

// Orders list
.ordersList {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
}

.orderCardLink {
  text-decoration: none;
  color: inherit;
  display: block;
}

.orderCard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  transition: all 0.15s ease;
  cursor: pointer;

  &:hover {
    border-color: var(--mantine-color-gray-4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    .orderArrow {
      transform: translateX(2px);
      color: var(--mantine-color-primary-filled);
    }

    .customerName {
      color: var(--mantine-color-primary-filled);
    }
  }

  &:active {
    transform: scale(0.995);
  }
}

.orderMain {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.orderAvatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--mantine-color-gray-1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--mantine-color-gray-5);
}

.orderDetails {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.orderCustomer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.customerName {
  font-size: 14px;
  font-weight: 600;
  color: var(--mantine-color-text);
  transition: color 0.15s ease;
  @include mixins.ellipsis;
}

.orderMeta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--mantine-color-dimmed);
}

.orderAmount {
  font-weight: 600;
  color: var(--mantine-color-green-7);
}

.orderSeparator {
  color: var(--mantine-color-gray-4);
}

.orderTime {
  color: var(--mantine-color-dimmed);
}

.orderId {
  font-size: 11px;
  color: var(--mantine-color-gray-5);
  font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', monospace;
  letter-spacing: 0.02em;
}

.orderArrow {
  flex-shrink: 0;
  color: var(--mantine-color-gray-4);
  transition: all 0.15s ease;
}

// Events list
.eventsList {
  display: flex;
  flex-direction: column;
  flex: 1;
}

// Empty states
.emptyState {
  background: linear-gradient(135deg, var(--mantine-color-primary-0) 0%, var(--mantine-color-secondary-0) 100%);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  border: 2px dashed var(--mantine-color-primary-2);
  position: relative;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  //flex: 1;

  &::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
      background: radial-gradient(circle, var(--mantine-color-secondary-0) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% {
      transform: scale(0.8);
      opacity: 0.5;
    }
    50% {
      transform: scale(1.2);
      opacity: 0.3;
    }
  }

  h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--mantine-color-gray-9);
    margin: 1rem 0 0.5rem;
    position: relative;
    z-index: 1;
  }

  p {
    font-size: 0.875rem;
    color: var(--mantine-color-gray-6);
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.5;
    position: relative;
    z-index: 1;
  }

  button {
    position: relative;
    z-index: 1;
  }
}

.emptyStateIcon {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));

  @keyframes float {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-10px);
    }
  }
}

// Skeleton loading
.skeletonStack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
