/*
 * Modern Enhancements for SoftwarePluz
 * Adds 2025 design trends and performance improvements
 */

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

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ======= Modern Transitions ======= */
a, button, .btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item {
  transition: all 0.3s ease;
}

img {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

img:hover {
  transform: scale(1.02);
}

/* ======= Enhanced Focus States for Accessibility ======= */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #e94334;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(233, 67, 52, 0.1);
}

/* Remove outline for mouse users only */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* ======= Modern Card Hover Effects ======= */
.item-inner {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* ======= Smooth Fade-in Animation ======= */
.fade-in {
  animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======= Loading States ======= */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #e94334;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ======= Skeleton Loaders ======= */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

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

/* ======= Modern Scroll Indicators ======= */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #e94334, #ff6b5a);
  z-index: 9999;
  transition: width 0.1s ease;
}

/* ======= Improved Button Styles ======= */
.btn {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

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

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

/* ======= Modern Form Enhancements ======= */
.form-control {
  transition: all 0.3s ease;
  border: 2px solid #eee;
}

.form-control:focus {
  border-color: #e94334;
  box-shadow: 0 0 0 3px rgba(233, 67, 52, 0.1);
  transform: translateY(-2px);
}

.form-control:hover {
  border-color: #ddd;
}

/* ======= Glassmorphism Effect (Modern Trend) ======= */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

/* ======= Gradient Text ======= */
.gradient-text {
  background: linear-gradient(135deg, #e94334 0%, #ff6b5a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ======= Dark Mode Styles ======= */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --card-bg: #2d2d2d;
  --border-color: #404040;
}

[data-theme="dark"] body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

[data-theme="dark"] .header {
  background-color: #2d2d2d;
  border-bottom-color: #404040;
}

[data-theme="dark"] .footer {
  background-color: #2d2d2d;
}

[data-theme="dark"] .item-inner,
[data-theme="dark"] .card {
  background-color: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .form-control {
  background-color: #2d2d2d;
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .form-control::placeholder {
  color: #888;
}

/* ======= Dark Mode Toggle Button ======= */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e94334;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* ======= Lazy Loading Image Placeholder ======= */
img[loading="lazy"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

img[loading="lazy"].loaded {
  animation: none;
  background: none;
}

/* ======= Micro-interactions ======= */
.btn-cta {
  transform-origin: center;
}

.btn-cta:active {
  transform: scale(0.95);
}

/* Social icons hover effect */
.social-icons a {
  transition: all 0.3s ease;
}

.social-icons a:hover {
  transform: translateY(-3px);
}

/* ======= Scroll to Top Button ======= */
#back-to-top {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ======= Responsive Improvements ======= */
@media (max-width: 768px) {
  .theme-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
    bottom: 15px;
    right: 15px;
  }
}

/* ======= Performance: GPU Acceleration ======= */
.header,
.btn,
.item-inner,
img {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ======= Accessibility: Skip to Main Content ======= */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: #e94334;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  transition: top 0.3s ease;
}

.skip-to-main:focus {
  top: 0;
}

/* ======= Modern Utilities ======= */
.text-gradient {
  background: linear-gradient(135deg, #e94334 0%, #ff6b5a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-modern {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 8px rgba(0, 0, 0, 0.06);
}

.shadow-modern-hover:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.08);
}
