/**
 * Story Unlock Modal Styles
 * Fantasy-themed popup for chapter unlocking
 */

/* Modal Overlay */
.unlock-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.unlock-modal-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Modal Container */
.unlock-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 3px solid #d4af37;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(212, 175, 55, 0.3),
              0 0 40px rgba(212, 175, 55, 0.2),
              inset 0 0 30px rgba(212, 175, 55, 0.05);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  padding: 1.8rem;
  position: relative;
  animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow-y: auto;

  /* Hide scrollbar for Chrome, Safari and Opera */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.unlock-modal::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Decorative corners */
.unlock-modal::before,
.unlock-modal::after {
  content: '✦';
  position: absolute;
  font-size: 2rem;
  color: #d4af37;
  opacity: 0.3;
}

.unlock-modal::before {
  top: 10px;
  left: 10px;
}

.unlock-modal::after {
  bottom: 10px;
  right: 10px;
}

/* Close button */
.unlock-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #d4af37;
  cursor: pointer;
  padding: 5px 10px;
  transition: all 0.3s ease;
  z-index: 10;
}

.unlock-modal-close:hover {
  color: #fff;
  transform: rotate(90deg);
}

/* Modal Header */
.unlock-modal-header {
  text-align: center;
  margin-bottom: 1.3rem;
}

.unlock-modal-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: block;
  animation: pulse 2s ease-in-out infinite;
}

.unlock-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: #d4af37;
  margin: 0 0 0.3rem 0;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.unlock-modal-subtitle {
  font-size: 0.85rem;
  color: #e8d5b7;
  opacity: 0.8;
  margin: 0;
}

/* Modal Content */
.unlock-modal-content {
  margin-bottom: 1rem;
}

.unlock-options {
  display: grid;
  gap: 0.8rem;
}

/* Option Card */
.unlock-option {
  background: rgba(212, 175, 55, 0.05);
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.unlock-option:hover {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.unlock-option-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.unlock-option-icon {
  font-size: 1.5rem;
}

.unlock-option-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: #d4af37;
  margin: 0;
}

.unlock-option-description {
  color: #e8d5b7;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.8rem;
}

.unlock-option-button {
  width: 100%;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
  border: none;
  border-radius: 8px;
  color: #0a0a0a;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Crimson Text', serif;
}

.unlock-option-button:hover {
  background: linear-gradient(135deg, #e8c44d 0%, #d4af37 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

/* Key Input Section */
.key-input-section {
  margin-top: 0.8rem;
}

.key-input-label {
  display: block;
  color: #e8d5b7;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.key-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.key-input {
  flex: 1;
  padding: 0.65rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  color: #e8d5b7;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  text-align: center;
  transition: all 0.3s ease;
}

.key-input:focus {
  outline: none;
  border-color: #d4af37;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.key-submit-button {
  padding: 0.65rem 1.2rem;
  background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
  border: none;
  border-radius: 8px;
  color: #0a0a0a;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.key-submit-button:hover {
  background: linear-gradient(135deg, #e8c44d 0%, #d4af37 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

/* Divider */
.unlock-divider {
  text-align: center;
  position: relative;
  margin: 0.8rem 0;
}

.unlock-divider::before,
.unlock-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(212, 175, 55, 0.5), transparent);
}

.unlock-divider::before {
  left: 0;
}

.unlock-divider::after {
  right: 0;
}

.unlock-divider span {
  color: #d4af37;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0 0.8rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  position: relative;
  z-index: 1;
  letter-spacing: 2px;
}

/* Puzzle Section */
.puzzle-section {
  margin-top: 0.8rem;
}

.puzzle-question {
  background: rgba(212, 175, 55, 0.1);
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 0.9rem;
  margin-bottom: 0.7rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: #d4af37;
  font-family: 'Cinzel', serif;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.puzzle-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.puzzle-input {
  flex: 1;
  padding: 0.65rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  color: #e8d5b7;
  font-size: 1.1rem;
  font-family: 'Courier New', monospace;
  text-align: center;
  transition: all 0.3s ease;
}

.puzzle-input:focus {
  outline: none;
  border-color: #d4af37;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.puzzle-submit-button {
  padding: 0.65rem 1.2rem;
  background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.puzzle-submit-button:hover {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(142, 68, 173, 0.4);
}

/* Message Display */
.unlock-message {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}

.unlock-message.success {
  background: rgba(76, 175, 80, 0.2);
  border: 2px solid rgba(76, 175, 80, 0.5);
  color: #a5d6a7;
}

.unlock-message.error {
  background: rgba(244, 67, 54, 0.2);
  border: 2px solid rgba(244, 67, 54, 0.5);
  color: #ef9a9a;
}

.unlock-message.info {
  background: rgba(33, 150, 243, 0.2);
  border: 2px solid rgba(33, 150, 243, 0.5);
  color: #90caf9;
}

/* Loading State */
.unlock-loading {
  text-align: center;
  padding: 2rem;
  color: #d4af37;
}

.unlock-loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top-color: #d4af37;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

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

/* Responsive */
@media (max-width: 600px) {
  .unlock-modal {
    padding: 2rem 1.5rem;
  }

  .unlock-modal-title {
    font-size: 1.5rem;
  }

  .unlock-option-title {
    font-size: 1.1rem;
  }

  .key-input-wrapper,
  .puzzle-input-wrapper {
    flex-direction: column;
  }

  .puzzle-question {
    font-size: 1.2rem;
    padding: 1rem;
  }
}
