/* Grid & Cards */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.card:hover {
  border-color: var(--border-highlight);
  box-shadow: var(--card-shadow-hover);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.05) 100%), var(--bg-card);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, rgba(96, 205, 255, 0.18), rgba(96, 205, 255, 0.04));
  color: var(--color-accent);
  border: 1px solid rgba(96, 205, 255, 0.22);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(96, 205, 255, 0.12);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card:hover .stat-icon {
  transform: scale(1.08) translateY(-1px);
}

.stat-info .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.15;
  letter-spacing: -0.4px;
  font-feature-settings: "tnum";
}

.stat-info .stat-label {
  font-size: 11.5px;
  color: var(--color-text-secondary);
  margin-top: 3px;
  font-weight: 500;
}

/* Section Header & Toolbar */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

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

/* Category Filter Tags (Action Pills) */
.category-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 6px 0;
  margin-bottom: 14px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: var(--radius-xs);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  border-bottom: 1px solid var(--btn-secondary-border-bottom);
  color: var(--color-text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.filter-tag:hover {
  background: var(--btn-secondary-hover);
  color: var(--color-text-primary);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.filter-tag:active {
  transform: scale(0.96);
}

.filter-tag.active {
  background: var(--bg-active);
  color: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(96, 205, 255, 0.2);
  font-weight: 600;
}

/* View Switcher Button */
.soft-view-btn {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s ease;
}

.soft-view-btn:hover {
  color: var(--color-text-primary);
}

.soft-view-btn.active {
  background: var(--color-accent);
  color: #111;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Data Tables */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 9px 14px;
  font-size: 12.5px;
}

th {
  background: var(--bg-card-header);
  color: var(--color-text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 11.5px;
  letter-spacing: 0.2px;
  text-transform: none;
}

td {
  border-bottom: 1px solid var(--border-subtle);
  color: var(--color-text-primary);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:hover {
  background: var(--bg-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  font-family: inherit;
  user-select: none;
  border: 1px solid transparent;
  line-height: 1.35;
  height: 30px;
  box-sizing: border-box;
}

.btn-primary {
  background: var(--color-accent-gradient);
  color: #111111;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px var(--color-accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1084e3 0%, #7adbff 100%);
  box-shadow: 0 4px 14px rgba(96, 205, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.97) translateY(0);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  border-bottom: 1px solid var(--btn-secondary-border-bottom);
  color: var(--color-text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.97) translateY(0);
}

.btn-danger {
  background: rgba(255, 77, 79, 0.12);
  color: #ff7875;
  border: 1px solid rgba(255, 77, 79, 0.28);
}

.btn-danger:hover {
  background: #ff4d4f;
  color: #ffffff;
  border-color: #ff4d4f;
  box-shadow: 0 3px 10px rgba(255, 77, 79, 0.35);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: scale(0.97) translateY(0);
}

.btn-danger-ghost {
  background: transparent;
  color: #ff4d4f;
  border: 1px solid rgba(255, 77, 79, 0.22);
}

.btn-danger-ghost:hover {
  background: #ff4d4f;
  color: #ffffff;
  border-color: #ff4d4f;
  box-shadow: 0 2px 8px rgba(255, 77, 79, 0.35);
  transform: translateY(-1px);
}

.btn-danger-ghost:active {
  transform: scale(0.97) translateY(0);
}

.btn-sm {
  padding: 3px 9px;
  font-size: 11.5px;
  height: 25px;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-xs);
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 6px;
  letter-spacing: 0.1px;
}

.form-control {
  width: 100%;
  height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--color-text-primary);
  font-size: 12.5px;
  font-family: inherit;
  transition: all 0.14s ease;
  box-sizing: border-box;
  box-shadow: var(--input-shadow, inset 0 1px 2px rgba(0, 0, 0, 0.1));
}

.form-control:focus {
  outline: none;
  border-color: var(--input-focus-border);
  background: var(--input-bg-focus, var(--input-bg));
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

textarea.form-control {
  height: auto;
  min-height: 76px;
  resize: vertical;
  line-height: 1.5;
  padding: 8px 10px;
}

.search-input-wrap {
  position: relative;
  width: 230px;
}

.search-input-wrap input {
  padding-left: 30px;
  height: 30px;
  font-size: 12px;
}

.search-input-wrap svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.badge-blue { background: rgba(96, 205, 255, 0.12); color: #60cdff; border: 1px solid rgba(96, 205, 255, 0.25); }
.badge-green { background: rgba(82, 196, 26, 0.12); color: #52c41a; border: 1px solid rgba(82, 196, 26, 0.25); }
.badge-orange { background: rgba(250, 173, 20, 0.12); color: #faad14; border: 1px solid rgba(250, 173, 20, 0.25); }
.badge-purple { background: rgba(179, 127, 235, 0.12); color: #b37feb; border: 1px solid rgba(179, 127, 235, 0.25); }

/* Code Snippets & Monospace Tags */
code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-accent);
  border: 1px solid var(--border-color);
  user-select: all;
  letter-spacing: 0.1px;
  display: inline-block;
  vertical-align: middle;
}

[data-theme="light"] code {
  background: #f0f4f8;
  color: #0066b8;
  border: 1px solid #d0dbe5;
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
  animation: modalFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
  animation: modalScaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 14px 20px;
  background: var(--bg-card-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.12s;
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-card-header);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleUp {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Empty State */
.empty-state {
  padding: 40px 14px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12px;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  stroke: var(--color-text-muted);
}

.user-data-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.user-data-summary > div,
.user-data-section,
.user-data-settings > div {
  border: 1px solid var(--border-color);
  background: var(--bg-card-nested);
  border-radius: var(--radius-sm);
}

.user-data-summary > div {
  padding: 10px 12px;
}

.user-data-summary span,
.user-data-settings span {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.user-data-summary strong,
.user-data-settings strong {
  color: var(--color-text-primary);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.user-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-data-section {
  padding: 12px;
  min-width: 0;
}

.user-data-section h4 {
  color: var(--color-text-primary);
  font-size: 13px;
  margin-bottom: 9px;
}

.user-data-section h4 small {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 400;
  margin-left: 5px;
}

.user-data-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.user-data-settings > div {
  padding: 8px 10px;
}

.user-data-settings .user-data-wide {
  grid-column: 1 / -1;
}

.user-data-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
}

.user-data-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(90px, 0.8fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
}

.user-data-row:last-child {
  border-bottom: none;
}

.user-data-row strong {
  color: var(--color-text-primary);
  overflow-wrap: anywhere;
}

.user-data-row span {
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.user-data-row a {
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
}

.user-data-row a:hover {
  text-decoration: underline;
}

.user-data-empty {
  color: var(--color-text-muted);
  font-size: 11.5px;
  padding: 14px 4px 5px;
}

.migration-destination-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card-nested);
}

.migration-destination-panel .form-group {
  min-width: 0;
}

.migration-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.migration-parser-card,
.migration-backup-card {
  min-width: 0;
}

.migration-parser-card .table-container {
  width: 100%;
}

.migration-parser-card table {
  table-layout: fixed;
}

.migration-parser-card th:nth-child(1),
.migration-parser-card td:nth-child(1) {
  width: 7%;
}

.migration-parser-card th:nth-child(2),
.migration-parser-card td:nth-child(2) {
  width: 27%;
}

.migration-parser-card th:nth-child(3),
.migration-parser-card td:nth-child(3) {
  width: 23%;
}

.migration-parser-card th:nth-child(4),
.migration-parser-card td:nth-child(4) {
  width: 43%;
}

.migration-parser-card td strong,
.migration-parser-card td code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.migration-parser-card td code {
  max-width: 100%;
}

@media (max-width: 760px) {
  .migration-destination-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .user-data-summary,
  .user-data-grid {
    grid-template-columns: 1fr;
  }
}

/* Drag and Drop Styling */
.draggable-plate,
.draggable-item {
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.draggable-plate.dragging,
.draggable-item.dragging {
  opacity: 0.4;
  transform: scale(0.985);
  border: 1px dashed var(--color-accent) !important;
  box-shadow: 0 0 16px var(--color-accent-glow) !important;
}

.draggable-plate.drag-over,
.draggable-item.drag-over {
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 12px var(--color-accent-glow) !important;
  transform: translateY(-2px);
}

.drag-grip {
  cursor: grab;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 5px;
  border-radius: var(--radius-xs);
  transition: all 0.12s;
  user-select: none;
}

.drag-grip:hover {
  color: var(--color-text-primary);
  background: var(--bg-hover);
}

.drag-grip:active {
  cursor: grabbing;
}
