/* ── Project Cards ── */
.dashboard-card--project {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.dashboard-card--project:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.project-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
}

.project-card-icon--prototyping { color: var(--color-primary); }
.project-card-icon--wearable { color: var(--color-accent); }
.project-card-icon--addon { color: var(--color-secondary); }
.project-card-icon--import { color: var(--color-text-muted); }
.project-card-icon--ai { color: #A855F7; }

.project-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.project-status--draft {
  background: rgba(100, 116, 139, 0.1);
  color: var(--color-text-muted);
}

.project-status--active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.project-status--archived {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.project-card-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.project-card-template {
  font-weight: 500;
}

/* ── Create Project Modal ── */
.create-project-modal {
  max-width: 744px;
  padding: 36px;
  min-height: 420px;
}

.create-modal-section {
  margin-bottom: 24px;
}

.create-modal-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 10px;
}

.create-modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition);
  outline: none;
  color: var(--color-text);
}

.create-modal-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.template-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  grid-auto-flow: column;
  gap: 10px;
}

.template-picker-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--color-text-muted);
  padding: 32px 20px;
}

.template-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}

.template-option:hover {
  border-color: var(--color-text-muted);
  background: var(--color-surface-alt);
}

.template-option--blank {
  border: none;
  background: transparent;
  cursor: default;
  padding: 0;
}

.template-option--blank:hover {
  border: none;
  background: transparent;
}

.template-option--selected {
  border-color: var(--color-primary);
  background: rgba(79, 70, 229, 0.04);
}

.template-option--selected:hover {
  border-color: var(--color-primary);
}

.template-option-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
}

.template-option-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.template-option-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.template-option-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.create-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

/* ── Project Detail ── */
.project-detail {
  padding-top: 20px;
  min-height: 0;
  background: var(--color-surface-alt);
}

.project-detail-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 80px 0;
  color: var(--color-text-muted);
}

.project-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.project-detail-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.project-detail-title {
  min-width: 0;
}

.project-detail-title h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 6px;
}

.editable-name {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background var(--transition);
}

.editable-name:hover {
  background: rgba(79, 70, 229, 0.06);
}

.editable-name-input {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
  font-family: var(--font-sans);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  width: 100%;
  outline: none;
  background: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.editable-desc {
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: -2px -6px 4px;
  transition: background var(--transition);
}

.editable-desc:hover {
  background: rgba(79, 70, 229, 0.06);
}

.editable-desc--empty {
  font-style: italic;
  opacity: 0.6;
}

.editable-desc-input {
  font-size: 0.95rem;
  color: var(--color-text);
  font-family: var(--font-sans);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  width: 100%;
  outline: none;
  background: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  line-height: 1.5;
  resize: vertical;
}

.project-detail-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
  white-space: nowrap;
}

.project-detail-template,
.project-detail-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}


.project-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-bottom: 48px;
}


.component-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.component-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
}

.project-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  gap: 12px;
}

.project-placeholder h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.project-placeholder p {
  font-size: 0.9rem;
  max-width: 320px;
}

.project-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.btn-danger {
  background: transparent;
  color: var(--color-error);
  border: 1px solid var(--color-error);
  transition: all var(--transition);
}

.btn-danger:hover {
  background: var(--color-error);
  color: white;
}

.delete-confirm {
  margin-top: 16px;
  padding: 16px 20px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
}

.delete-confirm p {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 12px;
}

.delete-confirm-actions {
  display: flex;
  gap: 10px;
}

/* ── Loading Spinner ── */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dashboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--color-text-muted);
  grid-column: 1 / -1;
}

/* ── Canvas Property Panel ── */
.canvas-property-panel {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(24, 24, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 160px;
  z-index: 10;
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  color: #ddd;
}

.property-panel-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.property-panel-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.property-panel-field label {
  width: 32px;
  flex-shrink: 0;
  color: #999;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.property-panel-field input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #fff;
  padding: 3px 6px;
  font-size: 0.8rem;
  font-family: var(--font-mono, monospace);
  outline: none;
  width: 80px;
}

.property-panel-field input:focus {
  border-color: #00cccc;
  box-shadow: 0 0 0 2px rgba(0, 204, 204, 0.15);
}

.property-panel-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 0;
}

.property-panel-delete {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.property-panel-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
}

/* ── Add Part Picker ── */
.add-part-wrapper {
  position: relative;
  display: inline-block;
}

.add-part-picker {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 280px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.add-part-search {
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: transparent;
  outline: none;
}

.add-part-search::placeholder {
  color: var(--color-text-muted);
}

.add-part-list {
  overflow-y: auto;
  max-height: 340px;
  padding: 4px 0;
}

.add-part-category {
  padding: 6px 12px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.add-part-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 12px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: background 0.1s;
}

.add-part-item:hover {
  background: var(--color-surface-alt);
}

.add-part-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}

.add-part-desc {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-part-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.add-part-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.9;
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 10001;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}

.toast--warning {
  background: #3a2a00;
  color: #fbbf24;
  border-left: 3px solid #f59e0b;
}

.toast--error {
  background: #3a0a0a;
  color: #f87171;
  border-left: 3px solid #ef4444;
}

.toast--removing {
  opacity: 0;
  transform: translateX(20px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
