/* ==================================================================
   Berialabs Advanced Effects - Professional UI Enhancements
   ================================================================== */

/* === Dark Mode Variables === */
[data-theme="dark"] {
  color-scheme: dark;
  --cc-bg: #0f1419;
  --cc-bg-secondary: #1a1f26;
  --cc-surface: #1e2329;
  --cc-border: rgba(255, 255, 255, 0.1);
  --cc-text: #e5e7eb;
  --cc-text-muted: rgba(229, 231, 235, 0.65);
  --cc-accent: #14b8a6;
  --cc-accent-strong: #2dd4bf;
  --cc-pill-bg: rgba(20, 184, 166, 0.15);
  --cc-pill-soft: rgba(20, 184, 166, 0.1);
  --cc-success: #10b981;
  --cc-danger: #f87171;
}

/* === Theme Toggle Button === */
.cc-theme-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 50;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 22px;
}

.cc-theme-toggle:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(59, 87, 105, 0.2);
  background: var(--cc-accent);
  color: white;
}

.cc-theme-toggle:active {
  transform: translateY(-2px) scale(1.02);
}

/* === Glassmorphism Cards === */
.cc-card--glass,
.cc-blog-card--glass,
.cc-integrations__item--glass,
.cc-scenarios__grid article.glass-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .cc-card--glass,
[data-theme="dark"] .cc-blog-card--glass,
[data-theme="dark"] .cc-integrations__item--glass,
[data-theme="dark"] .cc-scenarios__grid article.glass-card {
  background: rgba(19, 24, 31, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* === Advanced Hover Effects === */

/* Lift & Glow Effect */
.cc-card,
.cc-blog-card,
.cc-integrations__item,
.cc-scenarios__grid article {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cc-card:hover,
.cc-blog-card:hover,
.cc-integrations__item:hover,
.cc-scenarios__grid article:hover {
  transform: translateY(-6px);
  box-shadow:
    0 20px 40px rgba(59, 87, 105, 0.15),
    0 0 0 1px rgba(59, 87, 105, 0.1) inset;
}

[data-theme="dark"] .cc-card:hover,
[data-theme="dark"] .cc-blog-card:hover,
[data-theme="dark"] .cc-integrations__item:hover,
[data-theme="dark"] .cc-scenarios__grid article:hover {
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(20, 184, 166, 0.2);
}

/* Animated Border Gradient */
.cc-card--animated-border,
.cc-button--animated {
  position: relative;
  overflow: hidden;
}

.cc-card--animated-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(59, 87, 105, 0.8),
    rgba(67, 176, 170, 0.8),
    rgba(59, 87, 105, 0.8)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.cc-card--animated-border:hover::before {
  opacity: 1;
  animation: borderGradientSpin 3s linear infinite;
}

@keyframes borderGradientSpin {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* Shine Effect */
.cc-card--shine,
.cc-button--shine {
  overflow: hidden;
  position: relative;
}

.cc-card--shine::after,
.cc-button--shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 30%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: rotate(25deg);
  transition: left 0.6s ease;
}

.cc-card--shine:hover::after,
.cc-button--shine:hover::after {
  left: 130%;
}

[data-theme="dark"] .cc-card--shine::after,
[data-theme="dark"] .cc-button--shine::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

/* === Enhanced Button Effects === */

/* Ripple Effect */
.cc-button {
  position: relative;
  overflow: hidden;
}

.cc-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.cc-button:active::before {
  width: 300px;
  height: 300px;
}

[data-theme="dark"] .cc-button::before {
  background: rgba(255, 255, 255, 0.2);
}

/* Magnetic Button Effect */
.cc-button--magnetic {
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Primary Button */
.cc-button--primary {
  background: linear-gradient(135deg, var(--cc-accent), var(--cc-accent-strong));
  box-shadow: 0 4px 12px rgba(59, 87, 105, 0.3);
  position: relative;
}

.cc-button--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--cc-accent-strong), var(--cc-success));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cc-button--primary:hover::after {
  opacity: 1;
}

.cc-button--primary span {
  position: relative;
  z-index: 1;
}

/* Dark mode - vibrant cyan/teal buttons */
[data-theme="dark"] .cc-button--primary {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
  color: #ffffff;
}

[data-theme="dark"] .cc-button--primary::after {
  background: linear-gradient(135deg, #14b8a6, #2dd4bf);
}

[data-theme="dark"] .cc-button--ghost {
  border-color: rgba(20, 184, 166, 0.4);
  color: #5eead4;
}

[data-theme="dark"] .cc-button--ghost:hover {
  border-color: rgba(20, 184, 166, 0.6);
  background: rgba(13, 148, 136, 0.15);
}

/* === Floating Particles Background === */
.cc-particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.cc-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--cc-accent);
  opacity: 0.6;
  animation: float linear infinite;
}

.cc-particle:nth-child(1) { left: 10%; animation-duration: 20s; animation-delay: 0s; }
.cc-particle:nth-child(2) { left: 20%; animation-duration: 25s; animation-delay: 2s; }
.cc-particle:nth-child(3) { left: 30%; animation-duration: 22s; animation-delay: 4s; }
.cc-particle:nth-child(4) { left: 40%; animation-duration: 28s; animation-delay: 1s; }
.cc-particle:nth-child(5) { left: 50%; animation-duration: 24s; animation-delay: 3s; }
.cc-particle:nth-child(6) { left: 60%; animation-duration: 26s; animation-delay: 5s; }
.cc-particle:nth-child(7) { left: 70%; animation-duration: 23s; animation-delay: 2s; }
.cc-particle:nth-child(8) { left: 80%; animation-duration: 27s; animation-delay: 4s; }
.cc-particle:nth-child(9) { left: 90%; animation-duration: 21s; animation-delay: 1s; }
.cc-particle:nth-child(10) { left: 15%; animation-duration: 29s; animation-delay: 6s; }

@keyframes float {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100vh) translateX(50px) scale(1);
    opacity: 0;
  }
}

[data-theme="dark"] .cc-particle {
  background: var(--cc-accent);
  box-shadow: 0 0 8px var(--cc-accent);
}

/* === Animated Gradient Mesh Background === */
.cc-gradient-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
  background:
    radial-gradient(circle at 20% 30%, rgba(59, 87, 105, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(67, 176, 170, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(59, 87, 105, 0.2) 0%, transparent 60%);
  animation: gradientShift 15s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% {
    transform: scale(1) translate(0, 0);
  }
  33% {
    transform: scale(1.1) translate(5%, -5%);
  }
  66% {
    transform: scale(0.95) translate(-5%, 5%);
  }
}

[data-theme="dark"] .cc-gradient-mesh {
  opacity: 0.06;
  background:
    radial-gradient(circle at 20% 30%, rgba(20, 184, 166, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(20, 184, 166, 0.1) 0%, transparent 60%);
}

/* === Pills with Pulse Effect === */
.cc-pill--pulse {
  animation: subtlePulse 3s ease-in-out infinite;
}

@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 87, 105, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(59, 87, 105, 0);
  }
}

/* === Enhanced Terminal Styling === */
.cc-terminal {
  position: relative;
  overflow: hidden;
}

.cc-terminal::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    135deg,
    rgba(59, 87, 105, 0.3),
    rgba(67, 176, 170, 0.3)
  );
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.cc-terminal:hover::before {
  opacity: 1;
}

[data-theme="dark"] .cc-terminal {
  background: linear-gradient(135deg, #1a1f26, #1e2329);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .cc-terminal__header {
  background: linear-gradient(125deg, rgba(26, 31, 38, 0.94), rgba(30, 35, 41, 0.94));
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .cc-terminal__content {
  background: linear-gradient(150deg, rgba(21, 26, 31, 0.9), rgba(26, 31, 38, 0.92));
  color: #e5e7eb;
}

/* === Code Syntax Highlighting (LOTR themed) === */
.cc-terminal__content code {
  color: #5fc9c4; /* Aragorn's ranger green */
}

.cc-terminal__content .term-command {
  color: #6b9bb8; /* Gondor steel blue */
}

.cc-terminal__content .term-prompt {
  color: #e89584; /* Minas Tirith beacon */
}

.cc-terminal__content .term-result {
  color: #a8c5db; /* Elven silver */
}

[data-theme="dark"] .cc-terminal__content code {
  color: #5fc9c4;
}

/* === Terminal Output Colors for Dark Mode === */
[data-theme="dark"] .cc-terminal__content span[style*="color: #0d9488"] {
  color: #6ee7b7 !important; /* Verde más suave */
}

[data-theme="dark"] .cc-terminal__content span[style*="color: #1e293b"] {
  color: #cbd5e1 !important; /* Gris claro legible */
}

[data-theme="dark"] .cc-terminal__content span[style*="color: #334155"] {
  color: #cbd5e1 !important; /* Gris claro legible */
}

/* === Smooth Page Transitions === */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.cc-page {
  transition: background-color 0.3s ease;
}

/* === Enhanced Scroll Indicator === */
.cc-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}

.cc-scroll-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cc-accent), var(--cc-success));
  width: 0%;
  transition: width 0.1s ease;
  box-shadow: 0 0 12px var(--cc-accent);
}

/* === Modal Dark Mode === */
[data-theme="dark"] .beta-modal {
  background: rgba(15, 20, 25, 0.8);
}

[data-theme="dark"] .beta-modal__dialog {
  background: linear-gradient(140deg, #1e2329, #1a1f26);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .beta-modal__title {
  color: #e5e7eb;
}

[data-theme="dark"] .beta-modal__intro {
  color: rgba(229, 231, 235, 0.7);
}

[data-theme="dark"] .beta-form__field {
  color: #e5e7eb;
}

[data-theme="dark"] .beta-form__field input,
[data-theme="dark"] .beta-form__field textarea {
  background: rgba(30, 35, 41, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

[data-theme="dark"] .beta-form__field input:focus,
[data-theme="dark"] .beta-form__field textarea:focus {
  border-color: var(--cc-accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

/* === Header Dark Mode === */
[data-theme="dark"] .cc-header {
  background: rgba(15, 20, 25, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .cc-language-toggle {
  background: rgba(30, 35, 41, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
}

[data-theme="dark"] .cc-language-menu {
  background: linear-gradient(135deg, #1e2329, #1a1f26);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .cc-language-menu a {
  color: #e5e7eb;
}

[data-theme="dark"] .cc-language-menu a:hover,
[data-theme="dark"] .cc-language-menu a.is-active {
  background: rgba(20, 184, 166, 0.15);
  color: var(--cc-accent-strong);
}

/* === Footer Dark Mode === */
[data-theme="dark"] .cc-footer {
  background: var(--cc-bg-secondary);
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* === Responsive Adjustments === */
@media (max-width: 768px) {
  .cc-theme-toggle {
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .cc-particles {
    opacity: 0.2;
  }

  .cc-gradient-mesh {
    opacity: 0.08;
  }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .cc-particles,
  .cc-gradient-mesh {
    display: none;
  }
}

/* Ensure high contrast in dark mode for accessibility */
@media (prefers-contrast: high) {
  [data-theme="dark"] {
    --cc-text: #ffffff;
    --cc-text-muted: rgba(255, 255, 255, 0.8);
    --cc-border: rgba(255, 255, 255, 0.2);
  }
}

/* === Gandalf Terminal Enhanced Colors === */
/* Light mode - colores más oscuros y contrastados */
#gandalf-terminal-output {
  color: #1e293b !important;
}

#gandalf-terminal-output .gandalf-prompt {
  color: #0f766e !important;
  font-weight: 600;
}

#gandalf-quote {
  color: #334155 !important;
  font-weight: 500;
}

/* Dark mode - colores vibrantes y llamativos */
[data-theme="dark"] #gandalf-terminal-output {
  color: #e5e7eb !important;
}

[data-theme="dark"] #gandalf-terminal-output .gandalf-prompt {
  color: #14b8a6 !important;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(20, 184, 166, 0.5);
}

[data-theme="dark"] #gandalf-quote {
  background: linear-gradient(135deg, #14b8a6, #10b981, #2dd4bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
  animation: gandalfGlow 3s ease-in-out infinite;
}

@keyframes gandalfGlow {
  0%, 100% {
    filter: brightness(1) saturate(1);
  }
  50% {
    filter: brightness(1.2) saturate(1.3);
  }
}
