/* Checkouts.ca Shopify-style Theme Customizer CSS */
:root {
  --admin-bg-dark: #121212;
  --admin-bg-sidebar: #181818;
  --admin-bg-card: #222222;
  --admin-bg-hover: #2a2a2a;
  --admin-border: #2e2e2e;
  --admin-text-main: #f0f0f0;
  --admin-text-muted: #999999;
  --admin-primary: #1b8a5a;
  --admin-primary-hover: #157347;
  --admin-red: #c91c1c;
  --admin-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.customizer-body {
  margin: 0;
  padding: 0;
  background-color: var(--admin-bg-dark);
  color: var(--admin-text-main);
  font-family: var(--admin-font);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 1. Topbar Navigation */
.customizer-topbar {
  height: 54px;
  background: #141414;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-sizing: border-box;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #bbb;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  background: #202020;
  border: 1px solid #333;
  transition: all 0.2s ease;
}

.topbar-exit-btn:hover {
  color: #fff;
  background: #2a2a2a;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: #333;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.brand-badge {
  background: #2c2c2c;
  color: #aaa;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.brand-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: #4ade80;
}

.topbar-hub-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 10px;
}

.hub-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #888;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.hub-nav-link:hover {
  color: #fff;
  background: #222222;
  border-color: #383838;
}

.hub-nav-link.active {
  color: #ffffff;
  background: #252525;
  border-color: #454545;
}

/* Viewport Switcher */
.viewport-switcher {
  display: flex;
  background: #202020;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #333;
}

.viewport-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #888;
  padding: 6px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewport-btn:hover {
  color: #eee;
}

.viewport-btn.active {
  background: #333;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Topbar Action Buttons */
.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-reset {
  background: #222;
  color: #aaa;
  border: 1px solid #383838;
}

.btn-reset:hover {
  color: #fff;
  background: #2a2a2a;
}

.btn-save {
  background: var(--admin-primary);
  color: #fff;
}

.btn-save:hover {
  background: var(--admin-primary-hover);
  transform: translateY(-1px);
}

.btn-set-default {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: 1px solid #b45309;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  transition: all 0.2s ease;
}

.btn-set-default:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

/* 2. Workspace Layout */
.customizer-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 54px);
  overflow: hidden;
}

/* 3. Left Sidebar */
.customizer-sidebar {
  width: 370px;
  min-width: 370px;
  max-width: 370px;
  background: var(--admin-bg-sidebar);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Sidebar Tab Headers */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--admin-border);
  background: #141414;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #888;
  padding: 12px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #ccc;
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--admin-red);
  background: rgba(201, 28, 28, 0.05);
}

/* Tab Panels */
.tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  box-sizing: border-box;
}

.tab-panel.active {
  display: block;
}

.panel-intro {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
}

.panel-intro h4 {
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-intro p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  line-height: 1.45;
}

/* Section Groups (Header Group vs Template Sections) */
.section-group-wrapper {
  margin-bottom: 12px;
  background: #141416;
  border: 1px solid #27272a;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.section-group-wrapper:hover {
  border-color: #3f3f46;
}

.section-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  background: #18181b;
  transition: background 0.15s ease;
}

.section-group-header:hover {
  background: #222226;
}

.section-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #f4f4f5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-group-badge {
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #a1a1aa;
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: normal;
}

.section-group-toggle-icon {
  font-size: 0.72rem;
  color: #a1a1aa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.15s ease, color 0.15s ease;
}

.section-group-header:hover .section-group-toggle-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.section-group-content {
  padding: 12px 14px 14px 14px;
  border-top: 1px solid #27272a;
  background: #101012;
}

/* Collapsed state (Mặc định ẩn) */
.section-group-wrapper.is-collapsed .section-group-content {
  display: none;
}

.section-group-wrapper.is-collapsed .section-group-toggle-icon {
  transform: rotate(-90deg);
}

.section-group-wrapper:not(.is-collapsed) .section-group-toggle-icon {
  transform: rotate(0deg);
}

.group-quick-toggle-btn {
  background: #27272a;
  color: #cbd5e1;
  border: 1px solid #3f3f46;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.group-quick-toggle-btn:hover {
  background: #3f3f46;
  color: #fff;
}

.static-sections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-row.static-row {
  cursor: pointer;
  border-left: 3px solid #555;
}

.section-row.static-row:hover {
  border-left-color: var(--admin-red);
}

/* Draggable Sections List */
.sections-draggable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--admin-bg-card);
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  padding: 10px 12px;
  transition: all 0.2s ease;
  user-select: none;
}

.section-row:hover {
  background: var(--admin-bg-hover);
  border-color: #444;
}

.section-row.dragging {
  opacity: 0.4;
  border: 1px dashed var(--admin-red);
}

.section-left-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}

.drag-grip {
  color: #666;
  font-size: 1.1rem;
  cursor: grab;
  line-height: 1;
}

.drag-grip:hover {
  color: #fff;
}

.section-icon {
  font-size: 1rem;
}

.section-title-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f5f5f5;
}

.section-right-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.row-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #777;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.row-tool-btn:hover {
  color: #fff;
  background: #333;
}

.row-tool-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.row-tool-btn.vis-active {
  color: #4ade80;
}

.row-tool-btn.btn-duplicate {
  color: #94a3b8;
  font-size: 0.75rem;
}

.row-tool-btn.btn-duplicate:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
}

.row-tool-btn.btn-delete {
  color: #f87171;
  font-size: 0.75rem;
}

.row-tool-btn.btn-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
}

.section-row.is-cloned-section {
  border-left: 3px solid #38bdf8;
  background: rgba(56, 189, 248, 0.03);
}

.section-row.is-cloned-section:hover {
  border-left-color: #0284c7;
  background: rgba(56, 189, 248, 0.08);
}

.section-row.is-cloned-section .section-title-text {
  color: #bae6fd;
}

.row-tool-btn.btn-edit-arrow {
  color: #aaa;
  font-weight: bold;
  padding: 4px 8px;
  background: #2a2a2a;
  border-radius: 4px;
}

.row-tool-btn.btn-edit-arrow:hover {
  background: var(--admin-red);
  color: #fff;
}

/* 4. Section Inspector Detail Panel */
.section-inspector-view {
  display: flex;
  flex-direction: column;
}

.inspector-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
}

.inspector-back-btn {
  background: transparent;
  border: none;
  color: #999;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inspector-back-btn:hover {
  color: #fff;
}

.inspector-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.inspector-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Settings Form Controls */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.settings-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ddd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-hint {
  font-size: 0.72rem;
  color: #777;
  line-height: 1.35;
}

.settings-input, .settings-select, .settings-textarea {
  width: 100%;
  background: #202020;
  border: 1px solid #383838;
  color: #fff;
  padding: 8px 10px;
  font-size: 0.82rem;
  border-radius: 5px;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.settings-input:focus, .settings-select:focus, .settings-textarea:focus {
  border-color: #777;
}

.settings-textarea {
  min-height: 70px;
  resize: vertical;
}

/* Image Upload & Preset Selector */
.image-selector-card {
  background: #202020;
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 12px;
}

.image-preview-thumb {
  width: 100%;
  height: 140px;
  border-radius: 4px;
  object-fit: cover;
  margin-bottom: 10px;
  border: 1px solid #444;
  display: block;
}

.image-upload-trigger-btn {
  width: 100%;
  background: #2d2d2d;
  border: 1px dashed #555;
  color: #eee;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.image-upload-trigger-btn:hover {
  background: #363636;
  border-color: var(--admin-red);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.preset-thumb {
  aspect-ratio: 16/9;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.preset-thumb:hover, .preset-thumb.active {
  border-color: var(--admin-red);
  transform: scale(1.04);
}

.preset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Color Palette Picker */
.color-palette-options {
  display: flex;
  gap: 10px;
}

.color-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}

.color-pill:hover, .color-pill.active {
  border-color: #fff;
  transform: scale(1.15);
}

/* 5. Right Preview Canvas */
.customizer-preview-canvas {
  flex: 1;
  background: #0a0a0a;
  background-image: radial-gradient(#1c1c1c 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 16px;
  box-sizing: border-box;
}

/* Device Wrapper Modes */
.preview-device-wrapper {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

/* Desktop Mode: Full width iframe */
.preview-device-wrapper.desktop-mode {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  border: 1px solid #222;
}

.preview-device-wrapper.desktop-mode .phone-frame-island {
  display: none;
}

.preview-device-wrapper.desktop-mode iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Mobile Mode: Smartphone Shell (390px x 844px) */
.preview-device-wrapper.mobile-mode {
  width: 390px;
  height: 844px;
  max-height: 94vh;
  border-radius: 46px;
  border: 12px solid #282828;
  box-shadow: 0 25px 80px rgba(0,0,0,0.9), 0 0 0 1px #3a3a3a;
  position: relative;
  overflow: hidden;
  background: #000;
}

.preview-device-wrapper.mobile-mode .phone-frame-island {
  display: block;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 24px;
  background: #181818;
  border-radius: 12px;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.preview-device-wrapper.mobile-mode iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* 6. Customizer Toast */
.customizer-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  border: 1px solid #444;
  border-left: 4px solid var(--admin-primary);
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.customizer-toast.active {
  transform: translateY(0);
  opacity: 1;
}

.color-picker-input {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: #18181b;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}

.color-picker-input::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.color-picker-input::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

/* Add New Section Modal & Trigger Styles */
.btn-create-section-trigger:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4) !important;
}

.add-section-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.add-section-card:hover {
  background: #202024;
  border-color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.2);
}

.add-sec-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #27272a;
  border-radius: 10px;
  flex-shrink: 0;
}

.add-sec-info {
  flex: 1;
  min-width: 0;
}

.add-sec-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 3px;
}

.add-sec-desc {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.35;
}

.add-sec-btn {
  background: #0284c7;
  color: #ffffff;
  border: 1px solid #38bdf8;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.add-section-card:hover .add-sec-btn {
  background: #0369a1;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

