/* Word Search Modal Styles — themed to Breadboard3D (dark cyan).
   Uses the global :root variables from style.css. Layout/sizing are unchanged
   from the original; only colours were re-mapped to the app theme.
   Semantic colours: cyan = accent/selection, teal-green = found word. */

.wordsearch-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 8, 12, 0.6);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.wordsearch-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.wordsearch-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: auto;
  max-width: 1200px;
  max-height: 800px;
  background: var(--bg-panel, #0e1520);
  color: var(--text-primary, #d4e8f0);
  border: 1px solid var(--border-bright, #243348);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 28px var(--accent-glow, rgba(0, 229, 255, 0.18));
  z-index: 1001;
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wordsearch-modal.show {
  opacity: 1;
  transform: scale(1) translate(-50%, -50%);
}

.wordsearch-modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border, #1a2535);
  background: linear-gradient(180deg, var(--bg-surface, #0c1118), var(--bg-panel, #0e1520));
  color: var(--text-primary, #d4e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-shrink: 1;
}

.wordsearch-modal-title-container {
  flex: 1;
  min-width: 0;
}

.wordsearch-modal-title {
  margin: 0 0 4px 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent, #00e5ff);
}

.wordsearch-modal-subtitle {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1.4;
  text-align: center;
  color: var(--text-secondary, #6a8fa8);
}

.wordsearch-modal-close-button {
  background: var(--bg-hover, #1a2535);
  border: 1px solid var(--border, #1a2535);
  font-size: 1.5rem;
  color: var(--text-secondary, #6a8fa8);
  cursor: pointer;
  padding: 8px;
  margin-left: 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wordsearch-modal-close-button:hover {
  background: var(--bg-active, #1e2e42);
  color: var(--accent, #00e5ff);
  transform: scale(1.05);
}

.wordsearch-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  gap: 24px;
  max-height: calc(90vh - 40px);
}

.wordsearch-grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.wordsearch-stats {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--text-secondary, #6a8fa8);
  justify-content: center;
}

.wordsearch-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.wordsearch-grid {
  display: inline-grid;
  gap: 2px;
  background: var(--bg-card, #121c28);
  padding: 2px;
  border-radius: 8px;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.wordsearch-cell {
  width: 36px;
  height: 36px;
  background: var(--bg-surface, #0c1118);
  border: 1px solid var(--border-bright, #243348);
  color: var(--text-primary, #d4e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 150ms ease;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  position: relative;
}

.wordsearch-cell:hover {
  background: var(--bg-hover, #1a2535);
  border-color: var(--accent, #00e5ff);
  transform: scale(1.05);
}

.wordsearch-cell.selected {
  background: rgba(0, 229, 255, 0.22);
  color: var(--accent, #00e5ff);
  border-color: var(--accent, #00e5ff);
  box-shadow: 0 0 8px var(--accent-glow, rgba(0, 229, 255, 0.4));
  font-weight: 700;
}

.wordsearch-cell.found {
  background: rgba(35, 214, 164, 0.16);
  border-color: rgba(35, 214, 164, 0.5);
  color: #3fe6b0;
  font-weight: 700;
}

.wordsearch-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.wordsearch-button {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wordsearch-button-primary {
  background: var(--accent-dim, #007a99);
  color: #eafcff;
}

.wordsearch-button-primary:hover {
  background: var(--accent, #00e5ff);
  color: #06222c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow, rgba(0, 229, 255, 0.3));
}

.wordsearch-new {
  background: #20c997;
  color: #06231a;
}

.wordsearch-new:hover {
  background: #2ee6a6;
}

.wordsearch-button-secondary {
  background: var(--bg-hover, #1a2535);
  color: var(--text-secondary, #6a8fa8);
  border: 1px solid var(--border, #1a2535);
}

.wordsearch-button-secondary:hover {
  background: var(--bg-active, #1e2e42);
  color: var(--text-primary, #d4e8f0);
}

.wordsearch-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.wordsearch-word-list {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(90vh - 220px);
  text-align: center;
}

.wordsearch-word-list h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent, #00e5ff);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wordsearch-words {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 10px;
}

.wordsearch-word-item {
  padding: 12px 16px;
  background: var(--bg-card, #121c28);
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #d4e8f0);
  transition: all 150ms ease;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  cursor: pointer;
}

.wordsearch-word-item:hover {
  background: var(--bg-hover, #1a2535);
  border-color: var(--accent, #00e5ff);
}

.wordsearch-word-item.found {
  background: rgba(35, 214, 164, 0.15);
  border-color: #20c997;
  color: #3fe6b0;
  text-decoration: line-through;
  opacity: 0.8;
}

.wordsearch-word-info {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 200ms;
}

.wordsearch-word-info:hover {
  opacity: 1;
}


/* Responsive Design */
@media (max-width: 768px) {
  .wordsearch-modal-body {
    flex-direction: column;
    max-height: calc(90vh - 140px);
  }

  .wordsearch-word-list {
    min-width: 100%;
    max-height: 200px;
  }

  .wordsearch-cell {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .wordsearch-grid {
    gap: 2px;
  }

  .wordsearch-modal-header {
    padding: 16px 20px;
  }

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

  .wordsearch-modal-body {
    padding: 16px;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .wordsearch-modal {
    max-width: 95vw;
    max-height: 95vh;
  }

  .wordsearch-cell {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .wordsearch-grid {
    gap: 1px;
    padding: 4px;
  }

  .wordsearch-stats {
    gap: 16px;
    font-size: 12px;
  }

  .wordsearch-modal-title {
    font-size: 1.25rem;
  }

  .wordsearch-controls {
    gap: 8px;
  }

  .wordsearch-button {
    padding: 8px 16px;
    font-size: 12px;
  }
}

