/**
 * Magic Mirror Effect - Styles
 * Camera-based reflective button effect
 *
 * To disable: remove include of magic-effect.php in index.php
 */

/* ============================================
   GLASS BUTTON
   ============================================ */

.glass-button-link {
  text-decoration: none;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-button-link:hover {
  transform: translateY(-3px) scale(1.02);
}

.glass-button-link:active {
  transform: translateY(-1px) scale(0.98);
}

.glass-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 35px 11px 35px;
  min-height: 52px;
  box-sizing: border-box;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  min-width: 200px;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.15) 0%,
    rgba(127, 231, 204, 0.15) 100%
  );
}

.glass-button__video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%) scaleX(-1);
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.glass-button__video.active {
  opacity: 1;
}

.glass-button__frost {
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius);
  backdrop-filter: blur(4px) saturate(60%);
  -webkit-backdrop-filter: blur(4px) saturate(60%);
  z-index: 1;
}

.glass-button__shine {
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius);
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.4) 35%,
    rgba(255, 255, 255, 0.6) 40%,
    rgba(255, 255, 255, 0.4) 45%,
    transparent 60%
  );
  transform: translateX(-100%);
  z-index: 3;
  pointer-events: none;
}

.glass-button-link:hover .glass-button__shine {
  animation: shine-sweep 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes shine-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.glass-button__content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 2;
}

.glass-button__text {
  font-size: 16px;
  font-weight: 700;
  color: rgba(50, 55, 65, 0.8);
  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.8),
    0 -1px 1px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.glass-button__border {
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius);
  padding: 1.5px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(200, 205, 215, 0.4) 30%,
    rgba(120, 125, 135, 0.5) 70%,
    rgba(180, 185, 195, 0.6) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 4;
  pointer-events: none;
}

.glass-button-link:hover .glass-button {
  box-shadow:
    0 8px 24px rgba(80, 90, 110, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ============================================
   MAGIC TOGGLE BUTTON
   ============================================ */

.magic-toggle {
  position: absolute;
  top: -8px;
  right: -12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.4s ease;
  z-index: 10;
  filter: grayscale(100%);
  overflow: hidden;
}

.magic-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  transition: left 0s;
}

.magic-toggle:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  filter: grayscale(0%);
}

.magic-toggle:hover::before {
  left: 100%;
  transition: left 0.5s ease;
}

.magic-toggle:active {
  transform: scale(0.95);
}

.magic-toggle.active {
  background: var(--gradient-header);
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.4);
  filter: grayscale(0%);
}

/* ============================================
   MAGIC POPUP
   ============================================ */

.magic-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.magic-popup.visible {
  display: flex;
}

.magic-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.magic-popup__content {
  position: relative;
  background: var(--color-white);
  border-radius: var(--border-radius);
  padding: 10px 24px 20px 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: popup-appear 0.3s ease;
}

@keyframes popup-appear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.magic-popup__icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.magic-popup__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px 0;
}

.magic-popup__text {
  font-size: 14px;
  color: var(--color-text-light);
  line-height: 1.5;
  margin: 0 0 6px 0;
}

.magic-popup__note {
  font-size: 12px;
  color: var(--color-text-light);
  line-height: 1.4;
  margin: 0 0 16px 0;
  padding: 10px;
  background: rgba(127, 231, 204, 0.15);
  border-radius: var(--border-radius);
}

.magic-popup__buttons {
  display: flex;
  gap: 12px;
}

.magic-popup__btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.magic-popup__btn--cancel {
  background: var(--color-bg);
  border: 1px solid var(--border-color);
  color: var(--color-text-light);
}

.magic-popup__btn--cancel:hover {
  background: #eee;
}

.magic-popup__btn--confirm {
  background: var(--gradient-header);
  border: none;
  color: var(--color-white);
}

.magic-popup__btn--confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.magic-popup__btn:active {
  transform: scale(0.98);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  .glass-button {
    min-height: 50px;
  }

  .glass-button__text {
    font-size: 15px;
  }

  .magic-toggle {
    top: -6px;
    right: -8px;
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}
