/* Mobile-First Enhancements and Advanced Improvements */

/* ============================================ */
/* 1. MOBILE OPTIMIZATION FOUNDATION */
/* ============================================ */

/* Touch target optimization */
@media (max-width: 768px) {
  .mobile-view button,
  .mobile-view .btn,
  .mobile-view a[role="button"],
  .mobile-view .nav-link {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 20px !important;
    font-size: 16px !important;
  }
  
  /* Prevent zoom on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }
  
  /* Optimize mobile typography */
  body {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }
  
  p, span, div:not(.icon):not(.fa) {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }
  
  /* Mobile navigation improvements */
  .mobile-nav {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-nav .navbar-collapse.show {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 20px;
    margin-top: 10px;
  }
  
  .mobile-nav .nav-link {
    padding: 15px 20px !important;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
  }
  
  .mobile-nav .nav-link:hover {
    background: #f8fafc;
    color: #3182ce !important;
    transform: translateX(5px);
  }
}

/* ============================================ */
/* 2. ADVANCED SCROLL PROGRESS */
/* ============================================ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #3182ce 0%, #4299e1 100%);
  z-index: 9999;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(49, 130, 206, 0.3);
}

/* ============================================ */
/* 3. ENHANCED LOADING STATES */
/* ============================================ */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3182ce;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.skeleton-loader {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

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

/* ============================================ */
/* 4. ADVANCED BUTTON STATES */
/* ============================================ */

.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, #3182ce 0%, #4299e1 100%);
  border: none;
  color: white;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  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::after {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(49, 130, 206, 0.4);
}

/* ============================================ */
/* 5. ENHANCED CARD ANIMATIONS */
/* ============================================ */

.card,
.experience-card,
.skill-category {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(49, 130, 206, 0.1), transparent);
  transition: left 0.6s;
}

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

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(49, 130, 206, 0.2);
}

/* ============================================ */
/* 6. ADVANCED TYPOGRAPHY ANIMATIONS */
/* ============================================ */

.typing-cursor::after {
  content: '|';
  color: #3182ce;
  animation: blink 1s infinite;
  font-weight: normal;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Gradient text effect */
.gradient-text {
  background: linear-gradient(135deg, #3182ce, #4299e1, #63b3ed);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease-in-out infinite;
}

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

/* ============================================ */
/* 7. MICRO-INTERACTIONS */
/* ============================================ */

.hover-bounce {
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hover-bounce:hover {
  transform: scale(1.05) translateY(-3px);
}

.pulse-on-hover {
  transition: box-shadow 0.3s ease;
}

.pulse-on-hover:hover {
  box-shadow: 0 0 0 10px rgba(49, 130, 206, 0.1);
}

/* Icon rotation animation */
.rotate-on-hover {
  transition: transform 0.3s ease;
}

.rotate-on-hover:hover {
  transform: rotate(360deg);
}

/* ============================================ */
/* 8. ENHANCED NAVIGATION STATES */
/* ============================================ */

.nav-link {
  position: relative;
  overflow: hidden;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #3182ce, #4299e1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 80%;
}

.nav-link:hover {
  color: #3182ce !important;
  transform: translateY(-1px);
}

/* ============================================ */
/* 9. ACCESSIBILITY ENHANCEMENTS */
/* ============================================ */

/* High contrast mode improvements */
@media (prefers-contrast: high) {
  .btn {
    border: 3px solid currentColor !important;
  }
  
  .card {
    border: 2px solid #333 !important;
  }
  
  .nav-link::after {
    height: 4px !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-progress {
    transition: none !important;
  }
}

/* Focus indicators */
.skip-link:focus {
  position: absolute;
  top: 0 !important;
  left: 6px;
  background: #3182ce;
  color: white;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 10000;
  font-weight: bold;
}

/* Enhanced focus styles */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #4299e1 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2) !important;
}

/* ============================================ */
/* 10. PERFORMANCE OPTIMIZATIONS */
/* ============================================ */

/* GPU acceleration for animations */
.card,
.btn,
.nav-link,
.experience-card {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimize repaints */
.fade-in-up,
.fade-in-left,
.fade-in-right {
  will-change: transform, opacity;
}

.fade-in-up.visible,
.fade-in-left.visible,
.fade-in-right.visible {
  will-change: auto;
}

/* ============================================ */
/* 11. DARK MODE ENHANCEMENTS */
/* ============================================ */

[data-theme="dark"] .mobile-nav {
  background: rgba(26, 32, 44, 0.98) !important;
}

[data-theme="dark"] .mobile-nav .navbar-collapse.show {
  background: #2d3748;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mobile-nav .nav-link {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9 !important;
}

[data-theme="dark"] .mobile-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(99, 179, 237, 0.1), transparent);
}

/* ============================================ */
/* 12. ADVANCED RESPONSIVE BREAKPOINTS */
/* ============================================ */

/* Extra small devices */
@media (max-width: 375px) {
  .container {
    padding: 0 12px;
  }
  
  .hero-title {
    font-size: 2rem !important;
  }
  
  .btn {
    padding: 10px 16px !important;
    font-size: 14px !important;
  }
  
  .card {
    padding: 1rem !important;
  }
}

/* Large phones */
@media (min-width: 376px) and (max-width: 414px) {
  .hero-title {
    font-size: 2.5rem !important;
  }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 90%;
  }
  
  .card {
    padding: 2rem !important;
  }
}

/* Large screens optimization */
@media (min-width: 1440px) {
  .container {
    max-width: 1280px;
  }
  
  .hero-title {
    font-size: 6rem !important;
  }
}

/* ============================================ */
/* 13. PRINT STYLES */
/* ============================================ */

@media print {
  .navbar,
  .scroll-progress,
  .skip-link,
  button:not(.btn-primary),
  .social-icons {
    display: none !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  body {
    font-size: 12pt !important;
    line-height: 1.4 !important;
    color: #000 !important;
    background: white !important;
  }
}

/* ============================================ */
/* 14. LANDSCAPE MOBILE OPTIMIZATION */
/* ============================================ */

@media screen and (orientation: landscape) and (max-height: 500px) {
  .hero-section {
    min-height: auto;
    padding: 2rem 0;
  }
  
  .hero-title {
    font-size: 2rem !important;
    margin-bottom: 1rem !important;
  }
  
  .hero-description {
    font-size: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  .navbar {
    padding: 0.5rem 1rem;
  }
}

/* ============================================ */
/* 15. UTILITY CLASSES */
/* ============================================ */

.text-gradient {
  background: linear-gradient(135deg, #3182ce, #4299e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-soft {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.shadow-strong {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.border-gradient {
  border: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #3182ce, #4299e1) border-box;
}

.glassmorphism {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glassmorphism {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}