/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD — Premium Design v2
   ═══════════════════════════════════════════════════════════════════════ */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ── App Nav ── */
.app-nav {
  background: rgba(248, 246, 240, 0.82);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
@supports (backdrop-filter: blur(1px)) {
  .app-nav {
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
  }
}
.app-nav::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brass-500), transparent);
  opacity: 0.3;
}

.app-nav .container {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-nav-right { display: flex; align-items: center; gap: var(--space-4); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
  user-select: none;
}
.user-chip:hover { background: rgba(15,23,21,0.04); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-primary); color: var(--paper-50);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem;
  box-shadow: var(--shadow-xs);
}
.user-name { font-size: 0.88rem; font-weight: 600; padding-right: 4px; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--paper-50);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  min-width: 200px;
  padding: 6px;
  display: none;
  z-index: 30;
}
.user-menu.show { display: block; animation: menuPop 0.2s var(--ease-spring) both; }
@keyframes menuPop {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-menu button {
  width: 100%; text-align: left;
  background: none; border: none;
  padding: 10px 12px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  color: var(--ink-900);
  display: flex; align-items: center; gap: 10px;
  transition: background 0.15s ease;
}
.user-menu button:hover { background: var(--paper-200); }
.user-menu button.danger { color: var(--danger); }
.user-menu button svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Main Dashboard ── */
.dash-main { flex: 1; padding: var(--space-7) 0 var(--space-9); }

.dash-greeting { margin-bottom: var(--space-6); }
.dash-greeting h1 {
  font-size: 2.2rem;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.dash-greeting p { color: var(--ink-700); margin: 0; }

/* ── Stats Grid ── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-7);
}
.dash-stat {
  background: var(--paper-50);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}
.dash-stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}
.dash-stat .ds-num {
  font-family: var(--font-display);
  font-size: 1.8rem; font-weight: 800;
  letter-spacing: -0.02em;
}
.dash-stat .ds-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-700);
  margin-top: 2px;
}

/* ── Toolbar ── */
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-5);
  gap: var(--space-4);
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  flex: 1;
  max-width: 340px;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-50);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-box input:focus {
  border-color: var(--brass-500);
  box-shadow: 0 0 0 3px rgba(194,149,43,0.1);
  outline: none;
}
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-700);
}

.toolbar-right { display: flex; align-items: center; gap: var(--space-3); }

.sort-select {
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-50);
  font-size: 0.85rem;
  color: var(--ink-900);
  cursor: pointer;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-50);
}
.view-btn {
  background: none; border: none;
  padding: 6px 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-700);
  transition: background 0.2s ease, color 0.2s ease;
}
.view-btn svg { width: 16px; height: 16px; }
.view-btn.active { background: var(--ink-900); color: var(--paper-50); }

/* ── Resume Card Grid ── */
.resume-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.resume-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-50);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s var(--ease-spring), transform 0.3s var(--ease-spring), border-color 0.3s ease;
  position: relative;
}
.resume-card:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-5px);
  border-color: rgba(194, 149, 43, 0.2);
}

.rc-thumb {
  height: 150px;
  padding: var(--space-4);
  background: linear-gradient(180deg, #fbfaf5, #f0ecdd);
  border-bottom: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
}
.rc-thumb .rc-line { height: 6px; border-radius: 3px; background: var(--paper-300); }
.rc-thumb .rc-name-line { height: 12px; width: 60%; background: var(--ink-700); border-radius: 3px; margin-bottom: 6px; }

.rc-badge-score {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-full);
  background: var(--gradient-primary); color: var(--paper-50);
  box-shadow: var(--shadow-xs);
}

.rc-body { padding: var(--space-4); flex: 1; display: flex; flex-direction: column; }
.rc-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.rc-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-700); margin-bottom: var(--space-4); }
.rc-actions { display: flex; gap: 8px; margin-top: auto; }
.rc-actions .btn { flex: 1; }

/* List View */
.resume-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.resume-grid.list-view .resume-card {
  flex-direction: row;
  align-items: center;
  padding: var(--space-4);
}
.resume-grid.list-view .rc-thumb { display: none; }
.resume-grid.list-view .rc-body { padding: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-4); }
.resume-grid.list-view .rc-meta { margin-bottom: 0; }
.resume-grid.list-view .rc-actions { margin-top: 0; width: auto; flex: none; }

/* Skeleton card */
.skeleton-card { pointer-events: none; }

/* New resume card */
.new-resume-card {
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
  color: var(--ink-700);
  min-height: 246px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.3s ease;
}
.new-resume-card:hover {
  border-color: var(--brass-500);
  background: rgba(194,149,43,0.03);
  color: var(--ink-900);
  box-shadow: var(--shadow-glow-sm);
}
.new-resume-card .plus-circle {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 300;
  transition: transform 0.3s var(--ease-spring);
}
.new-resume-card:hover .plus-circle {
  transform: scale(1.1) rotate(90deg);
}

.empty-state {
  text-align: center;
  padding: var(--space-9) var(--space-6);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
}
.empty-state h3 { margin-bottom: var(--space-2); }
.empty-state p { max-width: 42ch; margin: 0 auto var(--space-5); }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,21,0.45);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: var(--space-5);
}
@supports (backdrop-filter: blur(1px)) {
  .modal-overlay { backdrop-filter: blur(8px); }
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--paper-50);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-pop);
  animation: modalPop 0.3s var(--ease-spring) both;
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-box h3 { margin-bottom: var(--space-2); }
.modal-box p { color: var(--ink-700); }
.modal-actions { display: flex; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-6); }

/* Settings modal */
.modal-settings { max-width: 480px; }
.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--space-5);
}
.settings-tab {
  background: none; border: none;
  padding: 10px 16px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  color: var(--ink-700); border-bottom: 2px solid transparent;
  cursor: pointer; margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.settings-tab.active { color: var(--ink-900); border-bottom-color: var(--brass-500); }

/* ── Toast ── */
.toast-stack {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--ink-900); color: var(--paper-50);
  padding: 12px 20px; border-radius: var(--radius-md);
  font-size: 0.86rem;
  box-shadow: var(--shadow-elevated);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.3s var(--ease-spring) both;
}
.toast.error   { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════════════════════
   TEMPLATE GALLERY MODAL
   ═══════════════════════════════════════════════════════════════════════ */

.modal-gallery {
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.gallery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) 0;
  gap: var(--space-4);
}
.gallery-header h3 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.gallery-subtitle {
  color: var(--ink-700);
  font-size: 0.88rem;
  margin: 0;
}
.gallery-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--paper-100);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.gallery-close svg { width: 18px; height: 18px; color: var(--ink-700); }
.gallery-close:hover { background: var(--paper-200); border-color: var(--rule-strong); }

/* ── Gallery Toolbar ── */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  flex-wrap: wrap;
}
.gallery-search {
  position: relative;
  flex: 0 1 260px;
  min-width: 180px;
}
.gallery-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-50);
  font-size: 0.85rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.gallery-search input:focus {
  border-color: var(--brass-500);
  box-shadow: 0 0 0 3px rgba(194,149,43,0.1);
  outline: none;
}
.gallery-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ink-700);
}

/* ── Filter Pills ── */
.gallery-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.gallery-filter-pill {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--rule-strong);
  background: var(--paper-50);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.gallery-filter-pill:hover {
  border-color: var(--brass-400);
  color: var(--brass-600);
  background: var(--brass-50, rgba(194,149,43,0.04));
}
.gallery-filter-pill.active {
  background: var(--ink-900);
  color: var(--paper-50);
  border-color: var(--ink-900);
}

/* ── Gallery Grid ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
  padding: var(--space-4) var(--space-6);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* ── Template Card ── */
.gallery-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-50);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s var(--ease-spring), transform 0.3s var(--ease-spring), border-color 0.3s ease;
  cursor: pointer;
  animation: galleryCardIn 0.4s var(--ease-spring) both;
}
.gallery-card:nth-child(1) { animation-delay: 0.03s; }
.gallery-card:nth-child(2) { animation-delay: 0.06s; }
.gallery-card:nth-child(3) { animation-delay: 0.09s; }
.gallery-card:nth-child(4) { animation-delay: 0.12s; }
.gallery-card:nth-child(5) { animation-delay: 0.15s; }
.gallery-card:nth-child(6) { animation-delay: 0.18s; }
.gallery-card:nth-child(7) { animation-delay: 0.21s; }
.gallery-card:nth-child(8) { animation-delay: 0.24s; }

@keyframes galleryCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gallery-card:hover {
  box-shadow: 0 12px 40px -8px rgba(15,23,21,0.14), 0 0 0 1px rgba(194,149,43,0.15);
  transform: translateY(-6px);
  border-color: rgba(194,149,43,0.3);
}

/* Mini resume preview inside card */
.gallery-preview {
  height: 220px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #fbfaf5, #f0ecdd);
  border-bottom: 1px solid var(--rule);
}
.gallery-preview-inner {
  transform: scale(0.32);
  transform-origin: top left;
  width: 312.5%; /* 100% / 0.32 */
  pointer-events: none;
  position: absolute;
  top: 8px;
  left: 8px;
}
.gallery-preview-inner .resume-doc {
  box-shadow: none;
  border: none;
}

/* Card body */
.gallery-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.gallery-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.gallery-card-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.gallery-card-name {
  font-weight: 700;
  font-size: 1rem;
}
.gallery-card-industry {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brass-600);
  padding: 3px 8px;
  background: var(--brass-100);
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 6px;
}
.gallery-card-desc {
  font-size: 0.82rem;
  color: var(--ink-700);
  line-height: 1.4;
  flex: 1;
}
.gallery-card-actions {
  margin-top: var(--space-3);
}
.gallery-card-actions .btn {
  width: 100%;
  justify-content: center;
}

/* ── Gallery Footer ── */
.gallery-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: center;
}
.gallery-footer .btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── No results ── */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--ink-700);
}
.gallery-empty h4 {
  margin-bottom: var(--space-2);
  color: var(--ink-900);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .modal-gallery { max-height: 95vh; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .dash-toolbar { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .search-box { max-width: 100%; }
  .toolbar-right { justify-content: space-between; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .dash-stats { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .dash-stat { padding: var(--space-3) var(--space-4); }
  .dash-stat .ds-num { font-size: 1.4rem; }
  .resume-grid { grid-template-columns: 1fr; }
  .modal-gallery { max-width: calc(100vw - 24px); border-radius: var(--radius-lg); margin: 12px; }
  .gallery-grid { grid-template-columns: 1fr; padding: var(--space-3); }
  .gallery-header { padding: var(--space-4) var(--space-4) 0; }
  .gallery-toolbar { padding: var(--space-3) var(--space-4); }
  .gallery-footer { padding: var(--space-3) var(--space-4); }
  .gallery-header h3 { font-size: 1.3rem; }
  .dash-greeting h1 { font-size: 1.6rem; }
  .app-nav .container { padding: 0 var(--space-4); }
}

