/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #F5F5F5;
  color: #333;
  min-width: 1280px;
}
a { color: #8B0000; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Colors ===== */
:root {
  --primary: #8B0000;
  --primary-light: #FFF8F6;
  --primary-dark: #5C0000;
  --border: #E8E4DA;
  --bg: #F5F5F5;
  --card-bg: #FFFFFF;
  --text: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
}

/* ===== Layout ===== */
.page-center {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ===== Navbar ===== */
.navbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.navbar-user {
  font-size: 14px;
  color: var(--text-secondary);
}
.navbar-link {
  font-size: 14px;
  cursor: pointer;
}

/* ===== Login ===== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #FFF8F6 0%, #F5F5F5 100%);
}
.login-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.login-input {
  width: 100%;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 4px;
}
.login-input:focus { border-color: var(--primary); }
.login-error {
  color: #CC0000;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #CCC; cursor: not-allowed; }
.btn-secondary {
  background: #FFFFFF;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #F9F9F9; }
.btn-danger {
  background: #FFF5F5;
  color: #CC0000;
  border: 1px solid #FFDDDD;
}
.btn-danger:hover { background: #FFEEEE; }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; border-radius: 8px; }

/* ===== Dashboard ===== */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 24px;
}
.dashboard-title {
  font-size: 22px;
  font-weight: 700;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding-bottom: 48px;
}
.template-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
  cursor: pointer;
}
.template-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.card-thumb {
  height: 180px;
  background: #E8E4DA;
  overflow: hidden;
  position: relative;
}
.card-thumb img { width: 100%; height: 100%; object-fit: contain; background-color: #f5f5f5; }
.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.card-badge.published { background: #E8F5E9; color: #2E7D32; }
.card-badge.draft { background: #FFF3E0; color: #E65100; }
.card-body {
  padding: 16px;
}
.card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.card-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.card-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
}
.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-text { font-size: 16px; }

/* ===== Editor Layout ===== */
.editor-wrapper {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}
.editor-left {
  flex: 7;
  display: flex;
  flex-direction: column;
  background: #E0E0E0;
  position: relative;
  min-width: 0;
}
.editor-right {
  flex: 3;
  min-width: 360px;
  max-width: 420px;
  background: #FFFFFF;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Editor Steps ===== */
.step-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #FAFAFA;
}
.step-tab {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.step-tab:hover { color: var(--text); }
.step-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.step-tab.done { color: #2E7D32; }

/* ===== Editor Panel ===== */
.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.panel-section {
  margin-bottom: 24px;
}
.panel-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.panel-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.panel-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}
.panel-input:focus { border-color: var(--primary); }
.panel-textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  resize: vertical;
}

/* ===== Pill Select ===== */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
}

/* ===== Upload Area ===== */
.upload-box {
  border: 2px dashed #CCC;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #FAFAFA;
  position: relative;
  overflow: hidden;
}
.upload-box:hover { border-color: var(--primary); }
.upload-box.has-image { padding: 0; border-style: solid; }
.upload-box img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
}
.upload-icon { font-size: 32px; color: #CCC; }
.upload-label { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* ===== Canvas Toolbar ===== */
.canvas-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  gap: 4px;
  flex-shrink: 0;
}
.tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  transition: all 0.15s;
}
.tool-btn:hover { background: #F5F5F5; }
.tool-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.tool-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 8px;
}
.zoom-label {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 48px;
  text-align: center;
}

/* ===== Canvas Area ===== */
.canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}
.canvas-wrap.tool-select { cursor: default; }
.canvas-wrap.tool-pan { cursor: grab; }
.canvas-wrap.tool-pan.dragging { cursor: grabbing; }
#mainCanvas {
  position: absolute;
  top: 0;
  left: 0;
}

/* ===== Annotation List ===== */
.ann-list { }
.ann-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.ann-item:hover { border-color: #CCC; }
.ann-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.ann-index {
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  background: #F0F0F0;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-right: 10px;
}
.ann-item.selected .ann-index {
  background: var(--primary);
  color: #FFFFFF;
}
.ann-name {
  flex: 1;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ann-type-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #F0F0F0;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 8px;
}

/* ===== Annotation Edit ===== */
.ann-edit {
  padding: 16px;
  background: #FAFAFA;
  border-radius: 8px;
  margin-top: 12px;
}
.ann-edit-row {
  margin-bottom: 12px;
}
.ann-edit-row:last-child { margin-bottom: 0; }

/* ===== Color Scheme Editor ===== */
.color-scheme {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.color-scheme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.color-scheme-name {
  font-size: 14px;
  font-weight: 600;
}
.color-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}
.color-row:last-child { margin-bottom: 0; }
.color-label {
  font-size: 13px;
  color: var(--text-secondary);
  width: 56px;
  flex-shrink: 0;
}
.color-picker {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  background: none;
}
.color-hex {
  width: 90px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  font-family: monospace;
}
.color-preview-bar {
  flex: 1;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ===== Asset Upload ===== */
.asset-region {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.asset-region-header {
  padding: 12px 16px;
  background: #FAFAFA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.asset-region-name { font-size: 14px; font-weight: 500; }
.asset-region-type { font-size: 12px; color: var(--text-muted); }
.asset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}
.asset-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.asset-thumb img { width: 100%; height: 100%; object-fit: contain; background-color: #f5f5f5; }
.asset-thumb .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: #FFF;
  border-radius: 50%;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  display: none;
}
.asset-thumb:hover .remove-btn { display: block; }
.asset-add-btn {
  width: 80px;
  height: 80px;
  border: 2px dashed #CCC;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #CCC;
  cursor: pointer;
}
.asset-add-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Publish Summary ===== */
.publish-summary {
  background: #FAFAFA;
  border-radius: 10px;
  padding: 20px;
}
.summary-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #F0F0F0;
}
.summary-row:last-child { border-bottom: none; }
.summary-label {
  width: 100px;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.summary-value {
  font-size: 14px;
  flex: 1;
}
.summary-colors {
  display: flex;
  gap: 4px;
}
.summary-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ===== Panel Footer ===== */
.panel-footer {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: #FFFFFF;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 32px;
  width: 420px;
  max-width: 90vw;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===== Loading & Error States ===== */
.loading-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}
.error-state {
  text-align: center;
  padding: 24px;
  color: #CC0000;
  background: #FFF5F5;
  border: 1px solid #FFDDDD;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
