/* Key Verification Styles - Dùng chung cho tất cả trang test */

/* ==================== VERIFY LOADER ==================== */
.verify-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  color: #fff;
}

.verify-loader .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #00ffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.verify-loader .loader-text {
  font-size: 18px;
  font-weight: 600;
  margin: 10px 0;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff;
}

.verify-loader .sub-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 5px;
}

/* ==================== KEY TIMER ==================== */
.key-timer {
  position: fixed;
  top: 60px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.3);
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
}

.key-timer.warning {
  background: rgba(255, 165, 0, 0.9);
  color: #000;
  border-color: #ff8800;
  animation: pulse 1s infinite;
}

.key-timer.expired {
  background: rgba(255, 0, 0, 0.9);
  color: #fff;
  border-color: #ff0000;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* ==================== POPUP ==================== */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.popup.active {
  opacity: 1;
  pointer-events: auto;
}

.popup-content {
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 20, 60, 0.95));
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.5), 0 0 50px rgba(255, 0, 255, 0.3);
  border: 2px solid rgba(0, 255, 255, 0.5);
  max-width: 400px;
  width: 90%;
  text-align: center;
  color: #fff;
  animation: popupSlideIn 0.3s ease;
}

.popup.error .popup-content {
  border-color: rgba(255, 0, 0, 0.6);
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.4), 0 0 50px rgba(255, 100, 100, 0.2);
}

@keyframes popupSlideIn {
  from {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.popup-content p {
  margin: 0 0 20px 0;
  font-size: 16px;
  line-height: 1.5;
  color: #fff;
}

.popup-btn {
  background: linear-gradient(90deg, #00ffff, #ff00ff);
  color: #fff;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.popup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 255, 0.5);
  opacity: 0.9;
}

.popup-btn:active {
  transform: translateY(0);
}

/* ==================== KEY ACCESS FORM ==================== */
#key-access,
.key-access-wrapper {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: none !important; /* Ẩn mặc định, chỉ hiện khi cần */
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  background: linear-gradient(135deg, 
    rgba(10, 0, 30, 0.95) 0%,
    rgba(30, 0, 50, 0.95) 25%,
    rgba(20, 10, 40, 0.95) 50%,
    rgba(40, 0, 60, 0.95) 75%,
    rgba(10, 0, 30, 0.95) 100%
  ) !important;
  background-size: 400% 400% !important;
  animation: gradientShift 15s ease infinite !important;
  backdrop-filter: blur(10px) !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important; /* Bắt đầu với opacity 0 */
  transition: opacity 0.3s ease !important;
}

#key-access.show,
.key-access-wrapper.show {
  display: flex !important;
  opacity: 1 !important;
}

/* Animated gradient background */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Animated particles/glow effects */
#key-access::before,
.key-access-wrapper::before {
  content: '' !important;
  position: absolute !important;
  top: -50% !important;
  left: -50% !important;
  width: 200% !important;
  height: 200% !important;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 0, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(0, 255, 255, 0.1) 0%, transparent 50%) !important;
  animation: particleFloat 20s ease-in-out infinite !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

#key-access::after,
.key-access-wrapper::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 255, 255, 0.03) 2px,
      rgba(0, 255, 255, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255, 0, 255, 0.03) 2px,
      rgba(255, 0, 255, 0.03) 4px
    ) !important;
  pointer-events: none !important;
  z-index: 0 !important;
  opacity: 0.5 !important;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.5;
  }
  25% {
    transform: translate(10%, -10%) rotate(90deg);
    opacity: 0.7;
  }
  50% {
    transform: translate(-5%, 10%) rotate(180deg);
    opacity: 0.6;
  }
  75% {
    transform: translate(-10%, -5%) rotate(270deg);
    opacity: 0.8;
  }
}

.key-access {
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 20, 60, 0.95)) !important;
  backdrop-filter: blur(16px) !important;
  border-radius: 20px !important;
  color: #fff !important;
  text-align: center !important;
  padding: 45px 40px !important;
  box-shadow: 
    0 0 40px rgba(0, 255, 255, 0.5),
    0 0 60px rgba(255, 0, 255, 0.4),
    0 0 80px rgba(0, 255, 255, 0.2),
    inset 0 0 30px rgba(255, 255, 255, 0.05) !important;
  border: 2px solid rgba(0, 255, 255, 0.4) !important;
  width: 100% !important;
  max-width: 420px !important;
  margin: 0 auto !important;
  animation: fadeIn 0.6s ease !important;
  position: relative !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  z-index: 1 !important;
}

.key-access::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(0, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 3s infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

#key-access h3,
.key-access h3 {
  margin: 0 0 30px 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
  background: linear-gradient(90deg, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

#key-access input,
.key-access input {
  width: calc(100% - 40px);
  max-width: 320px;
  padding: 16px 20px;
  font-size: 16px;
  border-radius: 12px;
  border: 2px solid rgba(0, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  margin: 20px auto 0;
  text-align: center;
  transition: all 0.3s ease;
  display: block;
  font-family: inherit;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

#key-access input:focus,
.key-access input:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 
    0 0 25px rgba(0, 255, 255, 0.5),
    inset 0 0 15px rgba(0, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.03);
}

#key-access input::placeholder,
.key-access input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

#key-access button,
.key-access button {
  margin-top: 25px;
  padding: 16px 40px;
  font-size: 16px;
  background: linear-gradient(90deg, #00ffff, #ff00ff);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  transition: all 0.3s ease;
  box-shadow: 
    0 6px 20px rgba(0, 255, 255, 0.5),
    0 0 30px rgba(255, 0, 255, 0.4);
  position: relative;
  z-index: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: inline-block;
  min-width: 180px;
}

#key-access button:hover:not(:disabled),
.key-access button:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 
    0 8px 30px rgba(0, 255, 255, 0.7),
    0 0 50px rgba(255, 0, 255, 0.5);
  background: linear-gradient(90deg, #00ffff, #ff00ff, #00ffff);
  background-size: 200% 100%;
  animation: gradientShift 2s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

#key-access button:active:not(:disabled),
.key-access button:active:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
}

#key-access button:disabled,
.key-access button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 255, 255, 0.2);
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.5), rgba(255, 0, 255, 0.5));
}

#keyStatus {
  margin-top: 15px;
  font-weight: 600;
  min-height: 24px;
  font-size: 14px;
  padding: 10px 15px;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#keyStatus:empty {
  display: none;
}

#keyStatus.success {
  background: rgba(0, 255, 153, 0.15);
  border: 1px solid rgba(0, 255, 153, 0.4);
  color: #00ff99;
  box-shadow: 0 0 10px rgba(0, 255, 153, 0.3);
}

#keyStatus.error {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: #ff3366;
  box-shadow: 0 0 10px rgba(255, 51, 102, 0.3);
}

#keyStatus.warning {
  background: rgba(255, 170, 0, 0.15);
  border: 1px solid rgba(255, 170, 0, 0.4);
  color: #ffaa00;
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
}

#keyStatus.info {
  background: rgba(0, 255, 255, 0.15);
  border: 1px solid rgba(0, 255, 255, 0.4);
  color: #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive */
@media (max-width: 768px) {
  #key-access,
  .key-access-wrapper {
    padding: 15px !important;
    align-items: center !important;
    justify-content: center !important;
    display: flex !important;
  }

  .key-access {
    width: 100% !important;
    max-width: 100% !important;
    padding: 35px 25px !important;
    margin: 0 auto !important;
    border-radius: 16px !important;
    flex-shrink: 0 !important;
  }

  #key-access h3,
  .key-access h3 {
    font-size: 20px;
    margin-bottom: 25px;
  }

  #key-access input,
  .key-access input {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    margin: 15px 0 0 0;
  }

  #key-access button,
  .key-access button {
    width: 100%;
    max-width: 100%;
    padding: 14px 20px;
    margin-top: 20px;
    font-size: 15px;
    min-width: auto;
  }

  #keyStatus {
    margin-top: 15px;
    font-size: 13px;
    padding: 8px 12px;
  }

  .key-timer {
    top: 50px;
    right: 10px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .popup-content {
    padding: 20px 25px;
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  #key-access,
  .key-access-wrapper {
    padding: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .key-access {
    padding: 30px 20px !important;
    border-radius: 14px !important;
    margin: 0 auto !important;
    flex-shrink: 0 !important;
  }

  #key-access h3,
  .key-access h3 {
    font-size: 18px;
    margin-bottom: 20px;
  }

  #key-access input,
  .key-access input {
    padding: 12px 14px;
    font-size: 14px;
  }

  #key-access button,
  .key-access button {
    padding: 12px 18px;
    font-size: 14px;
  }
}

