/* ========================================
   UTILITIES.CSS - PERFECT CHESS ACADEMY
   Complete utility styles with professional SVG buttons
======================================== */

/* ========================================
   CUSTOM CURSOR TRAIL (DESKTOP ONLY)
======================================== */
.custom-cursor-trail {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  background: var(--accent-primary);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.8;
  z-index: 1999;
  mix-blend-mode: screen;
  transform: translate3d(-100px, -100px, 0);
}

/* ========================================
   FLOATING ACTION BUTTONS - PROFESSIONAL SVG
======================================== */
.floating-action-buttons {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1010;
}

/* Base Button Styles */
.back-to-top,
.settings-toggle,
.ai-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Back to Top Button */
.back-to-top {
  background: var(--accent-primary);
  color: var(--bg-primary);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.3s ease;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  background: var(--accent-secondary);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(var(--accent-primary-rgb), 0.4);
}

.back-to-top:active {
  transform: translateY(-1px) scale(0.98);
}

/* Settings Button */
.settings-toggle {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.settings-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-primary);
  transform: rotate(90deg) scale(1.05);
  box-shadow: 0 8px 20px rgba(var(--accent-primary-rgb), 0.25);
}

.settings-toggle:active {
  transform: rotate(90deg) scale(0.95);
}

/* AI Button (if you have one) */
.ai-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-button:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* SVG Icon Styles */
.back-to-top svg,
.settings-toggle svg,
.ai-button svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.5;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.back-to-top svg {
  color: var(--bg-primary);
  /* Dark icon on orange background */
}

.settings-toggle svg {
  color: var(--text-primary);
  /* Light icon on dark background */
}

.ai-button svg {
  color: white;
}

/* Hover Animation for Back to Top Icon */
.back-to-top:hover svg {
  animation: bounceUp 0.6s ease infinite;
}

/* Settings Icon Counter-Rotation */
.settings-toggle:hover svg {
  transform: rotate(-90deg);
  /* Counter-rotate for smooth effect */
}

@keyframes bounceUp {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .floating-action-buttons {
    bottom: 1.5rem;
    right: 1.5rem;
    gap: 0.625rem;
  }

  .back-to-top,
  .settings-toggle,
  .ai-button {
    width: 48px;
    height: 48px;
  }

  .back-to-top svg,
  .settings-toggle svg,
  .ai-button svg {
    width: 20px;
    height: 20px;
  }
}

/* ========================================
   SETTINGS PANEL
======================================== */
.settings-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(400px, 100%);
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 2px solid var(--border-secondary);
  padding: 2rem;
  transition: right 0.3s ease, border-color 0.3s ease;
  z-index: 1200;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
}

.settings-panel.open {
  right: 0;
  border-left-color: var(--accent-primary);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.settings-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.settings-close:hover {
  transform: rotate(90deg);
  color: var(--accent-primary);
}

.setting-item {
  margin-bottom: 2rem;
}

.setting-item label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Loading states */
.settings-panel.loading {
  opacity: 0.7;
  pointer-events: none;
}

.settings-panel.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid var(--border-secondary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   NOTIFICATIONS
======================================== */
.notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
}

.notification-success {
  background: #22c55e;
}

.notification-error {
  background: #ef4444;
}

.notification-info {
  background: var(--accent-primary);
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

/* Entrance animations for hero elements */
.hero .eyebrow {
  animation: fadeInUp 0.6s ease 0.05s both;
}

.hero h1 {
  animation: fadeInUp 0.7s ease 0.15s both;
}

.hero p {
  animation: fadeInUp 0.8s ease 0.25s both;
}

.hero .hero-badges {
  animation: fadeInUp 0.8s ease 0.3s both;
}

.hero .hero-buttons {
  animation: fadeInUp 0.9s ease 0.4s both;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-20px);
  }
}

.floating-element {
  animation: float 6s ease-in-out infinite;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

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

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

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

/* ========================================
   CUSTOM SCROLLBAR
======================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

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

/* ========================================
   FOCUS STATES (ACCESSIBILITY)
======================================== */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.font-btn:focus-visible,
.settings-toggle:focus-visible,
.back-to-top:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Remove default focus outline */
a:focus,
button:focus {
  outline: none;
}

/* ========================================
   LIGHT MODE ADJUSTMENTS
======================================== */
body.light-mode .settings-toggle {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}

body.light-mode .settings-toggle:hover {
  background: rgba(0, 0, 0, 0.12);
  border-color: var(--accent-primary);
}

body.light-mode .settings-panel {
  background: var(--bg-primary);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

/* ========================================
   ACCESSIBILITY - REDUCED MOTION
======================================== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .back-to-top,
  .settings-toggle {
    transition: opacity 0.2s ease;
  }

  .back-to-top:hover svg {
    animation: none;
  }

  .settings-toggle:hover {
    transform: scale(1.05);
  }

  .floating-element {
    animation: none;
  }
}

/* Animation disabled state (for user preference) */
.no-animations *,
.no-animations *::before,
.no-animations *::after {
  animation: none !important;
  transition: none !important;
}

/* ========================================
   SCREEN READER ONLY CONTENT
======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ========================================
   UTILITY CLASSES
======================================== */

/* Text alignment */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Display utilities */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Spacing utilities */
.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.pt-1 {
  padding-top: 0.5rem;
}

.pt-2 {
  padding-top: 1rem;
}

.pt-3 {
  padding-top: 1.5rem;
}

.pt-4 {
  padding-top: 2rem;
}

.pb-1 {
  padding-bottom: 0.5rem;
}

.pb-2 {
  padding-bottom: 1rem;
}

.pb-3 {
  padding-bottom: 1.5rem;
}

.pb-4 {
  padding-bottom: 2rem;
}

/* Container utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {

  .floating-action-buttons,
  .settings-panel,
  .notification,
  .custom-cursor-trail {
    display: none !important;
  }
}

/* ========================================
   END OF UTILS.CSS
======================================== */