@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap');
@import 'tailwindcss';

@plugin 'tailwindcss-animate';

/* Tailwind v4 Theme Configuration */
@theme {
  /* Fonts */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Bebas Neue', 'Inter', sans-serif;

  /* Border Radius */
  --radius: 0.5rem;
  --radius-lg: 0.5rem;
  --radius-md: calc(0.5rem - 2px);
  --radius-sm: calc(0.5rem - 4px);

  /* Couleurs - référençant les CSS variables définies dans :root et .dark */
  --color-background: hsl(var(--background));
  --color-foreground: hsl(var(--foreground));
  --color-card: hsl(var(--card));
  --color-card-foreground: hsl(var(--card-foreground));
  --color-popover: hsl(var(--popover));
  --color-popover-foreground: hsl(var(--popover-foreground));
  --color-primary: hsl(var(--primary));
  --color-primary-foreground: hsl(var(--primary-foreground));
  --color-secondary: hsl(var(--secondary));
  --color-secondary-foreground: hsl(var(--secondary-foreground));
  --color-muted: hsl(var(--muted));
  --color-muted-foreground: hsl(var(--muted-foreground));
  --color-accent: hsl(var(--accent));
  --color-accent-foreground: hsl(var(--accent-foreground));
  --color-destructive: hsl(var(--destructive));
  --color-destructive-foreground: hsl(var(--destructive-foreground));
  --color-success: hsl(var(--success));
  --color-success-foreground: hsl(var(--success-foreground));
  --color-draw: hsl(var(--draw));
  --color-draw-foreground: hsl(var(--draw-foreground));
  --color-border: hsl(var(--border));
  --color-input: hsl(var(--input));
  --color-ring: hsl(var(--ring));
  --color-sidebar: hsl(var(--sidebar));
  --color-sidebar-foreground: hsl(var(--sidebar-foreground));
  --color-sidebar-primary: hsl(var(--sidebar-primary));
  --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));
  --color-sidebar-accent: hsl(var(--sidebar-accent));
  --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground));
  --color-sidebar-border: hsl(var(--sidebar-border));
  --color-sidebar-ring: hsl(var(--sidebar-ring));

  /* CEL Custom Colors */
  --color-cel-dark: hsl(var(--cel-dark));
  --color-cel-navy: hsl(var(--cel-navy));
  --color-cel-blue: hsl(var(--cel-blue));
  --color-cel-blue-glow: hsl(var(--cel-blue-glow));
  --color-cel-gold: hsl(var(--cel-gold));
  --color-cel-green: hsl(var(--cel-green));
  --color-cel-red: hsl(var(--cel-red));

  /* Container */
  --container-center: true;
  --container-padding: 2rem;
  --container-2xl: 1400px;
}

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;

    /* Chart Colors (from Shadcn init) */
    --chart-1: oklch(0.646 0.222 41.116);
    --chart-2: oklch(0.6 0.118 184.704);
    --chart-3: oklch(0.398 0.07 227.392);
    --chart-4: oklch(0.828 0.189 84.429);
    --chart-5: oklch(0.769 0.188 70.08);

    /* Custom CEL Colors */
    --cel-dark: 222 47% 6%;
    --cel-navy: 222 47% 11%;
    --cel-blue: 217 91% 60%;
    --cel-blue-glow: 217 91% 70%;
    --cel-gold: 45 93% 47%;
    --cel-green: 142 76% 36%;
    --cel-red: 0 72% 51%;

    /* Match states */
    --success: 142 76% 36%;
    --success-foreground: 210 40% 98%;
    --draw: 45 93% 47%;
    --draw-foreground: 222 47% 6%;

    /* Gradients */
    --gradient-hero: linear-gradient(
      135deg,
      hsl(222 47% 8%) 0%,
      hsl(217 50% 15%) 50%,
      hsl(222 47% 6%) 100%
    );
    --gradient-card: linear-gradient(
      180deg,
      hsl(222 47% 12%) 0%,
      hsl(222 47% 8%) 100%
    );
    --gradient-blue: linear-gradient(
      135deg,
      hsl(217 91% 50%) 0%,
      hsl(217 91% 65%) 100%
    );
    --gradient-gold: linear-gradient(
      135deg,
      hsl(45 93% 40%) 0%,
      hsl(45 93% 55%) 100%
    );
    --gradient-field: linear-gradient(
      180deg,
      hsl(142 50% 25%) 0%,
      hsl(142 60% 20%) 100%
    );
  }

  .dark {
    /* CEL Lovable Original - Dark esports theme (HSL 222° bleu marine profond) */
    --background: 222 47% 6%;
    --foreground: 210 40% 98%;

    /* Card - Bleu marine sombre */
    --card: 222 47% 8%;
    --card-foreground: 210 40% 98%;

    /* Sidebar - Même que card */
    --sidebar: 222 47% 8%;
    --sidebar-foreground: 210 40% 98%;
    --sidebar-primary: 217 91% 60%;
    --sidebar-primary-foreground: 222 47% 6%;
    --sidebar-accent: 222 47% 14%;
    --sidebar-accent-foreground: 210 40% 98%;
    --sidebar-border: 222 30% 18%;
    --sidebar-ring: 217 91% 60%;

    --popover: 222 47% 10%;
    --popover-foreground: 210 40% 98%;

    /* Primary - Electric Blue */
    --primary: 217 91% 60%;
    --primary-foreground: 222 47% 6%;

    /* Secondary - Deep Navy */
    --secondary: 222 47% 14%;
    --secondary-foreground: 210 40% 98%;

    /* Muted */
    --muted: 222 30% 18%;
    --muted-foreground: 215 20% 55%;

    /* Accent - Golden Yellow (Cameroon) */
    --accent: 45 93% 47%;
    --accent-foreground: 222 47% 6%;

    /* Success/Win - Green */
    --success: 142 76% 36%;

    /* Destructive/Loss - Red */
    --destructive: 0 72% 51%;
    --destructive-foreground: 210 40% 98%;

    /* Borders & Inputs */
    --border: 222 30% 18%;
    --input: 222 30% 18%;
    --ring: 217 91% 60%;

    /* Chart Colors */
    --chart-1: oklch(0.488 0.243 264.376);
    --chart-2: oklch(0.696 0.17 162.48);
    --chart-3: oklch(0.769 0.188 70.08);
    --chart-4: oklch(0.627 0.265 303.9);
    --chart-5: oklch(0.645 0.246 16.439);
  }
}

@layer base {
  * {
    border-color: hsl(var(--border));
  }

  body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
  }
}

/* Solid backgrounds using @layer components for proper cascade */
@layer components {
  .bg-card-solid {
    background-color: hsl(var(--card));
  }

  .bg-popover-solid {
    background-color: hsl(var(--popover));
  }

  .bg-muted-solid {
    background-color: hsl(var(--muted));
  }
}

@layer utilities {
  /* Custom Scrollbar Styles */
  .custom-scrollbar::-webkit-scrollbar {
    width: 6px;
  }

  .custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
  }

  .custom-scrollbar::-webkit-scrollbar-thumb {
    background: hsl(var(--muted));
    border-radius: 3px;
  }

  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
  }

  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
}

@layer base {
  /* Cursor pointer for clickable elements */
  button:not(:disabled),
  a,
  [role='button']:not([aria-disabled='true']),
  [role='tab']:not([aria-disabled='true']),
  [role='combobox']:not([aria-disabled='true']) {
    cursor: pointer;
  }

  /* Enhanced hover effects for clickable elements */
  button:not(:disabled):hover,
  [role='button']:not([aria-disabled='true']):hover,
  [role='tab']:not([aria-disabled='true']):hover,
  [role='combobox']:not([aria-disabled='true']):hover {
    opacity: 0.9;
    transform: translateY(-1px);
    transition: all 0.2s ease;
  }

  button:not(:disabled):active,
  [role='button']:not([aria-disabled='true']):active,
  [role='tab']:not([aria-disabled='true']):active,
  [role='combobox']:not([aria-disabled='true']):active {
    transform: translateY(0);
  }

  /* Hover effect for badges with close button */
  .group:hover [data-badge-close] {
    opacity: 1;
  }

  /* Hover effect for command items */
  [cmdk-item]:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
  }
}

/* Radix UI component styles - using @layer components for proper cascade */
@layer components {
  /* Tab active state with higher specificity */
  [role='tablist'] [data-state='active'][role='tab'] {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow:
      0 10px 15px -3px rgb(0 0 0 / 0.1),
      0 4px 6px -4px rgb(0 0 0 / 0.1);
  }

  /* Tab hover effect with higher specificity */
  [role='tablist']
    [role='tab']:not([disabled]):not([data-state='active']):hover {
    background-color: hsl(var(--muted) / 0.5);
  }

  /* Select and Combobox backgrounds */
  .dark .radix-select-trigger,
  .dark [role='combobox'] {
    background-color: hsl(var(--card));
  }

  .dark .radix-select-content,
  .dark [cmdk-root] {
    background-color: hsl(var(--popover));
  }

  /* Radix Popover & Select with data attributes */
  .dark [data-radix-select-content],
  .dark [data-radix-popper-content-wrapper],
  .dark [data-radix-popover-content] {
    background-color: hsl(var(--popover));
  }

  /* Command palette components */
  .dark [cmdk-root],
  .dark [cmdk-list] {
    background-color: hsl(var(--popover));
  }
}

/* CEL Custom Components */
@layer components {
  /* Sports title styling */
  .title-sports {
    @apply font-bold tracking-wider uppercase;
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    letter-spacing: 0.05em;
  }

  /* Glow effects */
  .glow-blue {
    box-shadow:
      0 0 20px hsl(217 91% 60% / 0.3),
      0 0 40px hsl(217 91% 60% / 0.1);
  }

  .glow-gold {
    box-shadow:
      0 0 20px hsl(45 93% 47% / 0.3),
      0 0 40px hsl(45 93% 47% / 0.1);
  }

  /* Form indicator dots */
  .form-win {
    @apply h-3 w-3 rounded-full;
    background-color: hsl(var(--success));
  }

  .form-draw {
    @apply h-3 w-3 rounded-full;
    background-color: hsl(var(--draw));
  }

  .form-loss {
    @apply h-3 w-3 rounded-full;
    background-color: hsl(var(--destructive));
  }

  /* Card hover effects */
  .card-hover {
    @apply transition-all duration-300 hover:scale-[1.02] hover:shadow-lg;
  }

  /* Match card styling */
  .match-card {
    @apply rounded-lg border p-4 transition-all duration-300;
    border-color: hsl(var(--border));
    background-color: hsl(var(--card));
    background: var(--gradient-card);
  }

  .match-card:hover {
    border-color: hsl(var(--primary) / 0.5);
    box-shadow: 0 4px 20px hsl(217 91% 60% / 0.15);
  }

  /* Navbar link styling */
  .nav-link {
    @apply relative px-3 py-2 text-sm font-medium transition-colors;
    color: hsl(var(--muted-foreground));
  }

  .nav-link:hover {
    color: hsl(var(--foreground));
  }

  .nav-link::after {
    content: '';
    @apply absolute bottom-0 left-0 h-0.5 w-full origin-right scale-x-0 transition-transform duration-300;
    background-color: hsl(var(--primary));
  }

  .nav-link:hover::after,
  .nav-link.active::after {
    @apply origin-left scale-x-100;
  }

  .nav-link.active {
    color: hsl(var(--primary));
  }

  /* Live indicator */
  .live-indicator {
    @apply inline-flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-bold uppercase;
    background-color: hsl(var(--destructive) / 0.2);
    color: hsl(var(--destructive));
  }

  .live-indicator::before {
    content: '';
    @apply h-2 w-2 animate-pulse rounded-full;
    background-color: hsl(var(--destructive));
  }

  /* Announcement tags */
  .tag-info {
    @apply border;
    background-color: hsl(var(--primary) / 0.2);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.3);
  }

  .tag-urgent {
    @apply border;
    background-color: hsl(var(--destructive) / 0.2);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.3);
  }

  .tag-discipline {
    @apply border;
    background-color: hsl(var(--accent) / 0.2);
    color: hsl(var(--accent));
    border-color: hsl(var(--accent) / 0.3);
  }

  .tag-matchday {
    @apply border;
    background-color: hsl(var(--success) / 0.2);
    color: hsl(var(--success));
    border-color: hsl(var(--success) / 0.3);
  }
}

/* CEL Animations */
@layer utilities {
  .animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
  }

  .animate-slide-in-right {
    animation: slide-in-right 0.5s ease-out;
  }

  .animate-slide-in-left {
    animation: slide-in-left 0.5s ease-out;
  }

  .animate-count-pulse {
    animation: count-pulse 1s ease-in-out infinite;
  }

  @keyframes pulse-glow {
    0%,
    100% {
      box-shadow: 0 0 20px hsl(217 91% 60% / 0.3);
    }

    50% {
      box-shadow: 0 0 30px hsl(217 91% 60% / 0.5);
    }
  }

  @keyframes slide-in-right {
    from {
      transform: translateX(100%);
      opacity: 0;
    }

    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  @keyframes slide-in-left {
    from {
      transform: translateX(-100%);
      opacity: 0;
    }

    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  @keyframes count-pulse {
    0%,
    100% {
      transform: scale(1);
    }

    50% {
      transform: scale(1.05);
    }
  }

  /* Text gradients */
  .text-gradient-gold {
    @apply bg-clip-text text-transparent;
    background-image: linear-gradient(
      135deg,
      hsl(45 93% 50%) 0%,
      hsl(45 93% 65%) 100%
    );
  }

  .text-gradient-blue {
    @apply bg-clip-text text-transparent;
    background-image: linear-gradient(
      135deg,
      hsl(217 91% 55%) 0%,
      hsl(217 91% 70%) 100%
    );
  }
}

/* Liquid Glass Mode - Styles globaux quand glassmorphism est activé */
body.glassmorphism-enabled {
  /* Background avec pattern subtil pour accentuer l'effet glass */
  background-image: radial-gradient(
    circle at 20% 50%,
    hsl(217 91% 60% / 0.05) 0%,
    transparent 50%
  );
}

/* Mode Glassmorphism désactivé - Fond Lovable solid avec gradients */
body:not(.glassmorphism-enabled) .match-card,
body:not(.glassmorphism-enabled) [data-glass-card] {
  background: var(--gradient-card);
  backdrop-filter: none;
}

/* Styles additionnels pour renforcer l'effet glass quand activé */
body.glassmorphism-enabled .match-card,
body.glassmorphism-enabled [data-glass-card] {
  border-color: hsl(var(--border) / 0.5);
  background-color: hsl(var(--card) / 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-image: linear-gradient(
    135deg,
    hsl(var(--card) / 0.5) 0%,
    hsl(var(--card) / 0.3) 100%
  );
}

/* Appliquer l'effet glass aux popovers, dialogs, tooltips quand activé */
body.glassmorphism-enabled [role='dialog'],
body.glassmorphism-enabled [role='menu'],
body.glassmorphism-enabled [data-radix-popper-content-wrapper] {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.glassmorphism-enabled [role='dialog'] > div,
body.glassmorphism-enabled [role='menu'],
body.glassmorphism-enabled .popover-content {
  background-color: hsl(var(--card) / 0.8);
}
