/* ========================================
   AICodeMirror Custom Styles
   ======================================== */

/* ========== Animations ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.02);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) translateX(-50%);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) translateX(-50%);
  }
}

/* ========== Animation Classes ========== */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

.animate-pulse-subtle {
  animation: pulse 2s infinite;
}

.animate-slide-down {
  animation: slideDown 0.3s ease-out;
}

/* ========== Scroll Animations ========== */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== News Card Effects ========== */
.news-card {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.news-card img {
  transition: transform 0.4s ease;
  overflow: hidden;
}

.news-card:hover img {
  transform: scale(1.08);
}

.news-card .news-title {
  transition: color 0.3s ease;
}

/* ========== Pricing Card Effects ========== */
.pricing-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 32px rgba(215, 125, 97, 0.2);
}

.pricing-card.recommended {
  box-shadow: 0 8px 24px rgba(215, 125, 97, 0.15);
}

.pricing-card.recommended:hover {
  box-shadow: 0 20px 40px rgba(215, 125, 97, 0.25);
}

.pricing-card.ultra:hover {
  box-shadow: 0 20px 40px rgba(255, 122, 0, 0.25);
}

/* ========== Button States ========== */
.btn-primary {
  position: relative;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-left: -9px;
  margin-top: -9px;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

/* ========== Form Validation ========== */
.form-input {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input.valid {
  border-color: #10b981;
}

.form-input.invalid {
  border-color: #ef4444;
}

.form-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
}

.form-error.show {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* ========== Toast Notifications ========== */
.toast-container {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: white;
  color: #374151;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  min-width: 300px;
  max-width: 500px;
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.info {
  border-left: 4px solid #3b82f6;
}

.toast-enter {
  animation: toastIn 0.3s ease-out;
}

.toast-exit {
  animation: toastOut 0.3s ease-out;
}

.dark .toast {
  background: #1e1e1e;
  color: #e5e7eb;
}

/* ========== Mobile Menu ========== */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 320px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: right 0.3s ease-out;
  overflow-y: auto;
}

.mobile-menu.open {
  right: 0;
}

.dark .mobile-menu {
  background: #1e1e1e;
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.mobile-menu-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ========== Dark Mode Toggle ========== */
.dark-mode-toggle {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.dark-mode-toggle:hover {
  transform: rotate(180deg);
}

.dark-mode-toggle:active {
  transform: rotate(180deg) scale(0.95);
}

/* ========== Badge Animation ========== */
.badge-animated {
  animation: pulse 2s infinite;
  transform-origin: center;
}

/* ========== Smooth Transitions ========== */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* ========== Image Lazy Loading ========== */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img.loaded {
  opacity: 1;
}

/* ========== Focus Styles for Accessibility ========== */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #D77D61;
  outline-offset: 2px;
}

/* ========== Utility Classes ========== */
.no-scroll {
  overflow: hidden;
}

.pointer-events-none {
  pointer-events: none;
}

.pointer-events-auto {
  pointer-events: auto;
}

/* ========== Responsive Adjustments ========== */
@media (max-width: 768px) {
  .toast {
    min-width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
  }
}

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

.dark .skeleton {
  background: linear-gradient(
    90deg,
    #2a2a2a 25%,
    #1a1a1a 50%,
    #2a2a2a 75%
  );
  background-size: 200% 100%;
}

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

/* ========== Scroll to Top Button (Optional) ========== */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background: #D77D61;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(215, 125, 97, 0.3);
}

.scroll-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.scroll-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(215, 125, 97, 0.4);
}

/* ========== Print Styles ========== */
@media print {
  .mobile-menu,
  .mobile-menu-overlay,
  .dark-mode-toggle,
  .scroll-to-top {
    display: none !important;
  }
}
