/* Suppress unwanted simple-mind-map client trial popup */
.el-message-box__wrapper, .v-modal {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ProcessMind Workspace Style - Mind Map & Flowchart Dual Engine */
:root {
  --pm-primary: #2563eb;
  --pm-primary-hover: #1d4ed8;
  --pm-success: #059669;
  --pm-warning: #d97706;
  --pm-danger: #dc2626;
  --pm-bg-header: #ffffff;
  --pm-border-color: #e5e7eb;
  --pm-text-main: #1f2937;
  --pm-text-muted: #6b7280;
}

* {
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--pm-text-main);
  background-color: #f8fafc;
}

/* Header */
#pm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--pm-bg-header);
  border-bottom: 1px solid var(--pm-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pm-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pm-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pm-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.pm-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  letter-spacing: -0.3px;
}

.pm-brand-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.pm-brand-tag.tag-mindmap {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.pm-brand-tag.tag-flowchart {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.pm-divider {
  width: 1px;
  height: 22px;
  background-color: #e5e7eb;
}

/* Engine Mode Switcher */
.pm-mode-switcher {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  white-space: nowrap;
}

.pm-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
}

.pm-mode-btn svg {
  flex-shrink: 0;
}

.pm-mode-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.pm-mode-btn.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Title Box */
.pm-doc-title-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.pm-doc-title-box:hover {
  background: #f3f4f6;
}

.pm-doc-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-doc-pen {
  color: #9ca3af;
}

.pm-title-input {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid #3b82f6;
  border-radius: 4px;
  outline: none;
  width: 200px;
}

/* Save Status Indicator */
.pm-save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  user-select: none;
}

.pm-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: background 0.2s ease;
}

.pm-status-dot.saved {
  background-color: var(--pm-success);
}

.pm-status-dot.dirty {
  background-color: var(--pm-warning);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
}

.pm-status-dot.saving {
  background-color: var(--pm-primary);
  animation: pmPulse 1s infinite;
}

@keyframes pmPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Storage Status Widget in Header */
.pm-storage-widget {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 11px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.pm-storage-widget:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.pm-storage-widget.is-full {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
  animation: pmDangerPulse 2s infinite ease-in-out;
}

@keyframes pmDangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2); }
}

.pm-storage-text-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pm-storage-label {
  font-weight: 600;
  line-height: 1;
}

.pm-storage-bar-mini {
  width: 75px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.pm-storage-bar-mini-inner {
  height: 100%;
  background: #3b82f6;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.pm-storage-widget.is-full .pm-storage-bar-mini-inner {
  background: #ef4444;
}

/* Buttons */
.pm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  background: transparent;
}

.pm-btn-default {
  background: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}

.pm-btn-default:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.pm-btn-primary {
  background: var(--pm-primary);
  color: #ffffff;
}

.pm-btn-primary:hover {
  background: var(--pm-primary-hover);
}

.pm-btn-success {
  background: var(--pm-success);
  color: #ffffff;
}

.pm-btn-success:hover {
  background: #047857;
}

/* Manual Save Button */
.pm-btn-save {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 600;
}

.pm-btn-save:hover {
  background: #e2e8f0;
}

.pm-btn-save.is-dirty {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.pm-btn-save.is-dirty:hover {
  background: #1d4ed8;
}

.pm-kbd-hint {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.08);
  font-family: monospace;
}

.pm-btn-save.is-dirty .pm-kbd-hint {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.pm-btn-icon {
  width: 32px;
  padding: 0;
  justify-content: center;
  color: #6b7280;
  border-color: #e5e7eb;
}

.pm-btn-icon:hover {
  background: #f3f4f6;
  color: #111827;
}

.pm-btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 5px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  cursor: pointer;
  font-weight: 500;
}

.pm-btn-sm:hover {
  background: #f9fafb;
}

/* Dropdown */
.pm-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.pm-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 170px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  padding: 4px;
}

.pm-dropdown-menu.show {
  display: block;
}

.pm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #374151;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.pm-dropdown-item:hover {
  background: #f3f4f6;
  color: #111827;
}

.pm-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

/* Workspaces */
#mindmap-workspace {
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

#flowchart-workspace {
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: #ffffff;
}

#flowchart-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Modals */
.pm-modal-mask {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.pm-modal-mask.show {
  display: flex;
}

.pm-modal-card {
  background: #ffffff;
  width: 90%;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pmModalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pmModalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.pm-modal-header {
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}

.pm-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pm-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
}

.pm-modal-close:hover {
  color: #374151;
  background: #e5e7eb;
}

.pm-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Storage Banner in My Docs */
.pm-storage-banner {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.pm-storage-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pm-storage-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1e293b;
}

.pm-storage-tag {
  font-size: 11px;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 10px;
}

.pm-storage-progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.pm-storage-progress-inner {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.pm-storage-banner-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

/* Toolbar in My Docs */
.pm-docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pm-filter-tabs {
  display: flex;
  gap: 6px;
}

.pm-filter-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.pm-filter-btn:hover {
  border-color: #cbd5e1;
}

.pm-filter-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 600;
}

.pm-docs-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pm-search-input {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  width: 220px;
}

.pm-search-input:focus {
  border-color: #3b82f6;
}

/* Docs List Cards */
.pm-docs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.pm-doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.pm-doc-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.pm-doc-card.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.pm-doc-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.pm-doc-icon {
  font-size: 20px;
}

.pm-doc-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pm-doc-meta-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-doc-meta-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #6b7280;
}

.pm-type-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.pm-type-badge.mindmap {
  background: #dbeafe;
  color: #1d4ed8;
}

.pm-type-badge.flowchart {
  background: #d1fae5;
  color: #047857;
}

.pm-size-badge {
  font-family: monospace;
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
}

.pm-doc-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Full Storage Warning Modal */
.pm-card-warning {
  border: 2px solid #f87171;
  max-width: 540px;
  box-shadow: 0 25px 50px -12px rgba(220, 38, 38, 0.25);
}

.pm-alert-banner {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid #fecaca;
}

.pm-alert-icon {
  font-size: 32px;
  line-height: 1;
}

.pm-alert-header h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  color: #991b1b;
}

.pm-alert-header p {
  margin: 0;
  font-size: 13px;
  color: #b91c1c;
  line-height: 1.4;
}

.pm-alert-body {
  padding: 20px;
}

.pm-alert-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.pm-alert-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
  color: #334155;
}

.pm-alert-detail-row:last-child {
  margin-bottom: 0;
}

.pm-alert-tip {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin: 0;
}

.pm-alert-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Templates Grid */
.pm-tmpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.pm-tmpl-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
}

.pm-tmpl-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.pm-tmpl-title {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.pm-tmpl-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 10px;
}

.pm-tmpl-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pm-tmpl-tag {
  font-size: 11px;
  background: #f3f4f6;
  color: #4b5563;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Shortcuts Table */
.pm-key-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pm-key-table th, .pm-key-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.pm-key-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #4b5563;
}

kbd {
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  color: #374151;
  display: inline-block;
  font-size: 11px;
  font-family: monospace;
  font-weight: 600;
  line-height: 1;
  padding: 3px 6px;
  margin: 0 2px;
}

/* Toast */
#pm-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

#pm-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#mindmap-workspace.hidden-workspace {
  position: fixed !important;
  top: -99999px !important;
  left: -99999px !important;
  width: 100% !important;
  height: calc(100% - 48px) !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -10 !important;
  opacity: 0 !important;
}
