/* ==========================================================================
   Admin Dashboard & Markdown Editor Styles (Professional Minimal)
   ========================================================================== */

.admin-wrapper {
  padding: 2.5rem 0 4.5rem;
  min-height: calc(100vh - var(--header-height) - 80px);
}

.admin-login-card {
  max-width: 400px;
  margin: 3.5rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.admin-login-header h2 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.admin-login-header p {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Layout */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.admin-nav {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.admin-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  width: 100%;
}

.admin-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-highlight);
}

.admin-nav-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 600;
}

/* Stats */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.admin-stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #090a0f;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary-light);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

/* Admin Table */
.admin-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
}

.admin-table th {
  background: rgba(255, 255, 255, 0.02);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
}

/* Split Markdown Editor & Toolbar */
.editor-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.editor-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  border-radius: 0;
  border: none;
  background: #090a0f;
  height: 100vh;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: #10121a;
  border-bottom: 1px solid #1e2233;
}

.editor-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.editor-tool-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  user-select: none;
}

.editor-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.editor-tool-btn.active {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.4);
}

.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 480px;
  flex: 1;
}

.editor-container.mode-editor-only .editor-split {
  grid-template-columns: 1fr;
}
.editor-container.mode-editor-only .editor-preview {
  display: none;
}

.editor-container.mode-preview-only .editor-split {
  grid-template-columns: 1fr;
}
.editor-container.mode-preview-only .editor-textarea {
  display: none;
}

.editor-textarea {
  width: 100%;
  height: 100%;
  padding: 1.25rem;
  background: #08090d;
  color: #f1f5f9;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  border: none;
  border-right: 1px solid #1e2233;
  outline: none;
  resize: none;
}

.editor-textarea:focus {
  background: #06070a;
}

.editor-preview {
  padding: 1.5rem 2rem;
  background: #0d0f17;
  overflow-y: auto;
  min-height: 480px;
  max-height: 720px;
}

.editor-container.fullscreen .editor-preview,
.editor-container.fullscreen .editor-textarea {
  max-height: calc(100vh - 90px);
}

.editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  background: #0b0c12;
  border-top: 1px solid #1a1d2b;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Wiki Tree Items */
.wiki-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.8125rem;
  gap: 0.5rem;
}

.wiki-tree-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.wiki-tree-item.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #ffffff;
  font-weight: 600;
}

.wiki-tree-order-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
}

.wiki-tree-order-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* ==========================================================================
   Assemblage Visual Builder Styles (Figma/Webflow style)
   ========================================================================== */

.assemblage-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #111422;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
}

.builder-mode-tabs {
  display: inline-flex;
  background: #090b12;
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.builder-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.builder-mode-btn.active {
  background: #1e2238;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.section-card-item {
  position: relative;
  transition: all var(--transition-fast);
  border-radius: var(--radius-xl);
  background: #121524;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.section-card-item:hover {
  border-color: rgba(139, 92, 246, 0.4) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.section-card-item.section-hidden {
  opacity: 0.55;
  background: #0d0f18;
}

.section-card-item.dragging {
  opacity: 0.4;
  border: 2px dashed var(--primary);
}

/* iOS-style toggle switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #272c42;
  transition: .3s;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ios-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.ios-switch input:checked + .ios-slider {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(27, 217, 106, 0.4);
}

.ios-switch input:checked + .ios-slider:before {
  transform: translateX(20px);
}

/* Template Picker Cards */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.template-card {
  background: #141728;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.template-card:hover {
  background: #1a1e34;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.25);
}

.template-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.btn-order-move:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.2) !important;
  color: #c4b5fd !important;
  border-color: rgba(139, 92, 246, 0.4) !important;
}

.btn-order-move:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Visual Studio Fullscreen Modal */
.visual-studio-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 9, 15, 0.88);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.visual-studio-modal {
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  background: #0f121e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visual-studio-body {
  display: grid;
  grid-template-columns: 460px 1fr;
  flex: 1;
  min-height: 0;
}

.visual-studio-sidebar {
  padding: 1.75rem;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: #121526;
}

.visual-studio-canvas {
  padding: 2rem;
  overflow-y: auto;
  background: #090b13;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-frame {
  width: 100%;
  max-width: 680px;
  background: #0d0f17;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: max-width 0.3s ease;
}

.canvas-frame.mobile-mode {
  max-width: 375px;
}

@media (max-width: 1000px) {
  .visual-studio-body { grid-template-columns: 1fr; }
  .visual-studio-sidebar { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); }
}

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .editor-split { grid-template-columns: 1fr; }
  .assemblage-split-grid { grid-template-columns: 1fr !important; }
}


/* ==========================================================================
   Live Browser Preview Window & Category Navigation
   ========================================================================== */

.live-preview-window {
  background: #0d0f19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
  transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.live-browser-topbar {
  background: #141728;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.browser-dot.red { background: #f43f5e; }
.browser-dot.yellow { background: #f59e0b; }
.browser-dot.green { background: #10b981; }

.live-browser-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.browser-nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.browser-nav-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.browser-nav-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.live-browser-url {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.3rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.live-preview-viewport {
  background: var(--bg-body);
  min-height: 540px;
  max-height: 800px;
  overflow-y: auto;
  position: relative;
}
