/* Auth + Dashboard zusätzliche Styles */

/* ============ AUTH SCREEN ============ */

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  background: var(--bg);
  z-index: 50;
}

.auth-side {
  flex: 1;
  background: linear-gradient(135deg, #1c1917 0%, #2a2520 50%, #1c1917 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 48px;
  color: white;
}

.auth-side::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.4) 0%, transparent 70%);
  pointer-events: none;
}
.auth-side::after {
  content: '';
  position: absolute;
  bottom: -200px; left: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(8,145,178,0.3) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  position: relative;
  z-index: 1;
}

.auth-brand .topbar-logo {
  height: 34px;
  filter: brightness(0) invert(1);
}

.auth-hero {
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.auth-hero h1 {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 16px;
}

.auth-hero p {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(255,255,255,0.7);
  max-width: 460px;
  margin: 0 0 32px;
}

.auth-phase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 460px;
}

.auth-phase-tile {
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.auth-phase-tile-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 13px;
}
.auth-phase-tile-dot {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
}
.auth-phase-tile-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
}

.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
}

.auth-form {
  width: 100%;
  max-width: 380px;
}

.auth-form h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.auth-form-sub {
  color: var(--text-soft);
  margin: 0 0 28px;
  font-size: 14px;
}

.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.auth-field input {
  width: 100%;
  padding: 11px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
}
.auth-field input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.auth-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.auth-submit {
  width: 100%;
  padding: 11px;
  background: var(--text);
  color: white;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-top: 6px;
}
.auth-submit:hover { background: #000; }

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-soft);
}
.auth-switch button {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  margin-left: 4px;
}

/* ============ DASHBOARD ============ */

.dashboard {
  min-height: 100vh;
  background: var(--bg);
}

.dash-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 100px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
}
.dash-user:hover { background: var(--bg-soft); }

.dash-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--v1), var(--v3));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.dash-user-name {
  font-size: 13px;
  font-weight: 500;
}

.dash-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px;
}

.dash-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 24px;
}

.dash-hero h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.dash-hero p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}

.dash-actions {
  display: flex;
  gap: 8px;
}

.dash-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: var(--text);
  color: white;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}
.dash-cta:hover { background: #000; }

.dash-cta.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.dash-cta.secondary:hover { background: var(--bg-soft); }

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.stat-value-suffix {
  font-size: 13px;
  color: var(--text-soft);
}

.stat-phases {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.stat-phase-pill {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-soft);
  position: relative;
  overflow: hidden;
}
.stat-phase-pill-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 2px;
}

/* Pieces grid */
.pieces-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pieces-section-head h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.pieces-search {
  position: relative;
}
.pieces-search input {
  width: 280px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: var(--surface);
}
.pieces-search input:focus { border-color: var(--text); }
.pieces-search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
}

.pieces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.piece-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
}
.piece-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.piece-tile-cover {
  height: 180px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.piece-tile-cover-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  width: 100%;
  opacity: 0.4;
}
.piece-tile-cover-bar {
  height: 1px;
  background: var(--text-muted);
}
.piece-tile-cover-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  color: var(--text-muted);
}
.piece-tile-thumb-canvas {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s;
}
.piece-tile-thumb-canvas.loaded {
  opacity: 1;
}

.piece-tile-pin-count {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(28, 25, 23, 0.8);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.piece-tile-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.piece-tile-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.piece-tile-meta {
  font-size: 12px;
  color: var(--text-soft);
  margin: 0 0 10px;
}

.piece-tile-phases {
  display: flex;
  gap: 4px;
  margin-top: auto;
}

.piece-tile-phase-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
}
.piece-tile-phase-dot-fill {
  position: absolute;
  inset: 0;
  border-radius: 2px;
}

.piece-tile-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
}

.piece-tile-actions {
  display: flex;
  gap: 4px;
}

.piece-tile-action {
  width: 24px; height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}
.piece-tile-action:hover { background: var(--bg-soft); color: var(--text); }
.piece-tile-action.danger:hover { background: #fee2e2; color: #dc2626; }

/* "New piece" tile */
.piece-tile-add {
  border: 2px dashed var(--border-strong);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-soft);
  min-height: 280px;
}
.piece-tile-add:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--text-soft);
  transform: none;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 12px 0 4px;
}

/* Back button in editor */
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.topbar-back:hover { background: var(--bg-soft); color: var(--text); }

/* User menu */
.user-menu {
  position: absolute;
  top: 50px; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 6px;
  z-index: 50;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  width: 100%;
  text-align: left;
  color: var(--text);
}
.user-menu-item:hover { background: var(--bg-soft); }
.user-menu-info {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-menu-name { font-size: 13px; font-weight: 600; }
.user-menu-email { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
