@tailwind base;
@tailwind components;
@tailwind utilities;

/* Premium homepage specific styles */
.premium-gradient-text {
  @apply bg-clip-text text-transparent bg-gradient-to-r from-primary via-accent to-primary;
  background-size: 200% auto;
  animation: shimmer 3s ease-in-out infinite;
}

.creative-title {
  background: linear-gradient(135deg, 
    #007BFF 0%, 
    #00CFFF 25%, 
    #007BFF 50%, 
    #00CFFF 75%, 
    #007BFF 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 100%;
  }
}

.apple-card {
  @apply bg-white/90 backdrop-blur-xl rounded-2xl border border-white/20 shadow-xl;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-card:hover {
  @apply shadow-2xl border-primary/20;
  transform: translateY(-4px);
}

/* Book Animation Styles */
.perspective-1000 {
  perspective: 1000px;
}

.book-container {
  transform-style: preserve-3d;
}

.book-page-left {
  transform-origin: right center;
  animation: pageFlutterLeft 6s ease-in-out infinite;
}

.book-page-right {
  transform-origin: left center;
  animation: pageFlutterRight 6s ease-in-out infinite;
}

@keyframes pageFlutterLeft {
  0%, 100% {
    transform: rotateY(0deg);
  }
  25% {
    transform: rotateY(-5deg);
  }
  50% {
    transform: rotateY(0deg);
  }
  75% {
    transform: rotateY(-3deg);
  }
}

@keyframes pageFlutterRight {
  0%, 100% {
    transform: rotateY(0deg);
  }
  25% {
    transform: rotateY(5deg);
  }
  50% {
    transform: rotateY(0deg);
  }
  75% {
    transform: rotateY(3deg);
  }
}

.book-container:hover .book-page-left {
  animation: pageFlipLeft 2s ease-in-out;
}

.book-container:hover .book-page-right {
  animation: pageFlipRight 2s ease-in-out;
}

@keyframes pageFlipLeft {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(-25deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

@keyframes pageFlipRight {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(25deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.neural-glow {
  box-shadow: 
    0 0 20px rgba(0, 123, 255, 0.1),
    0 0 40px rgba(0, 207, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.brain-container {
  background: linear-gradient(135deg, 
    rgba(0, 123, 255, 0.05) 0%, 
    rgba(0, 207, 255, 0.02) 50%, 
    transparent 100%);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}

.brain-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, 
    transparent 30%, 
    rgba(255, 255, 255, 0.1) 50%, 
    transparent 70%);
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

.floating-label {
  animation: appleFloat 6s ease-in-out infinite;
}

.scroll-indicator {
  animation: appleFloat 3s ease-in-out infinite;
}

/* Creative feature section animations */
@keyframes featureFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-5px) rotate(0.5deg);
  }
  66% {
    transform: translateY(5px) rotate(-0.5deg);
  }
}

@keyframes cardHover {
  0% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  100% {
    transform: translateY(-8px) rotate(0deg) scale(1.02);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 123, 255, 0.3);
  }
}

/* Feature showcase styles */
.feature-hero {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(255, 255, 255, 0.9) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-hero:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.feature-card-creative {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.9) 0%, 
    rgba(255, 255, 255, 0.8) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card-creative:hover {
  animation: cardHover 0.3s ease-out forwards;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

.rotating-background {
  transition: transform 0.3s ease-out;
}

.group:hover .rotating-background {
  transform: rotate(0deg) !important;
}

/* Mosaic layout enhancements */
.mosaic-card {
  position: relative;
  overflow: hidden;
}

.mosaic-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    transparent 100%);
  transition: left 0.5s ease-out;
  z-index: 1;
}

.mosaic-card:hover::before {
  left: 100%;
}

/* Gamification section special effects */
.gamification-showcase {
  background: radial-gradient(circle at center, 
    rgba(251, 191, 36, 0.1) 0%, 
    rgba(249, 115, 22, 0.05) 50%, 
    transparent 100%);
}

.achievement-card {
  animation: featureFloat 4s ease-in-out infinite;
}

.achievement-card:nth-child(2) {
  animation-delay: 1s;
}

.achievement-card:nth-child(3) {
  animation-delay: 2s;
}

/* Import modal fixes */

/* Custom animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes glow {
  0% { box-shadow: 0 0 5px rgba(0, 123, 255, 0.2); }
  50% { box-shadow: 0 0 20px rgba(0, 123, 255, 0.4); }
  100% { box-shadow: 0 0 5px rgba(0, 123, 255, 0.2); }
}

/* Apple-style animations for premium page */
@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes brainPulse {
  0% { 
    transform: scale(1) rotateY(0deg);
    filter: brightness(1);
  }
  50% { 
    transform: scale(1.05) rotateY(180deg);
    filter: brightness(1.2);
  }
  100% { 
    transform: scale(1) rotateY(360deg);
    filter: brightness(1);
  }
}

@keyframes neuralFlow {
  0% {
    opacity: 0.3;
    transform: translateX(-100%) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translateX(0%) scale(1);
  }
  100% {
    opacity: 0.3;
    transform: translateX(100%) scale(0.8);
  }
}

@keyframes appleFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes slideInLeft {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes bounce-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Animation classes */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-pulse-slow {
  animation: pulse 3s infinite ease-in-out;
}

.animate-glow {
  animation: glow 3s infinite ease-in-out;
}

/* Apple-style animation classes */
.animate-float-up {
  animation: floatUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.animate-bounce-gentle {
  animation: bounce-gentle 2s infinite ease-in-out;
}

/* Custom utilities */
.shadow-glass {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* Enhanced 3D card styles */
.language-card, .feature-card, .testimonial-card {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
  perspective: 1000px;
}

/* Apple-style glassmorphism */
.glass-apple {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.37),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Premium card hover effects */
.premium-card {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.premium-card:hover {
  transform: translateY(-10px) rotateX(5deg);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Background overrides to ensure 3D backgrounds work */
#three-background canvas,
#globe-container canvas {
  position: absolute !important;
  top: 0;
  left: 0;
  z-index: -1 !important;
}

/* Force fixed elements to stay behind content */
.fixed.inset-0 {
  z-index: -10 !important;
}

/* Modern Dashboard Glassmorphism Styles */

/* Text shadow for better readability on gradient backgrounds */
.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Glass effect for main cards (without blur) */
.glass-card {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.glass-panel {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.37),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Floating animation */
.float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Gentle pulse animation */
.pulse-gentle {
  animation: pulseGentle 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseGentle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Hover glow effect */
.hover-glow {
  transition: all 0.3s ease;
  position: relative;
}

.hover-glow:hover {
  transform: translateY(-5px);
  box-shadow: 
    0 20px 40px rgba(0, 123, 255, 0.15),
    0 8px 16px rgba(0, 123, 255, 0.1);
}

/* Interactive button animations */
.btn-modern {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-modern::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-modern:hover::before {
  left: 100%;
}

.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 123, 255, 0.2);
}

/* Content fade in */
.fade-in {
  animation: fadeIn 0.8s ease-out;
}

/* Stagger fade in for multiple elements */
.fade-in-delay-1 {
  animation: fadeIn 0.8s ease-out 0.1s both;
}

.fade-in-delay-2 {
  animation: fadeIn 0.8s ease-out 0.2s both;
}

.fade-in-delay-3 {
  animation: fadeIn 0.8s ease-out 0.3s both;
}

.fade-in-delay-4 {
  animation: fadeIn 0.8s ease-out 0.4s both;
}

/* Scale in animation for action buttons */
.scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Progress bar animation */
.progress-animated {
  position: relative;
  overflow: hidden;
}

.progress-animated::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  background-size: 20px 20px;
  animation: progressShine 2s linear infinite;
}

@keyframes progressShine {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 20px 20px;
  }
}

/* Mobile and touch-friendly improvements */
.touch-manipulation {
  touch-action: manipulation;
}

/* Improved touch targets */
@media (max-width: 768px) {
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Larger tap targets for mobile */
  button, a, input, select, textarea {
    min-height: 44px;
  }
  
  /* Better spacing for mobile forms */
  .form-mobile {
    padding: 1rem;
  }
  
  .form-mobile input,
  .form-mobile select,
  .form-mobile textarea {
    padding: 0.75rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Improved focus states for accessibility */
.focus-visible:focus-visible {
  outline: 2px solid #007BFF;
  outline-offset: 2px;
}

/* Better card hover states for touch devices */
@media (hover: hover) {
  .hover-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  }
}

/* Safe area handling for notched devices */
@supports (padding: max(0px)) {
  .safe-area-inset-top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .safe-area-inset-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  
  .safe-area-inset-left {
    padding-left: max(1rem, env(safe-area-inset-left));
  }
  
  .safe-area-inset-right {
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Line clamping utility */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Dark Mode Styles */
.dark {
  color-scheme: dark;
}

.dark body {
  background-color: #0f172a;
  color: #e2e8f0;
}

/* Dark mode navigation */
.dark nav {
  background-color: rgba(15, 23, 42, 0.8);
  border-color: #1e293b;
}

/* Dark mode cards and containers */
.dark .bg-white {
  background-color: #1e293b;
}

.dark .bg-gray-50 {
  background-color: #0f172a;
}

.dark .bg-gray-100 {
  background-color: #1e293b;
}

.dark .border-gray-200,
.dark .border-neutral-200 {
  border-color: #334155;
}

.dark .border-gray-100,
.dark .border-neutral-100 {
  border-color: #1e293b;
}

/* Dark mode text colors */
.dark .text-gray-900,
.dark .text-neutral-900 {
  color: #f1f5f9;
}

.dark .text-gray-700,
.dark .text-neutral-700 {
  color: #cbd5e1;
}

.dark .text-gray-600,
.dark .text-neutral-600 {
  color: #94a3b8;
}

.dark .text-gray-500,
.dark .text-neutral-500 {
  color: #64748b;
}

/* Dark mode form inputs */
.dark input,
.dark select,
.dark textarea {
  background-color: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
  border-color: #3b82f6;
  background-color: #1e293b;
}

/* Dark mode buttons */
.dark .bg-primary {
  background-color: #3b82f6;
}

.dark .hover\:bg-primary-dark:hover {
  background-color: #2563eb;
}

/* Dark mode glass effect (without blur) */
.dark .glass-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(51, 65, 85, 0.3);
}

.dark .glass-panel {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.2), rgba(15, 23, 42, 0.1));
  border: 1px solid rgba(51, 65, 85, 0.3);
}

/* Dark mode shadows */
.dark .shadow-sm,
.dark .shadow,
.dark .shadow-md,
.dark .shadow-lg,
.dark .shadow-xl {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Dark mode gradients */
.dark .bg-gradient-to-r.from-blue-50.to-indigo-50 {
  background: linear-gradient(to right, #1e293b, #334155);
}

.dark .bg-blue-50 {
  background-color: #1e3a8a;
}

.dark .border-blue-200 {
  border-color: #3730a3;
}

.dark .text-blue-700 {
  color: #93c5fd;
}

/* Dark mode loading skeleton */
.dark .bg-gray-200 {
  background-color: #334155;
}

/* Dark mode hover states */
.dark .hover\:bg-gray-100:hover,
.dark .hover\:bg-neutral-100:hover {
  background-color: #334155;
}

.dark .hover\:bg-neutral-50:hover {
  background-color: #1e293b;
}

/* Dark mode focus states */
.dark .focus\:ring-primary\/20:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Enhanced Focus Indicators for Accessibility */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Remove default focus outline when using focus-visible */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Specific focus styles for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  transition: box-shadow 0.2s ease-in-out;
}

/* Enhanced focus for navigation links */
nav a:focus-visible {
  background-color: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Focus styles for cards and interactive containers */
.card:focus-visible,
.interactive-card:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  transform: translateY(-2px);
}

/* Focus styles for form controls */
.form-control:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Dark mode focus indicators */
.dark *:focus-visible {
  outline-color: #60a5fa;
}

.dark button:focus-visible,
.dark a:focus-visible,
.dark input:focus-visible,
.dark select:focus-visible,
.dark textarea:focus-visible,
.dark [role="button"]:focus-visible,
.dark [tabindex]:focus-visible {
  outline-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.3);
}

.dark nav a:focus-visible {
  background-color: rgba(96, 165, 250, 0.15);
  outline-color: #60a5fa;
}

/* Skip to content link for screen readers */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #3b82f6;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 9999;
  transition: top 0.3s;
}

.skip-to-content:focus {
  top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  *:focus-visible {
    outline: 3px solid;
    outline-offset: 2px;
  }
  
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.5);
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *:focus-visible {
    transition: none;
  }
  
  .card:focus-visible,
  .interactive-card:focus-visible {
    transform: none;
  }
}
