/* ── Reset & variables ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --hp-blue:        #204975;
  --hp-blue-deep:   #1D3357;
  --hp-blue-mid:    #1E558E;
  --hp-blue-light:  #7CA0BF;
  --hp-gold:        #AF8C56;
  --hp-gold-light:  #c4a265;
  --hp-navy:        #162033;
  --hp-navy-2:      #1a2940;
  --hp-navy-3:      #0f1824;

  --surface:        #ffffff;
  --surface-2:      #f7f8fa;
  --surface-3:      #f0f2f5;
  --border:         rgba(0,0,0,0.08);
  --border-strong:  rgba(0,0,0,0.14);
  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;

  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.07);
  --shadow:         0 2px 10px rgba(0,0,0,0.09);
  --shadow-lg:      0 8px 30px rgba(0,0,0,0.12);
  --transition:     0.18s ease;
}

html, body {
  height: 100%;
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px;
  background: var(--hp-blue); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  transition: background var(--transition), transform 0.12s;
}
.btn-primary:hover  { background: var(--hp-blue-deep); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  transition: background var(--transition);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); }

.btn-gold {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px;
  background: var(--hp-gold); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
  transition: background var(--transition), transform 0.12s;
}
.btn-gold:hover  { background: var(--hp-gold-light); transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  background: #ef4444; color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  transition: background var(--transition);
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--hp-blue);
  box-shadow: 0 0 0 3px rgba(32,73,117,0.1);
}
.form-input.error { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
.form-input::placeholder { color: var(--text-muted); }

.form-error {
  font-size: 12px; color: #ef4444;
  display: flex; align-items: center; gap: 5px;
}

/* ── App header (authenticated pages) ────────────────────────────────────────── */

.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--hp-navy);
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px;
  height: 58px;
  border-bottom: 3px solid var(--hp-blue);
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.app-header-brand {
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0; text-decoration: none;
}

.app-header-title {
  font-family: 'Work Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  color: #fff; letter-spacing: 0.1em;
  line-height: 1.2;
}

.app-header-sub {
  font-size: 10px; color: rgba(255,255,255,0.38);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.app-nav {
  display: flex; align-items: center; gap: 4px;
  flex: 1;
}

.app-nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.app-nav-link:hover  { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); }
.app-nav-link.active { background: rgba(255,255,255,0.1);  color: #fff; }

.app-header-user {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto; flex-shrink: 0;
}

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--hp-gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-info { line-height: 1.3; }
.user-name  { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.85); }
.user-email { font-size: 11px; color: rgba(255,255,255,0.35); }

.btn-signout {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.3); font-size: 16px;
  padding: 6px; border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  display: flex; align-items: center;
}
.btn-signout:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ── Page layout ─────────────────────────────────────────────────────────────── */

.page-body { min-height: calc(100vh - 58px); }

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px;
}

.page-header {
  display: flex; align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 36px;
}

.page-title {
  font-size: 22px; font-weight: 600;
  color: var(--text-primary); line-height: 1.2;
}

.page-sub {
  font-size: 14px; color: var(--text-muted);
  margin-top: 4px;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.stat-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Project cards ───────────────────────────────────────────────────────────── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.project-thumb {
  aspect-ratio: 16/9;
  background: var(--hp-navy);
  overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-thumb-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.2); font-size: 28px;
}
.project-thumb-placeholder span { font-size: 11px; color: rgba(255,255,255,0.15); letter-spacing: 0.1em; text-transform: uppercase; }

.project-body { padding: 16px 18px 14px; }
.project-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.project-platforms {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 0 18px 14px;
}
.platform-tag {
  padding: 2px 8px;
  background: var(--surface-3); color: var(--text-secondary);
  border-radius: 100px; font-size: 11px; font-weight: 500;
}

.project-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
}
.project-card:hover .project-actions { opacity: 1; pointer-events: all; }

.action-btn {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.9);
  border: none; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; color: var(--text-secondary);
  backdrop-filter: blur(4px);
  transition: background var(--transition), color var(--transition);
}
.action-btn:hover { background: #fff; color: var(--text-primary); }
.action-btn.danger:hover { background: #fef2f2; color: #ef4444; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center;
  gap: 16px; color: var(--text-muted);
}
.empty-state i    { font-size: 48px; opacity: 0.3; }
.empty-state h3   { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.empty-state p    { font-size: 14px; max-width: 340px; line-height: 1.7; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.visible { opacity: 1; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
}
.modal-overlay.visible .modal-card { transform: none; }
.modal-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.modal-card p  { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }

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

/* ── Toast ───────────────────────────────────────────────────────────────────── */

#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999; pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 13px; font-weight: 500;
  background: var(--hp-navy); color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transform: translateX(20px); opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1), opacity 0.28s;
  pointer-events: all;
}
.toast.visible { transform: none; opacity: 1; }
.toast-success { background: #166534; }
.toast-error   { background: #991b1b; }
.toast-warning { background: #92400e; }
.toast i { font-size: 16px; flex-shrink: 0; }

/* ── Skeleton loaders ────────────────────────────────────────────────────────── */

.skeleton .project-thumb { background: var(--surface-3); }
.skeleton .project-body  { padding: 16px 18px 20px; }

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-thumb, .skeleton-line {
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-thumb { width: 100%; aspect-ratio: 16/9; border-radius: 0; }
.skeleton-line  { height: 12px; margin-bottom: 8px; }
.skeleton-body  { padding: 16px 18px 20px; }

/* ── Badge / tag ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 100px;
  font-size: 11px; font-weight: 600;
}
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-gold    { background: #fef3c7; color: #92400e; }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: var(--surface-3); color: var(--text-secondary); }

/* ── Table ───────────────────────────────────────────────────────────────────── */

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.data-table td {
  padding: 13px 16px;
  font-size: 13px; color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }
.data-table .td-muted { color: var(--text-muted); }

/* ── Auth pages ──────────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  background: var(--hp-navy);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px;
  position: relative; overflow: hidden;
}

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  position: relative; z-index: 1;
}

.auth-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.auth-logo-text { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: 0.08em; }
.auth-logo-sub  { font-size: 11px; color: var(--text-muted); letter-spacing: 0.06em; }

.auth-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.auth-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.6; }

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.auth-divider {
  text-align: center; position: relative; margin: 4px 0;
  color: var(--text-muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: calc(50% - 20px); height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-footer {
  text-align: center; margin-top: 24px;
  font-size: 13px; color: var(--text-muted);
}
.auth-footer a { color: var(--hp-blue); font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

.auth-bg-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

/* password strength */
.pwd-strength { height: 3px; border-radius: 2px; margin-top: 4px; background: var(--border); overflow: hidden; }
.pwd-strength-fill { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; width: 0%; }
.pwd-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Dashboard specific ──────────────────────────────────────────────────────── */

.dashboard-hero {
  background: var(--hp-navy);
  padding: 36px 32px 32px;
  margin-bottom: 0;
  border-bottom: 3px solid var(--hp-blue);
}

.dashboard-greeting {
  font-size: 22px; font-weight: 700;
  color: #fff; margin-bottom: 4px;
}
.dashboard-sub { font-size: 14px; color: rgba(255,255,255,0.4); }

.dashboard-search {
  position: relative; max-width: 320px;
}
.dashboard-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 15px; pointer-events: none;
}
.dashboard-search input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius); font-size: 13px;
  background: var(--surface); color: var(--text-primary);
  outline: none; transition: border-color var(--transition);
}
.dashboard-search input:focus { border-color: var(--hp-blue); }

.dashboard-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* ── Share page ──────────────────────────────────────────────────────────────── */

.share-page {
  min-height: 100vh;
  background: var(--hp-navy);
  display: flex; flex-direction: column;
  align-items: center; padding: 60px 24px;
}

.share-card {
  width: 100%; max-width: 680px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.share-header {
  background: var(--hp-navy-2);
  padding: 24px 32px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 2px solid var(--hp-blue);
}

.share-meta { flex: 1; }
.share-project-name { font-size: 18px; font-weight: 600; color: #fff; }
.share-project-sub  { font-size: 12px; color: rgba(255,255,255,0.38); margin-top: 3px; }

.share-files-list { padding: 24px 32px; display: flex; flex-direction: column; gap: 10px; }

.share-file-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  transition: border-color var(--transition), background var(--transition);
}
.share-file-row:hover { border-color: var(--hp-blue); background: var(--surface); }

.share-file-thumb {
  width: 56px; height: 42px; border-radius: 6px;
  object-fit: cover; background: var(--surface-3); flex-shrink: 0;
}
.share-file-info { flex: 1; min-width: 0; }
.share-file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-file-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Admin panel ─────────────────────────────────────────────────────────────── */

.admin-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.admin-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: color var(--transition);
  margin-bottom: -1px;
}
.admin-tab:hover  { color: var(--text-primary); }
.admin-tab.active { color: var(--hp-blue); border-bottom-color: var(--hp-blue); }

/* ── Save to portal modal ────────────────────────────────────────────────────── */

.save-portal-card { max-width: 480px; }

.save-portal-preview {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin: 16px 0 24px; border-radius: var(--radius);
  overflow: hidden;
}
.save-portal-preview-thumb {
  aspect-ratio: 1; background: var(--surface-3);
  object-fit: cover;
}

.save-progress-bar {
  height: 4px; border-radius: 2px;
  background: var(--surface-3); overflow: hidden;
  margin-bottom: 8px;
}
.save-progress-fill {
  height: 100%; background: var(--hp-blue);
  border-radius: 2px;
  transition: width 0.3s;
}
.save-progress-label { font-size: 12px; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .app-header  { padding: 0 16px; gap: 12px; }
  .user-info   { display: none; }
  .app-nav-link span { display: none; }
  .page-container { padding: 24px 16px; }
  .project-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-grid    { grid-template-columns: 1fr 1fr; }
  .auth-card    { padding: 28px 24px; }
  .dashboard-hero { padding: 24px 16px; }
}

@media (max-width: 480px) {
  .project-grid { grid-template-columns: 1fr; }
  .stat-grid    { grid-template-columns: 1fr; }
  .page-header  { flex-direction: column; align-items: flex-start; }
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider { height: 1px; background: var(--border); margin: 24px 0; }

.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-24  { margin-bottom: 24px; }
.mt-16  { margin-top: 16px; }

/* ── Premium animation ───────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Gold focus rings on primary CTAs ────────────────────────────────────── */
.btn-gold:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(175,140,86,0.4);
}

/* ── Playfair italic utility ─────────────────────────────────────────────── */
.italic-serif {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 400;
}
