/* ========== XECUTE — css/06-modals.css ========== */
/* All modal dialog styling */

/* ====== MODAL STYLES ====== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }

/* Welcome Modal */
.welcome-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90vw;
  box-shadow: var(--shadow);
  text-align: center;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.welcome-icon { font-size: 48px; margin-bottom: 12px; }
.welcome-content h2 { margin: 0 0 8px; font-size: 22px; }
.welcome-content .brand { color: var(--accent); }
.welcome-content p { color: var(--text-secondary); margin-bottom: 16px; }
.feature-list {
  text-align: left;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}
.feature-list h4 { margin: 0 0 10px; font-size: 13px; color: var(--accent); }
.feature-list ul { margin: 0; padding-left: 16px; color: var(--text-secondary); font-size: 13px; line-height: 1.8; }
.welcome-actions { display: flex; gap: 10px; justify-content: center; }

/* Import Modal */
.import-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90vw;
  text-align: center;
  position: relative;
  animation: modalIn 0.2s ease;
}
.import-content h2 { margin: 12px 0 6px; }
.import-content p { color: var(--text-secondary); margin-bottom: 20px; }
.modal-icon { font-size: 40px; color: var(--accent); }

.import-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.import-option {
  background: var(--bg-primary);
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.import-option:hover { border-color: var(--accent); background: rgba(88,166,255,0.06); }
.import-option i { font-size: 26px; color: var(--accent); }
.import-option h4 { margin: 0; font-size: 13.5px; text-align: center; }
.import-option p { margin: 0; font-size: 11.5px; color: var(--text-secondary); text-align: center; }
.import-note { font-size: 12px; color: var(--text-muted); }
.import-url-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  animation: modalIn 0.15s ease;
}
.import-url-form input {
  flex: 1;
  padding: 9px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  outline: none;
  min-width: 0;
}
.import-url-form input:focus { border-color: var(--accent); }
.import-url-form button { flex-shrink: 0; white-space: nowrap; }

/* Share Modal */
#shareModal .active { display: flex; }
#shareBox {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 420px;
  width: 90vw;
  position: relative;
  animation: modalIn 0.2s ease;
}
#shareBox h3 { margin: 0 0 16px; color: var(--text-primary); }
.share-field { margin-bottom: 12px; }
.share-field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.share-optional { color: var(--text-muted, #6e7681); font-weight: normal; }
.share-field input[type="text"],
.share-field textarea {
  width: 100%;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  resize: vertical;
}
.share-field input[type="text"]:focus,
.share-field textarea:focus { border-color: var(--accent); }
.share-options { display: flex; gap: 16px; margin-bottom: 12px; }
.share-options label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.share-expire { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--text-secondary); }
.share-expire select { 
  background: var(--bg-primary); 
  border: 1px solid var(--border); 
  border-radius: 4px;
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: 12px;
}
#shareLinkBox {
  width: 100%;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin-bottom: 12px;
  outline: none;
}
.share-actions { display: flex; gap: 8px; margin-bottom: 8px; }
#shareUploadingStatus { font-size: 12px; color: var(--text-secondary); min-height: 16px; }

/* Guide / Host Modals */
#guideBox, #omniHostIframeBox {
  background: var(--bg-elevated);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
#guideBox { width: 97vw; height: 97vh; }
#omniHostIframeBox { width: 70vw; height: 70vh; min-width: 320px; min-height: 320px; }
#guideIframe, #omniHostIframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  background: white;
}

/* Settings Modal */
.settings-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 500px;
  width: 90vw;
  max-height: 85vh;
  overflow: auto;
  animation: modalIn 0.2s ease;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}
.settings-header h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.settings-body { padding: 16px 20px 20px; }
.settings-section {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.settings-section h4 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.setting-item:last-child { border-bottom: none; }
.settings-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Cache Panel */
#cachePanelOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
}
#cachePanelOverlay.active { display: block; }
#cachePanel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  flex-direction: column;
}
#cachePanel.active { display: flex; }
.cache-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cache-header h3 { margin: 0; font-size: 15px; }
.cache-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.cache-body h4 { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.cache-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--bg-tertiary);
}
.cache-info { flex: 1; }
.cache-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.cache-meta { font-size: 11px; color: var(--text-muted); }
.cache-actions { display: flex; gap: 6px; }
.cache-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
#emptyCacheMessage {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
#emptyCacheMessage i { font-size: 40px; display: block; margin-bottom: 10px; opacity: 0.4; }

/* AI Assistant Panel */
#aiAssistantPanel {
  display: none;
  position: fixed;
  bottom: calc(var(--footer-h) + 8px);
  right: 16px;
  width: 340px;
  max-width: 90vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  z-index: 500;
}
#aiAssistantPanel.active { display: flex; }
#aiAssistantPanel h4 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; color: var(--accent); }
#aiAssistantInput {
  width: 100%;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  resize: none;
  min-height: 70px;
  outline: none;
  font-family: inherit;
}
#aiAssistantInput:focus { border-color: var(--accent); }
.ai-actions { display: flex; gap: 6px; }
#aiAssistantOutput {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* Snippets Panel */
#snippetsPanel, #templatesPanel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  flex-direction: column;
}
#snippetsPanel.active, #templatesPanel.active { display: flex; animation: modalIn 0.2s ease; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-header h3 { margin: 0; font-size: 15px; }

.snippets-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
}
.snippet-category { margin-bottom: 20px; }
.snippet-category h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}
.snippet-item {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}
.snippet-item:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }

.templates-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.template-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.template-card:hover { border-color: var(--accent); background: rgba(88,166,255,0.05); }
.template-icon { font-size: 28px; margin-bottom: 8px; color: var(--accent); }
.template-card h4 { margin: 0 0 4px; font-size: 14px; }
.template-card p { margin: 0; font-size: 12px; color: var(--text-secondary); }

/* Add File Modal */
#addFileModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
#addFileModal.show { display: flex; }
#addFileModal .modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-width: 320px;
  max-width: 90vw;
  position: relative;
  animation: modalIn 0.2s ease;
}
#addFileModal h3 { margin: 0 0 16px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.add-file-form label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Close buttons */
.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  z-index: 5;
}
.modal-close-btn:hover { background: var(--accent-red); color: white; }

.icon-close-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.icon-close-btn:hover { background: var(--accent-red); color: white; }
