/* ============================================
   NUB TV - Premium Design System
   ============================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Variables --- */
:root {
  --nub-primary: #0ea5e9;
  --nub-primary-dark: #0284c7;
  --nub-accent: #6366f1;
  --nub-glow: rgba(14, 165, 233, 0.3);
  --nub-glow-accent: rgba(99, 102, 241, 0.25);
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(148, 163, 184, 0.2);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);
  --input-glow: 0 0 0 3px rgba(14, 165, 233, 0.15), 0 0 20px rgba(14, 165, 233, 0.08);
  --bg-pattern-opacity: 0.03;
}

html.dark {
  --card-bg: rgba(30, 41, 59, 0.65);
  --card-border: rgba(71, 85, 105, 0.35);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.25);
  --input-glow: 0 0 0 3px rgba(14, 165, 233, 0.2), 0 0 24px rgba(14, 165, 233, 0.1);
  --bg-pattern-opacity: 0.02;
}

/* --- Base & Typography --- */
* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* --- Animated Background --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -2;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(14, 165, 233, 0.03) 0%, transparent 70%);
  pointer-events: none;
}

html.dark body::before {
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(14, 165, 233, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(14, 165, 233, 0.02) 0%, transparent 70%);
}

/* Subtle dot grid pattern */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background-image: radial-gradient(circle, rgba(100, 116, 139, var(--bg-pattern-opacity)) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

/* --- Glass Cards --- */
/* Target all card-like containers */
.bg-white,
div[class*="bg-white"][class*="rounded-xl"],
div[class*="dark:bg-slate-800"][class*="rounded-xl"] {
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}

div[class*="rounded-xl"][class*="shadow-lg"] {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  box-shadow: var(--card-shadow) !important;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

div[class*="rounded-xl"][class*="shadow-lg"]:hover {
  box-shadow: var(--card-shadow-hover) !important;
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.2) !important;
}

html.dark div[class*="rounded-xl"][class*="shadow-lg"]:hover {
  border-color: rgba(14, 165, 233, 0.25) !important;
}

/* --- Entrance Animations --- */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.2); }
  50% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.4); }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Header animation */
header {
  animation: fadeSlideUp 0.6s ease-out;
}

/* Staggered card entry */
main > div > div:nth-child(1) > *:nth-child(1) { animation: fadeSlideUp 0.5s ease-out 0.1s both; }
main > div > div:nth-child(1) > *:nth-child(2) { animation: fadeSlideUp 0.5s ease-out 0.2s both; }
main > div > div:nth-child(1) > *:nth-child(3) { animation: fadeSlideUp 0.5s ease-out 0.3s both; }
main > div > div:nth-child(1) > *:nth-child(4) { animation: fadeSlideUp 0.5s ease-out 0.4s both; }
main > div > div:nth-child(2) > *:nth-child(1) { animation: fadeSlideUp 0.5s ease-out 0.15s both; }
main > div > div:nth-child(2) > *:nth-child(2) { animation: fadeSlideUp 0.5s ease-out 0.25s both; }
main > div > div:nth-child(2) > *:nth-child(3) { animation: fadeSlideUp 0.5s ease-out 0.35s both; }

/* --- Header Enhancement --- */
header h1 {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #0ea5e9 100%) !important;
  background-size: 200% auto;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  animation: gradient-shift 4s ease infinite;
  letter-spacing: -0.02em;
  filter: drop-shadow(0 2px 4px rgba(14, 165, 233, 0.2));
}

header p {
  letter-spacing: 0.01em;
}

/* --- Section Titles --- */
h2 {
  position: relative;
  letter-spacing: -0.01em;
}

h2[class*="text-sky-600"],
h2[class*="dark:text-sky-400"] {
  background: linear-gradient(135deg, var(--nub-primary) 0%, var(--nub-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Premium Buttons --- */
button[class*="bg-sky-600"],
button[class*="bg-blue-600"],
a[class*="bg-"][class*="text-white"] {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25);
}

button[class*="bg-sky-600"]:hover,
button[class*="bg-blue-600"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.35) !important;
}

button[class*="bg-sky-600"]:active,
button[class*="bg-blue-600"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25) !important;
}

/* Telegram button special */
a[class*="bg-[#24A1DE]"] {
  box-shadow: 0 4px 14px rgba(36, 161, 222, 0.3);
}

a[class*="bg-[#24A1DE]"]:hover {
  box-shadow: 0 6px 20px rgba(36, 161, 222, 0.4) !important;
  transform: translateY(-1px);
}

/* Shimmer effect on primary buttons */
button[class*="bg-sky-600"]::after,
button[class*="bg-blue-600"]::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.5s ease;
}

button[class*="bg-sky-600"]:hover::after,
button[class*="bg-blue-600"]:hover::after {
  left: 100%;
}

/* Small action buttons (icon buttons) */
button[class*="rounded-full"][class*="p-2"] {
  transition: all 0.25s ease !important;
}

button[class*="rounded-full"][class*="p-2"]:hover {
  background: rgba(14, 165, 233, 0.1);
  transform: scale(1.1);
}

/* --- Input Enhancements --- */
input[class*="rounded-md"],
select[class*="rounded-md"],
textarea[class*="rounded-md"] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

input[class*="rounded-md"]:focus,
select[class*="rounded-md"]:focus,
textarea[class*="rounded-md"]:focus {
  box-shadow: var(--input-glow) !important;
  border-color: var(--nub-primary) !important;
}

/* --- Tabs/Pill Buttons Enhancement --- */
button[class*="rounded-full"][class*="px-3"][class*="py-1"] {
  transition: all 0.25s ease !important;
}

button[class*="rounded-full"][class*="bg-sky-600"] {
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

/* --- Event Cards --- */
div[class*="rounded-md"][class*="flex"][class*="items-center"][class*="justify-between"] {
  transition: all 0.25s ease !important;
  border-left: 3px solid transparent;
}

div[class*="rounded-md"][class*="flex"][class*="items-center"][class*="justify-between"]:hover {
  border-left-color: var(--nub-primary);
}

/* --- Logo Grid Items --- */
div[class*="cursor-pointer"][class*="rounded-lg"] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

div[class*="cursor-pointer"][class*="rounded-lg"]:hover {
  transform: scale(1.03);
}

/* --- Scrollbar Enhancement --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--nub-primary), var(--nub-accent));
  border-radius: 10px;
  opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
  opacity: 1;
  background: linear-gradient(180deg, var(--nub-primary-dark), var(--nub-accent));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--nub-primary) transparent;
}

/* --- Textarea Enhancement --- */
textarea[readonly] {
  background: linear-gradient(135deg, 
    rgba(241, 245, 249, 0.8) 0%, 
    rgba(226, 232, 240, 0.5) 100%
  ) !important;
}

html.dark textarea[readonly] {
  background: linear-gradient(135deg, 
    rgba(15, 23, 42, 0.8) 0%, 
    rgba(30, 41, 59, 0.5) 100%
  ) !important;
}

/* --- Theme Toggle Enhancement --- */
header button[class*="rounded-full"],
header > div > button {
  transition: all 0.3s ease !important;
}

header button[class*="rounded-full"]:hover,
header > div > button:hover {
  transform: rotate(15deg) scale(1.1);
}

/* --- Copy Button Enhancement --- */
button[title*="Copiar"],
button[title*="Copiado"] {
  transition: all 0.25s ease !important;
  backdrop-filter: blur(4px);
}

button[title*="Copiar"]:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- Footer Enhancement --- */
footer {
  position: relative;
}

footer::before {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--nub-primary), var(--nub-accent));
  border-radius: 2px;
  margin: 0 auto 16px;
}

footer p {
  letter-spacing: 0.02em;
}

/* --- Selection Color --- */
::selection {
  background: rgba(14, 165, 233, 0.2);
  color: inherit;
}

html.dark ::selection {
  background: rgba(14, 165, 233, 0.3);
}

/* --- Responsive Refinements --- */
@media (max-width: 640px) {
  header h1 {
    font-size: 2rem !important;
  }
  
  div[class*="rounded-xl"][class*="shadow-lg"]:hover {
    transform: none;
  }
}

/* --- Focus Visible Enhancement --- */
*:focus-visible {
  outline: 2px solid var(--nub-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Tooltip-style title hover --- */
button[title] {
  position: relative;
}

/* --- Code/Mono text enhancement --- */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace !important;
  font-size: 0.875em;
}

/* --- Alert/Badge pill animations --- */
span[class*="rounded-full"][class*="bg-red-500"] {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* --- Smooth page transitions --- */
#root {
  animation: fadeIn 0.4s ease-out;
}

/* --- Date group headers enhancement --- */
h3[class*="text-sky-600"],
h3[class*="dark:text-sky-300"] {
  position: relative;
  padding-left: 12px;
}

h3[class*="text-sky-600"]::before,
h3[class*="dark:text-sky-300"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: linear-gradient(180deg, var(--nub-primary), var(--nub-accent));
  border-radius: 2px;
}
