/* =================================================
   ADMIN MODE — Base Layout & Legibility
   ================================================= */

body.admin-active #admin-mode {
  background: #f8fafc;
  color: #1f2937;
  padding: 24px;
}

/* Headings */

body.admin-active #admin-mode h1 {
  color: #0f172a;
  font-size: 24px;
  margin-bottom: 16px;
}

/* =================================================
   ADMIN MODE — Toolbar (Search + Add Market)
   ================================================= */

body.admin-active .admin-market-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* Search input */

body.admin-active #admin-mode input[type="text"] {
  width: 100%;
  max-width: 420px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f172a;
  background: #ffffff;
}

/* =================================================
   ADMIN — Add Market Button
   ================================================= */

body.admin-active #admin-add-market-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #4f46e5;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

body.admin-active #admin-add-market-btn:hover {
  background: #4338ca;
}

/* =================================================
   ADMIN MODE — Market Selection Table
   ================================================= */

body.admin-active #market-table-wrapper {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow-y: auto;
}

body.admin-active #market-table {
  width: 100%;
  border-collapse: collapse;
}

body.admin-active #market-table thead {
  background: #e5e7eb;
}

body.admin-active #market-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  padding: 10px 12px;
  border-bottom: 1px solid #cbd5e1;
}

body.admin-active #market-table td {
  font-size: 14px;
  padding: 10px 12px;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
}

body.admin-active #market-table tbody tr:hover {
  background: #f1f5f9;
  cursor: pointer;
}

body.admin-active #market-table tbody tr.selected {
  background: #dbeafe;
}

/* Actions column (edit + delete buttons) */

body.admin-active #market-table th.actions-col,
body.admin-active #market-table td.actions-col {
  width: 100px;
  text-align: right;
  padding: 10px 12px;
  white-space: nowrap;
}

body.admin-active .market-edit-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 6px;
}

body.admin-active .market-edit-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

body.admin-active .market-delete-btn {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #dc2626;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.admin-active .market-delete-btn:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

/* Edit mode row */

body.admin-active #market-table tbody tr.editing {
  background: #fffbeb;
}

body.admin-active #market-table tbody tr.editing:hover {
  background: #fffbeb;
}

body.admin-active .edit-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #2563eb;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
}

body.admin-active .edit-input:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

body.admin-active .actions-col-editing {
  width: 140px;
}

body.admin-active .market-save-btn {
  background: #22c55e;
  border: none;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-right: 6px;
}

body.admin-active .market-save-btn:hover {
  background: #16a34a;
}

body.admin-active .market-cancel-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.admin-active .market-cancel-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

/* =================================================
   ADMIN MODE — Primary Action Button
   ================================================= */

body.admin-active #admin-continue-btn {
  padding: 10px 18px;
  font-size: 14px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

body.admin-active #admin-continue-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* =================================================
   ADMIN MODE — Asset Categories (Left Pane)
   ================================================= */

body.admin-active #asset-category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

body.admin-active #asset-category-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #ffffff;
}

body.admin-active #asset-category-list li:hover {
  background: #f1f5f9;
}

body.admin-active #asset-category-list li.selected {
  border-color: #2563eb;
  background: #eff6ff;
}

/* =================================================
   ADMIN MODE — Asset Indicators
   ================================================= */

body.admin-active .asset-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475467;
  font-size: 14px;
  white-space: nowrap;
}

body.admin-active .asset-indicator .asset-icon {
  font-size: 18px;
  line-height: 1;
}

body.admin-active .asset-indicator .asset-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =================================================
   ADMIN MODE — Asset Detail Pane
   ================================================= */

body.admin-active .asset-detail-placeholder {
  color: #64748b;
  font-size: 14px;
}

/* =================================================
   ADMIN MODE — Asset Viewer Container
   ================================================= */

body.admin-active .asset-viewer-container {
  margin-top: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

body.admin-active .asset-viewer-container h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  color: #0f172a;
}

/* Thumbnail previews */

body.admin-active .asset-thumbnail {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #ffffff;
}

/* =================================================
   ADMIN MODE — Asset Viewer (File List)
   ================================================= */

body.admin-active .asset-viewer {
  border-top: 1px solid #e5e7eb;
}

body.admin-active .asset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid #e5e7eb;
}

body.admin-active .asset-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.admin-active .asset-filename {
  font-size: 14px;
  color: #0f172a;
}

/* =================================================
   ADMIN MODE — Asset Delete Action
   ================================================= */

body.admin-active .asset-delete-btn {
  background: transparent;
  border: none;
  color: #dc2626;
  font-size: 13px;
  cursor: pointer;
}

body.admin-active .asset-delete-btn:hover {
  text-decoration: underline;
}

/* =================================================
   ADMIN MODE — Upload Controls
   ================================================= */

body.admin-active .asset-viewer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.admin-active .asset-viewer-actions input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.admin-active .asset-file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

body.admin-active .asset-file-label:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

body.admin-active .asset-upload-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

body.admin-active .asset-upload-btn:hover {
  background: #1d4ed8;
}

body.admin-active .asset-upload-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

body.admin-active .asset-upload-status {
  font-size: 13px;
  color: #475467;
  margin-left: 4px;
}

/* =================================================
   ADMIN MODE — Loading Overlay (Spinner)
   ================================================= */

body.admin-active .loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

body.admin-active .loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

body.admin-active .loading-text {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
}

/* =================================================
   ADMIN MODE — Confirmation Dialog
   ================================================= */

body.admin-active .confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

body.admin-active .confirm-dialog {
  background: #ffffff;
  border-radius: 8px;
  padding: 24px;
  min-width: 320px;
  max-width: 400px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.admin-active .confirm-dialog p {
  margin: 0 0 20px 0;
  font-size: 16px;
  color: #0f172a;
  text-align: center;
}

body.admin-active .confirm-dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

body.admin-active .confirm-btn-delete {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

body.admin-active .confirm-btn-delete:hover {
  background: #b91c1c;
}

body.admin-active .confirm-btn-cancel {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

body.admin-active .confirm-btn-cancel:hover {
  background: #e2e8f0;
}

/* =================================================
   IMPORTANT — Preserve Main Layout
   ================================================= */

body:not(.admin-active) #user-mode {
  display: contents;
}
