/* ─── Dashboard ─── */

/* Nav active state */
.nav-active {
  color: var(--fg) !important;
  position: relative;
}
.nav-active::after {
  content: '';
  position: absolute;
  bottom: -0.25rem;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--fg);
}

/* ─── Login Gate ─── */
.dash-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  position: relative;
  text-align: center;
  padding: 3rem 2.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  max-width: 380px;
  width: 100%;
  animation: fadeUp 0.5s ease both;
}

.login-glow {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(142, 71%, 45%), transparent);
}

.login-icon {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.login-card h2 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.login-card p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  background: hsl(0, 0%, 100%);
  color: hsl(0, 0%, 4%);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.login-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 24px hsla(0, 0%, 100%, 0.1);
}
.login-btn:active {
  transform: translateY(0);
}

/* ─── Dashboard Main ─── */
.dash .container,
.detail-page .container {
  max-width: 1600px;
}

.dash {
  padding-top: 5rem;
  padding-bottom: 4rem;
  min-height: 100vh;
  animation: fadeUp 0.4s ease both;
}

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  gap: 1rem;
}

.dash-greeting h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.dash-email {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.dash-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.dash-stat {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dash-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.dash-logout:hover {
  color: var(--fg);
  background: var(--card);
  opacity: 1;
}

/* ─── Skills Grid ─── */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
}
@media (min-width: 640px) { .skills-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .skills-grid { grid-template-columns: 1fr 1fr 1fr; } }

.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  animation: fadeUp 0.4s ease both;
  cursor: pointer;
}
.skill-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 24px hsla(0, 0%, 100%, 0.03);
  transform: translateY(-2px);
}
.skill-card:hover .skill-history-hint {
  opacity: 1;
}

.skill-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.skill-platform {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(142, 50%, 50%);
  padding: 0.125rem 0.5rem;
  background: hsla(142, 50%, 50%, 0.08);
  border-radius: 999px;
}

.skill-version {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.skill-name {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.625rem;
  word-break: break-word;
}

.skill-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.skill-meta span {
  font-size: 0.75rem;
  color: var(--muted);
}

.skill-history-hint {
  opacity: 0;
  transition: opacity 0.2s;
  color: hsl(142, 50%, 50%) !important;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  animation: fadeUp 0.5s ease both;
}

.empty-icon {
  color: hsl(0, 0%, 25%);
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.empty-cmd {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
}

.empty-cmd code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--terminal-text);
}

/* ─── Shared ─── */
.panel-loading, .panel-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 3rem 0;
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--fg);
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(142, 50%, 50%);
  background: hsla(142, 50%, 50%, 0.1);
  padding: 0.0625rem 0.375rem;
  border-radius: 999px;
}

/* ─── Skill Detail Page ─── */
.detail-page {
  padding-top: 5rem;
  padding-bottom: 4rem;
  min-height: 100vh;
  animation: fadeUp 0.4s ease both;
}

.detail-top { margin-bottom: 1.5rem; }

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 1rem;
  transition: color 0.2s;
}
.detail-back:hover { color: var(--fg); opacity: 1; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.75rem;
  background: none;
  border: 1px solid hsl(0, 50%, 30%);
  border-radius: var(--radius-sm);
  color: hsl(0, 70%, 60%);
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.btn-delete:hover {
  background: hsla(0, 70%, 50%, 0.1);
  border-color: hsl(0, 60%, 45%);
}

/* ─── Delete Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsla(0, 0%, 0%, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  animation: fadeUp 0.2s ease both;
}

.modal-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.625rem;
  color: hsl(0, 70%, 60%);
}

.modal-card p {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.modal-card strong {
  color: var(--fg);
}

.modal-confirm-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.375rem;
}

.modal-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  outline: none;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s;
}
.modal-input:focus {
  border-color: hsl(0, 50%, 45%);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
}

.modal-btn-cancel {
  padding: 0.5rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-btn-cancel:hover {
  background: hsl(0, 0%, 12%);
}

.modal-btn-delete {
  padding: 0.5rem 1rem;
  background: hsl(0, 60%, 40%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-btn-delete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.modal-btn-delete:not(:disabled):hover {
  background: hsl(0, 65%, 45%);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.detail-title-row h1 {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.detail-version-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.version-select-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.version-select {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.375rem 0.625rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.version-select:hover { border-color: var(--border-hover); }
.version-select:focus { border-color: hsl(142, 50%, 50%); }

/* Three-column layout */
.detail-layout {
  display: grid;
  grid-template-columns: 200px 1fr 220px;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 560px;
  margin-bottom: 1.5rem;
}
@media (max-width: 960px) {
  .detail-layout { grid-template-columns: 180px 1fr; }
  .detail-history-col { display: none; }
}
@media (max-width: 640px) {
  .detail-layout { grid-template-columns: 1fr; min-height: auto; }
}

.detail-sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
@media (max-width: 768px) {
  .detail-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
}

.sidebar-heading {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.875rem 1rem 0.5rem;
}

.file-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--terminal-text);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.file-list-item:hover { background: hsla(0, 0%, 100%, 0.03); }
.file-list-item.active {
  background: hsla(142, 50%, 50%, 0.08);
  color: var(--fg);
}
.file-list-item svg { color: var(--muted); flex-shrink: 0; }
.file-list-item.active svg { color: hsl(142, 50%, 50%); }

.file-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.file-list-lines {
  font-size: 0.625rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* Content area */
.detail-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  background: hsl(0, 0%, 6%);
}

.content-filename {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg);
  font-weight: 600;
}

.content-meta {
  font-size: 0.6875rem;
  color: var(--muted);
}

.content-body {
  flex: 1;
  overflow: auto;
  background: hsl(0, 0%, 5%);
}

.content-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--muted);
  font-size: 0.875rem;
}

.code-viewer {
  overflow: auto;
  min-height: 100%;
}

.code-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
}

.line-num {
  color: hsl(0, 0%, 30%);
  text-align: right;
  padding: 0 0.75rem 0 1rem;
  user-select: none;
  white-space: nowrap;
  width: 1%;
  vertical-align: top;
}

.line-code {
  color: var(--terminal-text);
  padding: 0 1rem 0 0;
  white-space: pre;
}

/* ─── History Column ─── */
.detail-history-col {
  background: var(--card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.detail-viewing {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: hsl(40, 90%, 60%);
  background: hsla(40, 90%, 60%, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.history-item {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s, border-color 0.15s;
}
.history-item:hover {
  background: hsla(0, 0%, 100%, 0.03);
}
.history-item.active {
  background: hsla(142, 50%, 50%, 0.06);
  border-left-color: hsl(142, 50%, 50%);
}

.history-item-top {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.125rem;
}

.history-ver {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg);
}

.history-item-msg {
  font-size: 0.6875rem;
  color: var(--terminal-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.125rem;
}

.history-item-time {
  font-size: 0.625rem;
  color: var(--muted);
}

/* ─── Animation ─── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tabs */
.dash-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0;
}

.dash-tab {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 0.9rem;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.dash-tab:hover {
  color: rgba(255,255,255,0.7);
}

.dash-tab.active {
  color: #fff;
  border-bottom-color: #646cff;
}

/* Deleted card styles */
.skill-card.deleted {
  opacity: 0.7;
  border-color: rgba(255, 100, 100, 0.15);
}

.skill-card.deleted:hover {
  opacity: 1;
}

.skill-days-left {
  font-size: 0.75rem;
  color: rgba(255, 150, 100, 0.8);
}

.btn-restore {
  background: rgba(100, 108, 255, 0.15);
  border: 1px solid rgba(100, 108, 255, 0.3);
  color: #646cff;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-restore:hover {
  background: rgba(100, 108, 255, 0.3);
}

/* Deleted banner on detail page */
.deleted-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 100, 100, 0.08);
  border: 1px solid rgba(255, 100, 100, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

.deleted-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 150, 100, 0.9);
  font-size: 0.85rem;
}

.btn-restore-banner {
  background: rgba(100, 108, 255, 0.15);
  border: 1px solid rgba(100, 108, 255, 0.3);
  color: #646cff;
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-restore-banner:hover {
  background: rgba(100, 108, 255, 0.3);
}
