/**
 * Configure Page Styles
 * Extracted from src/views/configure.js for better maintainability
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f1f5f9; min-height: 100vh; padding: 20px; }
.container { max-width: 960px; margin: 0 auto; background: white; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); overflow: hidden; }
.header { background: #eef2ff; color: #111827; padding: 24px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.brand { background: #4f46e5; color: #ffffff; padding: 16px 18px; border-radius: 10px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 12px rgba(79,70,229,0.15); }
.brand h1 { font-size: 28px; margin: 0; line-height: 1.2; }
.brand .icon { font-size: 22px; opacity: 0.95; }
.brand .tag { background: rgba(255,255,255,0.15); color: #fff; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: auto; }
.header h2 { font-size: 18px; margin: 14px 0 6px 0; color: #111827; }
.subtitle { color: #374151; font-size: 14px; margin-bottom: 8px; }
.steps { margin: 6px 0 0 18px; color: #4b5563; font-size: 13px; }
.steps li { margin: 2px 0; }
.content { padding: 24px; }
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; margin-bottom: 6px; color: #333; font-size: 14px; }
input[type="text"], input[type="url"], input[type="email"], input[type="password"], select { width: 100%; padding: 10px 12px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 14px; }
.btn { background: #4f46e5; color: white; border: none; padding: 12px 22px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn:hover { background: #4338ca; }
.row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; align-items: end; }
.row-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: start; }
.url-display { background: #f8fafc; padding: 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; overflow-wrap: break-word; }
.advanced-toggle { display: none; }
.advanced-options { display: block; margin-top: 8px; }
.section-title { font-size: 16px; font-weight: 700; margin: 6px 0 8px 0; color: #1f2937; }
.preview { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #111827; white-space: pre-wrap; }
.install-btn { background: #0ea5e9; color: white; text-decoration: none; padding: 8px 14px; border-radius: 6px; display: inline-block; font-size: 13px; font-weight: 600; margin-left: 8px; }
.copy-btn { background: #22c55e; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.help-text { font-size: 12px; color: #666; margin-top: 5px; }
.login-section { background: #f0f9ff; border: 2px solid #0ea5e9; border-radius: 8px; padding: 16px; margin-bottom: 22px; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.addon-card { background: white; border: 2px solid #e5e7eb; border-radius: 8px; padding: 12px; display: flex; align-items: center; gap: 10px; transition: all 0.2s; cursor: pointer; }
.addon-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.addon-card.wrappable { border-color: #10b981; }
.addon-card.not-wrappable { opacity: 0.6; cursor: not-allowed; }
.addon-card.already-wrapped { opacity: 1.0; cursor: pointer; background: #fffbeb; border-color: #f59e0b; }
.addon-card.already-wrapped.selected { background: #fef3c7; border-color: #d97706; }
.addon-card.selected { background: #dbeafe; border-color: #3b82f6; }
.addon-logo { width: 48px; height: 48px; object-fit: contain; background: #f3f4f6; border-radius: 6px; }
.addon-info { flex: 1; min-width: 0; }
.addon-name { font-weight: 600; font-size: 14px; color: #111827; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addon-status { font-size: 12px; color: #6b7280; display: flex; align-items: center; gap: 4px; }
.addon-card.not-wrappable .addon-status { color: #dc2626; font-weight: 500; }
.status-icon { font-size: 14px; }
.status-icon.wrappable { color: #10b981; }
.status-icon.not-wrappable { color: #ef4444; }
.addon-checkbox { width: 18px; height: 18px; cursor: pointer; }

/* Phase 1 & 2: Episode-Level Metadata Toggle & Individual Positioning Styles */
.metadata-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.metadata-main-control {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0; /* Allow text truncation */
}

.metadata-position-control {
  flex: 0 0 100px;
  display: flex;
  align-items: center;
}

.metadata-position-select {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.85em;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-family: inherit;
}

.metadata-position-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f3f4f6;
}

.metadata-position-select:not(:disabled):hover {
  border-color: #cbd5e1;
}

.metadata-position-select:not(:disabled):focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.metadata-episode-control {
  flex: 0 0 120px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.8;
  justify-content: flex-end;
}

.small-label {
  font-size: 0.85em;
  margin: 0;
  color: #6b7280;
  white-space: nowrap;
  font-weight: 500;
}

.episode-metadata-toggle {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.episode-metadata-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Metadata Box Layout - Individual boxes for each metadata option */
.metadata-box {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.metadata-box:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.metadata-box-header {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.metadata-toggle-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

.metadata-toggle-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metadata-toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.metadata-toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metadata-toggle-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}

.metadata-toggle-control label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin: 0;
  cursor: pointer;
}

.metadata-position-dropdown {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-family: inherit;
  margin-top: 2px;
}

.metadata-position-dropdown:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f3f4f6;
}

.metadata-position-dropdown:not(:disabled):hover {
  border-color: #cbd5e1;
}

.metadata-position-dropdown:not(:disabled):focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.metadata-extra-options {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  display: none;
}

.metadata-extra-options.visible {
  display: block;
}

.metadata-extra-options .form-group {
  margin-bottom: 12px;
}

.metadata-extra-options .form-group:last-child {
  margin-bottom: 0;
}

/* Responsive design for metadata boxes */
@media (max-width: 600px) {
  .metadata-toggle-section {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .metadata-toggle-column {
    padding-bottom: 8px;
  }

  .metadata-toggle-column:first-child {
    border-bottom: 1px solid #e5e7eb;
  }
}

/* Phase 3: Accordion Metadata Ordering */
.metadata-order-accordion {
  margin-bottom: 15px;
}

.accordion-header {
  cursor: pointer;
  background: #f3f4f6;
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  transition: background-color 0.2s;
}

.accordion-header:hover {
  background: #e5e7eb;
}

.accordion-content {
  padding: 10px 0;
}

/* Metadata order list styling */
.metadata-order-list {
  list-style: none;
  padding: 0;
  margin: 0;
  min-height: 40px;
  background: #f9fafb;
  border: 2px dashed #d1d5db;
  border-radius: 4px;
  padding: 8px;
}

.metadata-order-list:empty::after {
  content: 'Check metadata options above to add items';
  display: block;
  text-align: center;
  color: #9ca3af;
  font-style: italic;
  padding: 10px;
  font-size: 13px;
}

.metadata-order-item {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  transition: all 0.2s;
}

.metadata-order-item:hover {
  border-color: #4f46e5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metadata-order-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.order-actions {
  display: flex;
  gap: 4px;
}

.order-actions button {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.order-actions button:hover {
  background: #e5e7eb;
}

.order-actions button:active {
  background: #d1d5db;
}

/* Remove button styling */
.order-actions .remove-btn {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  font-weight: bold;
  margin-left: 4px;
}

.order-actions .remove-btn:hover {
  background: #fecaca;
  border-color: #f87171;
}

.order-actions .remove-btn:active {
  background: #fca5a5;
}

/* Metadata ordering section - enhanced visual separation */
#metadataOrderSection {
  margin-top: 40px;
  padding: 25px;
  background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid #4f46e5;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
}

#metadataOrderSection h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #4f46e5;
  font-size: 20px;
  font-weight: 700;
}

.ordering-instructions {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 4px;
  font-size: 14px;
  color: #1e40af;
}

.ordering-instructions strong {
  display: block;
  margin-bottom: 6px;
  color: #1e3a8a;
}
