/* Custom Styles for Carlson Gracie BJJ Website */

/* Prevent horizontal scrolling */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  position: relative;
}

/* Glitch Effect for Logo */
.glitch-container {
  position: relative;
  overflow: hidden;
}

.glitch-logo {
  filter: brightness(1.1);
  transition: all 0.3s ease;
}

.glitch-container:hover .glitch-logo {
  animation: glitch 0.5s infinite;
}

.glitch-layer-1,
.glitch-layer-2 {
  opacity: 0;
  pointer-events: none;
}

.glitch-container:hover .glitch-layer-1 {
  animation: glitch-1 0.5s infinite;
  opacity: 0.8;
  filter: hue-rotate(90deg) brightness(1.5);
}

.glitch-container:hover .glitch-layer-2 {
  animation: glitch-2 0.5s infinite;
  opacity: 0.8;
  filter: hue-rotate(180deg) brightness(1.2);
}

@keyframes glitch {
  0%,
  100% {
    transform: translate(0);
  }
  10% {
    transform: translate(-2px, 2px);
  }
  20% {
    transform: translate(-2px, -2px);
  }
  30% {
    transform: translate(2px, 2px);
  }
  40% {
    transform: translate(2px, -2px);
  }
  50% {
    transform: translate(-2px, 2px);
  }
  60% {
    transform: translate(-2px, -2px);
  }
  70% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(-2px, -2px);
  }
  90% {
    transform: translate(2px, 2px);
  }
}

@keyframes glitch-1 {
  0%,
  100% {
    transform: translate(0);
    clip: rect(0, 9999px, 0, 0);
  }
  10% {
    transform: translate(-3px, 1px);
    clip: rect(10px, 9999px, 20px, 0);
  }
  20% {
    transform: translate(3px, -1px);
    clip: rect(30px, 9999px, 40px, 0);
  }
  30% {
    transform: translate(-1px, 3px);
    clip: rect(50px, 9999px, 60px, 0);
  }
  40% {
    transform: translate(1px, -3px);
    clip: rect(70px, 9999px, 80px, 0);
  }
  50% {
    transform: translate(-3px, 1px);
    clip: rect(90px, 9999px, 100px, 0);
  }
  60% {
    transform: translate(3px, -1px);
    clip: rect(110px, 9999px, 120px, 0);
  }
  70% {
    transform: translate(-1px, 3px);
    clip: rect(130px, 9999px, 140px, 0);
  }
  80% {
    transform: translate(1px, -3px);
    clip: rect(150px, 9999px, 160px, 0);
  }
  90% {
    transform: translate(-3px, 1px);
    clip: rect(170px, 9999px, 180px, 0);
  }
}

@keyframes glitch-2 {
  0%,
  100% {
    transform: translate(0);
    clip: rect(0, 9999px, 0, 0);
  }
  15% {
    transform: translate(2px, -2px);
    clip: rect(5px, 9999px, 15px, 0);
  }
  25% {
    transform: translate(-2px, 2px);
    clip: rect(25px, 9999px, 35px, 0);
  }
  35% {
    transform: translate(2px, 2px);
    clip: rect(45px, 9999px, 55px, 0);
  }
  45% {
    transform: translate(-2px, -2px);
    clip: rect(65px, 9999px, 75px, 0);
  }
  55% {
    transform: translate(2px, -2px);
    clip: rect(85px, 9999px, 95px, 0);
  }
  65% {
    transform: translate(-2px, 2px);
    clip: rect(105px, 9999px, 115px, 0);
  }
  75% {
    transform: translate(2px, 2px);
    clip: rect(125px, 9999px, 135px, 0);
  }
  85% {
    transform: translate(-2px, -2px);
    clip: rect(145px, 9999px, 155px, 0);
  }
  95% {
    transform: translate(2px, -2px);
    clip: rect(165px, 9999px, 175px, 0);
  }
}

/* Location Tab Styles */
.location-tab {
  background: transparent;
  color: #6b7280;
  border: none;
  cursor: pointer;
}

.location-tab.active {
  background: #dc2626;
  color: white;
}

.location-tab:hover:not(.active) {
  background: #f3f4f6;
  color: #374151;
}

/* Timetable Location Toggle */
.timetable-location {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.timetable-location.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #dc2626;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b91c1c;
}

/* Enhanced form focus states */
input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  border-color: #dc2626 !important;
}

/* Button hover effects */
.btn-primary {
  background: linear-gradient(45deg, #dc2626, #ef4444);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Fade in animation for sections */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile optimisations */
@media (max-width: 768px) {
  .glitch-container {
    margin-bottom: 1rem;
  }

  .hero-title {
    font-size: 2.5rem;
    line-height: 1.1;
  }
}

/* Hover effects for cards */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Custom gradient backgrounds */
.gradient-red {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.gradient-black {
  background: linear-gradient(135deg, #0f0f0f 0%, #1f1f1f 100%);
}

/* Text selection */
::selection {
  background: #dc2626;
  color: white;
}

::-moz-selection {
  background: #dc2626;
  color: white;
}

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

/* Focus indicators */
.focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* Animation delays for staggered effects */
.animate-delay-100 {
  animation-delay: 100ms;
}
.animate-delay-200 {
  animation-delay: 200ms;
}
.animate-delay-300 {
  animation-delay: 300ms;
}

/* Custom pulse animation */
@keyframes custom-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

/* Hero Video Optimisation */
.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.7);
}

/* Ensure video loads efficiently on mobile */
@media (max-width: 768px) {
  .hero-video {
    object-position: center top;
    filter: brightness(0.6);
  }
}

/* Video overlay for better text readability */
.video-overlay {
  background: linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.7),
    rgba(0, 0, 0, 0.5),
    rgba(0, 0, 0, 0.6)
  );
}

/* Instructor profile animations */
.instructor-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.instructor-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Achievement badges animation */
.achievement-badge {
  position: relative;
  overflow: hidden;
}

.achievement-badge::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.6s;
}

.achievement-badge:hover::before {
  left: 100%;
}
