/*-----------------------------------------------
  MODALS
-----------------------------------------------*/
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  display: flex;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--info-bg);
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  transform: translateY(30px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
  opacity: 1;
  animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

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

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.3s, transform 0.3s;
  z-index: 10;
}

.modal-close:hover {
  color: var(--accent-color);
  transform: rotate(90deg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: var(--primary-color);
}

.modal-body {
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
}

body.modal-open {
  overflow: hidden;
  padding-right: 15px;
  /* Prevent scrollbar jump */
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem;
    max-height: 80vh;
  }

  .modal-header {
    margin-bottom: 1rem;
  }

  .modal-body {
    margin-bottom: 1rem;
  }

  .modal-overlay {
    padding: 10px;
  }
}

/* Dark mode overrides */
body.dark .modal-close {
  color: var(--text-secondary);
}

body.dark .modal-close:hover {
  color: var(--accent-color);
}

body.dark .modal-content {
  background: var(--info-bg);
}

/* Authentication Modals - Improved Styling */
#login-modal .modal-content,
#signup-modal .modal-content,
#google-setup-modal .modal-content,
#disclaimer-modal .modal-content {
  max-width: 420px;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.25);
  background: var(--card-bg, #fff);
}

#login-modal .modal-header,
#signup-modal .modal-header,
#google-setup-modal .modal-header,
#disclaimer-modal .modal-header {
  background: var(--accent-color, #007bff);
  color: white;
  padding: 1.5rem;
  margin-bottom: 0;
  border-bottom: none;
}

#login-modal .modal-header h2,
#signup-modal .modal-header h2,
#google-setup-modal .modal-header h2,
#disclaimer-modal .modal-header h2 {
  color: white;
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
}

#login-modal .modal-body,
#signup-modal .modal-body,
#google-setup-modal .modal-body,
#disclaimer-modal .modal-body {
  padding: 1.5rem;
  margin-bottom: 0;
}

/* Specifically for the disclaimer modal */
#disclaimer-modal .modal-content {
  max-width: 600px;
}

#disclaimer-modal.active {
  opacity: 1;
  visibility: visible;
  z-index: 2000;
}

#disclaimer-acknowledge {
  width: auto;
  margin: 15px auto 0;
  display: block;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
  border-radius: 8px;
  font-size: 15px;
  background-color: var(--input-bg, #fff);
  color: var(--text-color, #333);
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control:focus {
  border-color: var(--accent-color, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.5;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-bottom: 14px;
}

.btn-primary {
  background-color: var(--accent-color, #007bff);
  color: #fff;
  border-color: var(--accent-color, #007bff);
  width: 100%;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
  background-color: var(--accent-hover, #0069d9);
  border-color: var(--accent-hover, #0069d9);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.google-btn {
  background-color: #fff;
  color: #333;
  border-color: rgba(0, 0, 0, 0.1);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

.google-btn:hover {
  background-color: #f8f9fa;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.google-btn i {
  color: #4285F4;
  font-size: 18px;
}

.error {
  color: #dc3545;
  font-size: 14px;
  margin-top: 6px;
  margin-bottom: 14px;
  display: none;
  background-color: rgba(220, 53, 69, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #dc3545;
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 6px 0;
}

.checkbox-container input[type="checkbox"] {
  margin-right: 10px;
  margin-top: 3px;
  width: 16px;
  height: 16px;
}

.checkbox-container label {
  font-size: 14px;
  color: var(--text-color, #555);
  line-height: 1.4;
}

.mt-3 {
  margin-top: 18px;
}

#login-modal a,
#signup-modal a,
#google-setup-modal a {
  color: var(--accent-color, #007bff);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

#login-modal a:hover,
#signup-modal a:hover,
#google-setup-modal a:hover {
  color: var(--accent-hover, #0056b3);
  text-decoration: underline;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Dark mode adjustments */
body.dark .form-control {
  background-color: rgba(30, 30, 35, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
}

body.dark .form-control::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

body.dark .google-btn {
  background-color: rgba(40, 40, 45, 0.8);
  color: #f0f0f0;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .google-btn:hover {
  background-color: rgba(50, 50, 55, 0.8);
}

body.dark #login-modal .modal-content,
body.dark #signup-modal .modal-content,
body.dark #google-setup-modal .modal-content,
body.dark #disclaimer-modal .modal-content,
body.dark #copyright-modal .modal-content {
  background: var(--card-bg, #222);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark .checkbox-container label {
  color: rgba(255, 255, 255, 0.8);
}

body.dark .error {
  background-color: rgba(220, 53, 69, 0.15);
}

/* Login button in header */
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--header-text, #fff);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* Copyright Modal Styling */
#copyright-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#copyright-modal.visible {
  opacity: 1;
}

#copyright-modal .modal-content {
  max-width: 500px;
  width: 90%;
  background: var(--info-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  transform: translateY(30px);
  transition: transform 0.3s ease;
}

#copyright-modal.visible .modal-content {
  transform: translateY(0);
}

#copyright-modal .close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.3s;
}

#copyright-modal .close-btn:hover {
  color: var(--accent-color);
}

#copyright-modal h2 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

#copyright-modal p {
  margin-bottom: 0;
  line-height: 1.6;
  color: var(--text-color);
}

/* -----------------------------------------------
   Access Code Modal Styles (Extracted from index.html)
----------------------------------------------- */
.access-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.access-modal.active {
  display: flex;
}

.access-modal-content {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
}

body.dark .access-modal-content {
  background: #1c1c1e;
  color: white;
}

.access-modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #333;
}

body.dark .access-modal-title {
  color: #fff;
}

.access-modal-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1rem;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color 0.3s ease;
}

.access-modal-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

body.dark .access-modal-input {
  background: #2c2c2e;
  border-color: #48484a;
  color: white;
}

body.dark .access-modal-input:focus {
  border-color: #0a84ff;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

.access-modal-submit {
  width: 100%;
  padding: 1rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  transition: background-color 0.3s ease;
}

.access-modal-submit:hover {
  background: #0056b3;
}

.access-modal-submit:active {
  background: #004085;
  transform: scale(0.98);
}

body.dark .access-modal-submit {
  background: #0a84ff;
}

body.dark .access-modal-submit:hover {
  background: #0066cc;
}

.access-modal-error {
  color: #dc3545;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: none;
  font-weight: 500;
}

body.dark .access-modal-error {
  color: #ff453a;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .access-modal {
    padding: 16px;
  }

  .access-modal-content {
    padding: 1.5rem;
    border-radius: 20px;
  }

  .access-modal-input {
    font-size: 16px;
    /* Prevents zoom on iOS */
    padding: 1.2rem;
  }

  .access-modal-submit {
    padding: 1.2rem;
    font-size: 1rem;
  }
}

/* -----------------------------------------------
   Games Modal Styles (Extracted from index.html)
----------------------------------------------- */
.games-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.games-modal.active {
  display: flex;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.games-modal-content {
  width: 90%;
  max-width: 500px;
  height: 80vh;
  max-height: 700px;
  background: linear-gradient(135deg, rgba(40, 40, 50, 0.9), rgba(20, 20, 30, 0.95));
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  position: relative;
  overflow: hidden;
}

.games-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1001;
  background: rgba(80, 80, 90, 0.7);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.games-modal-close:hover {
  background: rgba(120, 120, 140, 0.8);
  transform: scale(1.1);
}

.games-modal h3 {
  margin: 0;
  padding: 20px;
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 24px;
  height: calc(100% - 70px);
  overflow-y: auto;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.games-grid::-webkit-scrollbar {
  width: 6px;
}

.games-grid::-webkit-scrollbar-track {
  background: transparent;
}

.games-grid::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.game-button {
  background: rgba(60, 60, 120, 0.4);
  border: 1px solid rgba(100, 100, 255, 0.2);
  border-radius: 14px;
  padding: 24px 16px;
  color: #fff;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.game-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.game-button:hover {
  background: rgba(80, 80, 160, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(100, 100, 255, 0.4);
}

.game-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.game-button i {
  font-size: 32px;
  margin-bottom: 12px;
  color: #4d9fff;
  text-shadow: 0 0 10px rgba(77, 159, 255, 0.5);
  transition: transform 0.3s ease;
}

.game-button:hover i {
  transform: scale(1.1);
}

.game-button h4 {
  margin: 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.game-button p {
  margin: 0;
  font-size: 13px;
  opacity: 0.8;
  max-width: 90%;
  line-height: 1.4;
}

/* Game iframe styles */
#game-iframe {
  display: none;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1002;
  border-radius: 16px;
  overflow: hidden;
}

#game-iframe.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
  .games-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .games-modal-content {
    width: 95%;
    height: 85vh;
  }

  .game-button {
    padding: 16px 12px;
  }

  .game-button i {
    font-size: 28px;
    margin-bottom: 8px;
  }
}