import { StyleSheet } from 'react-native';
import { palette } from '@/constants/colors';

export const searchResultsTheme = {
  colors: {
    primaryDark: palette.navy,
    skyAccent: palette.skyLight,
    navyBg: palette.navyDark,
    lightBg: palette.slate50,
    cardLight: palette.white,
    cardDark: palette.cardDark,
    borderLight: palette.slate200,
    borderDark: palette.borderDark,
    tagAcBgLight: palette.greenLight,
    tagAcTextLight: palette.greenDark,
    tagVipBgLight: palette.purpleLight,
    tagVipTextLight: palette.purple,
    tagStandardBgLight: palette.slate100,
    tagStandardTextLight: palette.slate600,
    tagReliableBgLight: palette.skySoft,
    tagReliableTextLight: palette.skyBlue,
  },
};

export const searchResultsStyles = StyleSheet.create({
  container: {
    flex: 1,
  },
  fixedHeaderSection: {
    paddingHorizontal: 16,
    paddingTop: 8,
    paddingBottom: 10,
    borderBottomWidth: 1,
    zIndex: 10,
  },
  fixedHeaderLight: {
    backgroundColor: palette.white,
    borderBottomColor: palette.slate200,
  },
  fixedHeaderDark: {
    backgroundColor: palette.navyDark,
    borderBottomColor: palette.borderDark,
  },
  topHeaderRow: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    marginBottom: 8,
  },
  backButton: {
    width: 38,
    height: 38,
    borderRadius: 12,
    justifyContent: 'center',
    alignItems: 'center',
  },
  backButtonLight: {
    backgroundColor: palette.slate100,
    borderWidth: 1,
    borderColor: palette.slate200,
  },
  backButtonDark: {
    backgroundColor: palette.slate800,
    borderWidth: 1,
    borderColor: palette.borderDark,
  },
  headerCenterInfo: {
    flex: 1,
    marginHorizontal: 10,
  },
  routeTitleLight: {
    fontSize: 17,
    fontWeight: '900',
    color: palette.navy,
    letterSpacing: -0.3,
  },
  routeTitleDark: {
    fontSize: 17,
    fontWeight: '900',
    color: palette.slate50,
    letterSpacing: -0.3,
  },
  routeSubMetaLight: {
    fontSize: 12,
    fontWeight: '600',
    color: palette.slate500,
    marginTop: 2,
  },
  routeSubMetaDark: {
    fontSize: 12,
    fontWeight: '600',
    color: palette.slate400,
    marginTop: 2,
  },
  iconIconButton: {
    width: 38,
    height: 38,
    borderRadius: 12,
    justifyContent: 'center',
    alignItems: 'center',
  },
  iconIconButtonLight: {
    backgroundColor: palette.slate100,
    borderWidth: 1,
    borderColor: palette.slate200,
  },
  iconIconButtonDark: {
    backgroundColor: palette.slate800,
    borderWidth: 1,
    borderColor: palette.borderDark,
  },

  // Search input row
  searchBoxContainer: {
    flexDirection: 'row',
    alignItems: 'center',
    borderRadius: 12,
    borderWidth: 1,
    paddingHorizontal: 12,
    height: 40,
    marginBottom: 8,
  },
  searchBoxLight: {
    backgroundColor: palette.slate50,
    borderColor: palette.slate200,
  },
  searchBoxDark: {
    backgroundColor: palette.slate900,
    borderColor: palette.borderDark,
  },
  searchInput: {
    flex: 1,
    marginLeft: 8,
    fontSize: 13,
    fontWeight: '600',
  },
  searchInputLight: {
    color: palette.slate900,
  },
  searchInputDark: {
    color: palette.slate50,
  },

  // Agency chips horizontal scroller
  agencyChipsScroll: {
    paddingVertical: 2,
    marginBottom: 6,
  },
  agencyChip: {
    flexDirection: 'row',
    alignItems: 'center',
    paddingHorizontal: 12,
    paddingVertical: 6,
    borderRadius: 18,
    borderWidth: 1,
    marginRight: 8,
  },
  agencyChipActive: {
    backgroundColor: palette.skyBlue,
    borderColor: palette.skyBlue,
  },
  agencyChipInactiveLight: {
    backgroundColor: palette.slate100,
    borderColor: palette.slate200,
  },
  agencyChipInactiveDark: {
    backgroundColor: palette.slate900,
    borderColor: palette.borderDark,
  },
  agencyChipTextActive: {
    fontSize: 12,
    fontWeight: '800',
    color: palette.white,
  },
  agencyChipTextInactiveLight: {
    fontSize: 12,
    fontWeight: '700',
    color: palette.slate700,
  },
  agencyChipTextInactiveDark: {
    fontSize: 12,
    fontWeight: '700',
    color: palette.slate300,
  },
  agencyCountBadge: {
    marginLeft: 5,
    paddingHorizontal: 6,
    paddingVertical: 1,
    borderRadius: 10,
    backgroundColor: 'rgba(255, 255, 255, 0.25)',
  },
  agencyCountBadgeInactive: {
    backgroundColor: palette.slate200,
  },
  agencyCountBadgeInactiveDark: {
    backgroundColor: palette.slate800,
  },
  agencyCountText: {
    fontSize: 10,
    fontWeight: '800',
    color: palette.white,
  },
  agencyCountTextInactive: {
    fontSize: 10,
    fontWeight: '800',
    color: palette.slate600,
  },
  agencyCountTextInactiveDark: {
    fontSize: 10,
    fontWeight: '800',
    color: palette.slate400,
  },

  // Category filter row (All, VIP, Classic)
  filterRow: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    marginTop: 2,
  },
  categoryTabsContainer: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  filterPill: {
    paddingHorizontal: 14,
    paddingVertical: 5,
    borderRadius: 14,
    borderWidth: 1,
    marginRight: 6,
    justifyContent: 'center',
    alignItems: 'center',
  },
  filterPillActive: {
    backgroundColor: palette.skyBlue,
    borderColor: palette.skyBlue,
  },
  filterPillInactiveLight: {
    backgroundColor: palette.white,
    borderColor: palette.slate200,
  },
  filterPillInactiveDark: {
    backgroundColor: palette.slate900,
    borderColor: palette.borderDark,
  },
  filterTextActive: {
    color: palette.white,
    fontWeight: '800',
    fontSize: 12,
  },
  filterTextInactiveLight: {
    color: palette.slate600,
    fontWeight: '700',
    fontSize: 12,
  },
  filterTextInactiveDark: {
    color: palette.slate400,
    fontWeight: '700',
    fontSize: 12,
  },

  resultsCountTextLight: {
    fontSize: 12,
    fontWeight: '700',
    color: palette.slate500,
  },
  resultsCountTextDark: {
    fontSize: 12,
    fontWeight: '700',
    color: palette.slate400,
  },

  // Main scroll content
  scrollContent: {
    paddingHorizontal: 16,
    paddingTop: 12,
    paddingBottom: 40,
  },

  // Specific Agency Focused Header Banner (When agency is selected)
  agencyBannerCard: {
    borderRadius: 16,
    padding: 14,
    marginBottom: 14,
    borderWidth: 1,
    flexDirection: 'row',
    alignItems: 'center',
  },
  agencyBannerLight: {
    backgroundColor: palette.skySoft,
    borderColor: palette.skyLight,
  },
  agencyBannerDark: {
    backgroundColor: 'rgba(2, 132, 199, 0.15)',
    borderColor: palette.borderDark,
  },
  agencyBannerAvatar: {
    width: 44,
    height: 44,
    borderRadius: 12,
    marginRight: 12,
  },
  agencyBannerName: {
    fontSize: 16,
    fontWeight: '900',
    letterSpacing: -0.2,
  },
  agencyBannerMeta: {
    fontSize: 12,
    fontWeight: '600',
    marginTop: 2,
  },

  // Bus Card Styles
  busCard: {
    borderRadius: 18,
    padding: 14,
    marginBottom: 12,
    borderWidth: 1,
    shadowColor: '#000',
    shadowOffset: { width: 0, height: 2 },
    shadowOpacity: 0.06,
    shadowRadius: 6,
    elevation: 3,
  },
  busCardLight: {
    backgroundColor: palette.white,
    borderColor: palette.slate200,
  },
  busCardDark: {
    backgroundColor: palette.cardDark,
    borderColor: palette.borderDark,
  },
  busCardTopRow: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    marginBottom: 10,
  },
  busCardLeftHeader: {
    flexDirection: 'row',
    alignItems: 'center',
    flex: 1,
  },
  agencyAvatar: {
    width: 42,
    height: 42,
    borderRadius: 10,
    marginRight: 10,
    backgroundColor: palette.slate200,
  },
  agencyNameRow: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  agencyNameLight: {
    fontSize: 15,
    fontWeight: '800',
    color: palette.navy,
  },
  agencyNameDark: {
    fontSize: 15,
    fontWeight: '800',
    color: palette.slate50,
  },
  verifiedIcon: {
    marginLeft: 4,
  },
  ratingText: {
    fontSize: 11,
    fontWeight: '700',
    color: palette.amber,
    marginLeft: 3,
  },
  tagsRow: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  badgeTag: {
    paddingHorizontal: 7,
    paddingVertical: 3,
    borderRadius: 6,
    marginLeft: 4,
  },
  badgeTagText: {
    fontSize: 10,
    fontWeight: '800',
  },

  // Terminal & Stations Route Flow Section
  stationsFlowRow: {
    flexDirection: 'row',
    alignItems: 'center',
    paddingVertical: 10,
    paddingHorizontal: 8,
    borderRadius: 12,
    marginBottom: 10,
  },
  stationsFlowLight: {
    backgroundColor: palette.slate50,
  },
  stationsFlowDark: {
    backgroundColor: palette.slate900,
  },
  stationColumn: {
    flex: 1,
  },
  stationLabelLight: {
    fontSize: 10,
    fontWeight: '700',
    color: palette.slate500,
    textTransform: 'uppercase',
    letterSpacing: 0.5,
  },
  stationLabelDark: {
    fontSize: 10,
    fontWeight: '700',
    color: palette.slate400,
    textTransform: 'uppercase',
    letterSpacing: 0.5,
  },
  stationNameLight: {
    fontSize: 13,
    fontWeight: '800',
    color: palette.navy,
    marginTop: 1,
  },
  stationNameDark: {
    fontSize: 13,
    fontWeight: '800',
    color: palette.slate100,
    marginTop: 1,
  },
  routeFlowDivider: {
    alignItems: 'center',
    paddingHorizontal: 10,
  },
  durationPill: {
    paddingHorizontal: 6,
    paddingVertical: 2,
    borderRadius: 8,
    backgroundColor: palette.slate200,
    marginTop: 2,
  },
  durationPillDark: {
    backgroundColor: palette.slate800,
  },
  durationText: {
    fontSize: 10,
    fontWeight: '700',
  },

  // Bus Card Bottom Details Row
  busCardDetailsRow: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    paddingTop: 8,
    borderTopWidth: 1,
    borderTopColor: palette.slate100,
  },
  busCardDetailsRowDark: {
    borderTopColor: palette.slate800,
  },
  metaGroup: {
    flexDirection: 'row',
    alignItems: 'center',
    marginBottom: 4,
  },
  metaTextLight: {
    fontSize: 12,
    fontWeight: '700',
    color: palette.slate600,
    marginLeft: 4,
    marginRight: 10,
  },
  metaTextDark: {
    fontSize: 12,
    fontWeight: '700',
    color: palette.slate400,
    marginLeft: 4,
    marginRight: 10,
  },
  seatsLeftRow: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  seatsLeftTextLight: {
    fontSize: 11,
    fontWeight: '700',
    color: palette.slate700,
    marginLeft: 5,
  },
  seatsLeftTextDark: {
    fontSize: 11,
    fontWeight: '700',
    color: palette.slate300,
    marginLeft: 5,
  },
  urgentSeatsBadge: {
    color: palette.red,
    fontWeight: '800',
  },
  priceActionColumn: {
    alignItems: 'flex-end',
  },
  busPriceTextLight: {
    fontSize: 18,
    fontWeight: '900',
    color: palette.navy,
    marginBottom: 6,
  },
  busPriceTextDark: {
    fontSize: 18,
    fontWeight: '900',
    color: palette.skyLight,
    marginBottom: 6,
  },
  selectButton: {
    backgroundColor: palette.skyBlue,
    paddingHorizontal: 18,
    paddingVertical: 7,
    borderRadius: 10,
  },
  selectButtonText: {
    color: palette.white,
    fontWeight: '800',
    fontSize: 13,
  },

  // Empty state
  emptyContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    paddingVertical: 50,
  },
  emptyTitle: {
    fontSize: 17,
    fontWeight: '800',
    marginTop: 12,
  },
  emptySub: {
    fontSize: 13,
    fontWeight: '500',
    textAlign: 'center',
    marginTop: 6,
    paddingHorizontal: 30,
  },
  clearFiltersButton: {
    marginTop: 16,
    paddingHorizontal: 16,
    paddingVertical: 8,
    borderRadius: 10,
    backgroundColor: palette.skyBlue,
  },
  clearFiltersText: {
    color: palette.white,
    fontWeight: '800',
    fontSize: 13,
  },
});
