import { useTheme } from '@tamagui/core';

export const ADMIN_COLORS = {
  primary: '#FF5A5F',
  primaryStrong: '#C2413B',
  accent: '#FFB6C1',
  accentSoft: '#FFE5EC',
  accentWarm: '#FFD6DE',
  warning: '#F5C542',
  success: '#06D6A0',
  danger: '#B91C1C',
  text: '#1F2937',
  textMuted: '#6B7280',
  textSubtle: '#94A3B8',
  border: '#F2E4DA',
  surface: '#FFFFFF',
  surfaceMuted: '#FFFDFB',
  backdrop: '#0F172A',
};

export const ADMIN_ACTION_COLORS = {
  tasks: '#FF8A8E',
  qr: ADMIN_COLORS.warning,
  images: ADMIN_COLORS.accent,
  guests: ADMIN_COLORS.success,
  guestMessages: ADMIN_COLORS.primary,
  invites: ADMIN_COLORS.primaryStrong,
  branding: ADMIN_COLORS.accent,
  photobooth: '#FF8A8E',
  recap: ADMIN_COLORS.warning,
  packages: ADMIN_COLORS.primary,
  analytics: '#8b5cf6',
  settings: ADMIN_COLORS.success,
};

export const ADMIN_GRADIENTS = {
  primaryCta: `linear-gradient(135deg, ${ADMIN_COLORS.primary}, #FF8A8E, ${ADMIN_COLORS.accent})`,
  softCard: `linear-gradient(135deg, ${ADMIN_COLORS.accentSoft}, ${ADMIN_COLORS.accentWarm})`,
  loginBackground: 'linear-gradient(135deg, #0b1020, #0f172a, #0b1020)',
};

export const ADMIN_MOTION = {
  tileStaggerMs: 40,
};

export function useAdminTheme() {
  const theme = useTheme();

  return {
    theme,
    background: String(theme.background?.val ?? '#FFF8F5'),
    surface: String(theme.surface?.val ?? ADMIN_COLORS.surface),
    surfaceMuted: String(theme.gray2?.val ?? ADMIN_COLORS.surfaceMuted),
    border: String(theme.borderColor?.val ?? ADMIN_COLORS.border),
    text: String(theme.color?.val ?? ADMIN_COLORS.text),
    textStrong: String(theme.color12?.val ?? theme.color?.val ?? ADMIN_COLORS.text),
    muted: String(theme.gray?.val ?? ADMIN_COLORS.textMuted),
    subtle: String(theme.gray8?.val ?? ADMIN_COLORS.textSubtle),
    primary: String(theme.primary?.val ?? ADMIN_COLORS.primary),
    accent: String(theme.blue6?.val ?? theme.accent?.val ?? ADMIN_COLORS.accent),
    accentSoft: String(theme.blue3?.val ?? ADMIN_COLORS.accentSoft),
    accentStrong: String(theme.blue10?.val ?? ADMIN_COLORS.primaryStrong),
    successBg: String(theme.green3?.val ?? '#DCFCE7'),
    successText: String(theme.green10?.val ?? '#166534'),
    dangerBg: String(theme.red3?.val ?? '#FEE2E2'),
    dangerText: String(theme.red11?.val ?? ADMIN_COLORS.danger),
    warningBg: String(theme.yellow3?.val ?? '#FFF7ED'),
    warningBorder: String(theme.yellow6?.val ?? '#FED7AA'),
    warningText: String(theme.yellow11?.val ?? '#92400E'),
    infoBg: String(theme.blue3?.val ?? ADMIN_COLORS.accentSoft),
    infoText: String(theme.blue10?.val ?? ADMIN_COLORS.primaryStrong),
    danger: String(theme.red10?.val ?? ADMIN_COLORS.danger),
    backdrop: String(theme.gray12?.val ?? ADMIN_COLORS.backdrop),
    overlay: String(theme.gray12?.val ?? 'rgba(15, 23, 42, 0.6)'),
    shadow: String(theme.shadowColor?.val ?? 'rgba(31, 41, 55, 0.12)'),
  };
}
