/* AppleCare Calculator - Premium Styles */

:root {
  --apple-blue: #0071e3;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
}

.dark {
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* Tabular Numbers for Price Displays */
.plate-price,
[id$="Monthly"] {
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* Gradient Text */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mesh Background */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -20;
  opacity: 0.4;
  background-image:
    radial-gradient(at 20% 30%, rgba(0, 113, 227, 0.04) 0%, transparent 50%),
    radial-gradient(at 80% 70%, rgba(0, 113, 227, 0.03) 0%, transparent 50%),
    radial-gradient(at 50% 50%, rgba(148, 163, 184, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.dark .mesh-bg {
  opacity: 0.6;
  background-image:
    radial-gradient(at 20% 30%, rgba(0, 113, 227, 0.06) 0%, transparent 50%),
    radial-gradient(at 80% 70%, rgba(0, 113, 227, 0.04) 0%, transparent 50%),
    radial-gradient(at 50% 50%, rgba(255, 255, 255, 0.01) 0%, transparent 70%);
}

/* Focus-Visible States */
:focus-visible {
  outline: 2px solid var(--apple-blue);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--apple-blue);
  outline-offset: 2px;
  border-radius: inherit;
}

/* Custom Scrollbars */
#deviceDropdown::-webkit-scrollbar,
#deviceList::-webkit-scrollbar {
  width: 6px;
}

#deviceDropdown::-webkit-scrollbar-track,
#deviceList::-webkit-scrollbar-track {
  background: transparent;
}

#deviceDropdown::-webkit-scrollbar-thumb,
#deviceList::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.dark #deviceDropdown::-webkit-scrollbar-thumb,
.dark #deviceList::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
}

#deviceList {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Animations */
@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-in {
  animation: fadeInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Device Chip States */
.quick-chip {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-chip:hover {
  background-color: var(--apple-blue);
  color: white !important;
  border-color: var(--apple-blue);
  box-shadow: 0 8px 16px -4px rgba(0, 113, 227, 0.3);
}

.quick-chip:active {
  transform: scale(0.95);
}

/* SVG icons inside chips */
.quick-chip svg {
  width: 16px;
  height: 16px;
}

/* Glass Card Overrides */
.glass-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  border-color: rgba(0, 113, 227, 0.4);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1), 0 0 20px -5px rgba(0, 113, 227, 0.1);
}

.dark .glass-card:hover {
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(0, 113, 227, 0.2);
}

/* Shimmer Effect */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: "";
  position: absolute;
  top: -150%;
  left: -150%;
  width: 300%;
  height: 300%;
  background: linear-gradient(45deg, transparent 45%, rgba(255, 255, 255, 0.1) 50%, transparent 55%);
  transform: rotate(45deg);
  transition: all 0.6s ease;
  pointer-events: none;
}

.shimmer:hover::after {
  top: -50%;
  left: -50%;
}

/* Palette Animation */
@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-palette-in {
  animation: palette-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.no-scroll {
  overflow: hidden;
}

/* Balance Scale Styles */
.balance-scale-container {
  perspective: 1000px;
  --scale-tilt: 0deg;
  margin: 1.5rem 0 3.5rem 0;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scale-float 6s infinite ease-in-out;
}

@keyframes scale-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.balance-scale {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.scale-base {
  width: 4px;
  height: 40px;
  background: linear-gradient(to bottom, #cbd5e1, transparent);
  margin-top: -1px;
  border-radius: 2px;
}

.dark .scale-base {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
}

.scale-beam {
  width: 65%;
  height: 6px;
  background: #cbd5e1;
  border-radius: 3px;
  transform: rotate(var(--scale-tilt));
  transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dark .scale-beam {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 113, 227, 0.1);
}

.scale-pivot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: #0071e3;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 4px solid white;
  z-index: 20;
  box-shadow: 0 0 15px rgba(0, 113, 227, 0.4);
}

.dark .scale-pivot {
  border-color: #1a1a1a;
}

.scale-plate {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 130px;
  transform-origin: top center;
  transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.plate-left {
  left: 0;
  transform: translateX(-50%) rotate(calc(var(--scale-tilt) * -1));
}

.plate-right {
  right: 0;
  transform: translateX(50%) rotate(calc(var(--scale-tilt) * -1));
}

.plate-cable {
  width: 1px;
  height: 40px;
  background: #cbd5e1;
  opacity: 0.6;
}

.dark .plate-cable {
  background: rgba(255, 255, 255, 0.2);
}

.plate-content {
  background: white;
  padding: 1rem;
  border-radius: 1.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.08);
  text-align: center;
  min-width: 130px;
  backdrop-filter: blur(10px);
}

.dark .plate-content {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.4);
}

.plate-content p:first-child {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
}

.plate-price {
  font-size: 1.75rem;
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  backdrop-filter: blur(15px);
  z-index: 1000;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  opacity: 0;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  display: flex;
  align-items: center;
  color: #22c55e;
}

.dark .toast {
  background: rgba(40, 40, 40, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* SVG icons in category grid */
.shimmer svg {
  width: 100%;
  height: 100%;
}

/* Responsive Grid Adjustments */
@media (max-width: 768px) {
  .md\:col-span-12 {
    grid-column: span 12 / span 12;
  }

  .scale-beam {
    width: 70%;
  }

  .plate-content {
    min-width: 120px;
    padding: 0.85rem;
  }

  .plate-price {
    font-size: 1.25rem;
  }
}

/* Typewriter Cursor */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: #94a3b8;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: cursor-blink 1s step-end infinite;
}

.dark .typewriter-cursor {
  background-color: #64748b;
}

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

/* Search bar glow border on hover */
#searchTrigger {
  transition: border-color 0.4s ease, box-shadow 0.4s ease, background-color 0.2s ease;
}

#searchTrigger:hover {
  border-color: rgba(0, 113, 227, 0.5);
  box-shadow:
    0 0 0 1px rgba(0, 113, 227, 0.15),
    0 0 20px -5px rgba(0, 113, 227, 0.2),
    0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

.dark #searchTrigger:hover {
  border-color: rgba(0, 113, 227, 0.6);
  box-shadow:
    0 0 0 1px rgba(0, 113, 227, 0.25),
    0 0 25px -5px rgba(0, 113, 227, 0.3),
    0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .balance-scale-container {
    animation: none;
  }

  .scale-beam,
  .scale-plate {
    transition-duration: 0.01ms;
  }

  .animate-in {
    animation: none;
    opacity: 1;
  }

  .animate-palette-in {
    animation: none;
    opacity: 1;
  }

  .glass-card {
    transition-duration: 0.01ms;
  }

  .quick-chip {
    transition-duration: 0.01ms;
  }

  .shimmer::after {
    display: none;
  }

  .toast {
    transition-duration: 0.01ms;
  }

  .typewriter-cursor {
    animation: none;
    display: none;
  }

  #searchTrigger {
    transition-duration: 0.01ms;
  }
}
