/* ========================================================================= */
/* CSS/MODALS.CSS - Modals, Dialogs, AI Scan Console, and Settings           */
/* ========================================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transform: translateY(15px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.modal-close {
  width: 2rem;
  height: 2rem;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.form-input, .form-select {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  transition: var(--transition-smooth);
  width: 100%;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-active);
  background-color: var(--bg-primary);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
  cursor: pointer;
}

.auth-switch {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--cobalt);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Profile Dropdown Popup */
.profile-card-dropdown {
  position: absolute;
  top: 70px;
  right: 2rem;
  width: 280px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.2rem;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  background-color: var(--cobalt-light);
  color: var(--cobalt);
  font-family: var(--font-display);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-email {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.profile-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.profile-card-divider {
  height: 1px;
  background-color: var(--border-color);
}

.profile-card-options {
  list-style: none;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.75rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

.dropdown-item:hover {
  background-color: var(--bg-secondary);
}

.dropdown-item.danger {
  color: #dc2626;
}

.dropdown-item.danger:hover {
  background-color: #fef2f2;
}

[data-theme="dark"] .dropdown-item.danger:hover {
  background-color: #450a0a;
}

/* Choice Cards (AI/Raw choices) */
.choice-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.choice-card {
  position: relative;
  border: 1px solid var(--border-color);
  padding: 1.2rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: var(--bg-secondary);
}

.choice-card:hover {
  border-color: var(--text-primary);
}

.choice-card.active {
  border-color: var(--cobalt);
  background-color: var(--bg-primary);
  box-shadow: 0 0 0 1px var(--cobalt);
}

.choice-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice-card-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.choice-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.recommend-badge {
  display: inline-flex;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--cobalt-light);
  color: var(--cobalt);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  margin-bottom: 0.1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ========================================================================= */
/* AI COMPILER CONSOLE WINDOW                                               */
/* ========================================================================= */

.overlay-full {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.ai-processing-box {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.ai-logo-spinner {
  width: 64px;
  height: 64px;
  color: var(--cobalt);
}

.ai-logo-spinner svg {
  width: 100%;
  height: 100%;
}

.ai-scan-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ai-scan-terminal {
  width: 100%;
  height: 280px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.terminal-line {
  display: none; /* Triggered sequentially by JS */
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.5;
}

.terminal-line.active {
  display: flex;
}

.term-prompt {
  color: var(--cobalt);
  font-weight: 600;
  user-select: none;
}

.term-text {
  color: var(--text-primary);
}

.term-text-bullet {
  color: var(--text-secondary);
  padding-left: 0.8rem;
}

.text-cobalt {
  color: var(--cobalt);
  font-weight: 500;
}

/* ========================================================================= */
/* EXPORT OPTIONS MODAL LIST                                                */
/* ========================================================================= */

.export-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.export-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  background-color: var(--bg-secondary);
  transition: var(--transition-smooth);
}

.export-option-row:hover {
  border-color: var(--text-primary);
  background-color: var(--bg-primary);
}

.export-row-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.export-row-meta i {
  stroke-width: 1.25px;
  width: 24px;
  height: 24px;
}

.export-meta-desc {
  display: flex;
  flex-direction: column;
}

.export-meta-desc h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.export-meta-desc p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================================================= */
/* AI SETTINGS BUTTON & CONFIG                                               */
/* ========================================================================= */

.settings-row-split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.75rem;
}

.api-key-wrapper {
  position: relative;
  display: flex;
}

.api-key-wrapper input {
  padding-right: 2.2rem;
}

.eye-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.eye-btn:hover {
  color: var(--text-primary);
}


.term-text-success {
  color: #10b981 !important;
  font-weight: 500;
}

.term-text-danger {
  color: #ef4444 !important;
  font-weight: 600;
}

.term-text-warning {
  color: #f59e0b !important;
  font-weight: 500;
}

/* ========================================================================= */
/* MOBILE RESPONSIVE MEDIA OVERRIDES                                         */
/* ========================================================================= */

@media (max-width: 576px) {
  .settings-row-split {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .ai-scan-terminal {
    max-height: 40vh;
    height: auto;
  }
}

@media (max-width: 480px) {
  .profile-card-dropdown {
    right: 1rem;
    width: calc(100% - 2rem);
  }
  
  .modal-body {
    padding: 1.25rem 1rem;
    gap: 1rem;
  }
  
  .choice-card {
    padding: 1rem;
  }
}

/* ========================================================================= */
/* PREMIUM CUSTOM SELECT DROPDOWN STYLES                                     */
/* ========================================================================= */

.custom-select-trigger {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  transition: var(--transition-smooth);
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.custom-select-trigger:focus, .custom-select-trigger:hover {
  border-color: var(--border-active);
  outline: none;
}

.custom-dropdown-container {
  position: relative;
  width: 100%;
}

.custom-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  margin-top: 4px;
  padding: 4px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-dropdown-menu.hidden {
  display: none !important;
}

.custom-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s, color 0.15s;
}

.custom-dropdown-item:hover {
  background-color: var(--bg-secondary);
}

.custom-dropdown-item.active {
  background-color: var(--cobalt-light);
  color: var(--cobalt);
  font-weight: 600;
}

.custom-dropdown-item i {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.15s;
  color: var(--cobalt);
}

.custom-dropdown-item.active i {
  opacity: 1;
}

