/* ============================================================
   HumanQuill — Shared App Styles
   Used by: login, dashboard, order-detail, profile, writer, admin
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #060c18;
  --bg-2:         #0c1528;
  --bg-3:         #111c35;
  --purple:       #7c3aed;
  --purple-mid:   #6d28d9;
  --purple-light: #a78bfa;
  --cyan:         #06d6d0;
  --cyan-light:   #67e8f9;
  --indigo:       #4f46e5;
  --gold:         #f59e0b;
  --green:        #4ade80;
  --red:          #f87171;
  --amber:        #fbbf24;
  --white:        #f1f5f9;
  --gray:         #94a3b8;
  --gray-dim:     #475569;
  --glass:        rgba(255,255,255,0.04);
  --glass-2:      rgba(255,255,255,0.07);
  --glass-border: rgba(255,255,255,0.08);
  --glass-hover:  rgba(255,255,255,0.09);
  --purple-glass: rgba(124,58,237,0.12);
  --cyan-glass:   rgba(6,214,208,0.1);
  --radius:       16px;
  --radius-sm:    10px;
  --nav-h:        64px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── Background ─────────────────────────────────────────────── */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); pointer-events: none;
}
.orb-1 {
  width: 800px; height: 800px; top: -200px; left: -200px;
  background: radial-gradient(circle, rgba(124,58,237,0.4) 0%, transparent 70%);
  opacity: 0.18;
}
.orb-2 {
  width: 600px; height: 600px; top: 40%; right: -150px;
  background: radial-gradient(circle, rgba(6,214,208,0.3) 0%, transparent 70%);
  opacity: 0.14;
}
.orb-3 {
  width: 500px; height: 500px; bottom: -100px; left: 30%;
  background: radial-gradient(circle, rgba(79,70,229,0.35) 0%, transparent 70%);
  opacity: 0.12;
}

/* ── App Navbar ─────────────────────────────────────────────── */
.app-navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(6,12,24,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.app-nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 32px; height: 100%;
  display: flex; align-items: center; gap: 32px;
}
.app-nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--white);
  flex-shrink: 0;
}
.app-nav-logo .logo-dot { color: var(--cyan); }
.app-nav-links {
  display: flex; align-items: center; gap: 28px;
  flex: 1;
}
.app-nav-links a {
  font-size: 14px; font-weight: 500; color: var(--gray);
  transition: color 0.2s;
}
.app-nav-links a:hover,
.app-nav-links a.active { color: var(--white); }
.app-nav-links .nav-new-order {
  background: var(--purple-glass);
  border: 1px solid rgba(124,58,237,0.28);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--purple-light);
  font-size: 13px; font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.app-nav-links .nav-new-order:hover {
  background: rgba(124,58,237,0.2); color: #c084fc;
}
.app-nav-user {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto; flex-shrink: 0;
}
.app-nav-profile {
  display: flex; align-items: center; gap: 10px;
  border-radius: 40px;
  padding: 4px 12px 4px 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition: background 0.2s;
}
.app-nav-profile:hover { background: var(--glass-2); }
.nav-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.nav-avatar-initials {
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
}
.nav-user-name {
  font-size: 13px; font-weight: 500; color: var(--white);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-nav-logout {
  background: var(--glass); border: 1px solid var(--glass-border);
  color: var(--gray-dim); border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.app-nav-logout:hover { color: var(--red); background: rgba(248,113,113,0.08); }

/* ── Page Layout ─────────────────────────────────────────────── */
.app-page {
  position: relative; z-index: 1;
  padding-top: var(--nav-h);
  min-height: 100vh;
}
.app-container {
  max-width: 1200px; margin: 0 auto; padding: 40px 32px;
}
.app-container-sm {
  max-width: 720px; margin: 0 auto; padding: 40px 24px;
}
.page-header {
  margin-bottom: 36px;
}
.page-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 28px; font-weight: 700; color: var(--white);
  letter-spacing: -0.01em; line-height: 1.2;
}
.page-subtitle {
  font-size: 15px; color: var(--gray); margin-top: 6px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-glass {
  background: rgba(8,14,28,0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  overflow: hidden;
}
.card-glass::before {
  content: '';
  display: block; height: 1px;
  background: linear-gradient(90deg, rgba(124,58,237,0.5), rgba(6,214,208,0.3), transparent);
}
.card-body { padding: 24px; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-border);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 14px; font-weight: 600;
  color: var(--gray);
  letter-spacing: 0.08em; text-transform: uppercase;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  opacity: 0.4;
}
.stat-value {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 32px; font-weight: 800; line-height: 1;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #c084fc 0%, var(--cyan) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: 13px; color: var(--gray); font-weight: 400;
}

/* ── Status Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.8; flex-shrink: 0;
}
.badge-submitted    { background: rgba(124,58,237,0.12); color: var(--purple-light); border: 1px solid rgba(124,58,237,0.2); }
.badge-assigned     { background: rgba(79,70,229,0.12);  color: #818cf8; border: 1px solid rgba(79,70,229,0.2); }
.badge-in-progress  { background: rgba(251,191,36,0.1);  color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.badge-under-review { background: rgba(6,214,208,0.1);   color: var(--cyan);  border: 1px solid rgba(6,214,208,0.2); }
.badge-delivered    { background: rgba(74,222,128,0.1);  color: var(--green); border: 1px solid rgba(74,222,128,0.2); }

/* ── Status Timeline ─────────────────────────────────────────── */
.timeline {
  display: flex; align-items: flex-start; gap: 0;
  margin: 32px 0;
  position: relative;
}
.timeline-step {
  flex: 1; text-align: center; position: relative;
}
.timeline-step + .timeline-step::before {
  content: ''; position: absolute;
  top: 15px; right: 50%; left: -50%;
  height: 2px;
  background: var(--glass-2);
  z-index: 0;
}
.timeline-step.done + .timeline-step::before,
.timeline-step.active + .timeline-step::before {
  background: linear-gradient(90deg, var(--purple), rgba(124,58,237,0.3));
}
.timeline-step.done + .timeline-step.done::before {
  background: linear-gradient(90deg, var(--purple), var(--purple));
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-2); border: 2px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px; position: relative; z-index: 1;
  font-size: 13px; font-weight: 700; color: var(--gray-dim);
  transition: all 0.4s;
}
.timeline-step.done  .timeline-dot { background: var(--purple); border-color: var(--purple); color: white; }
.timeline-step.active .timeline-dot {
  background: rgba(124,58,237,0.15); border-color: var(--purple); color: var(--purple-light);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.15);
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(124,58,237,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(124,58,237,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,58,237,0); }
}
.timeline-label {
  font-size: 12px; font-weight: 600; color: var(--gray-dim);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.timeline-step.done   .timeline-label { color: var(--purple-light); }
.timeline-step.active .timeline-label { color: var(--white); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  color: white; font-weight: 700; font-size: 15px;
  padding: 12px 28px; border-radius: 12px;
  border: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(124,58,237,0.3);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  font-family: 'Bricolage Grotesque', sans-serif;
  letter-spacing: 0.02em;
}
.btn-primary:hover {
  opacity: 0.9; transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(124,58,237,0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--glass); color: var(--gray);
  border: 1px solid var(--glass-border);
  font-weight: 500; font-size: 14px;
  padding: 10px 20px; border-radius: 10px; cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--glass-2); color: var(--white); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(248,113,113,0.1); color: var(--red);
  border: 1px solid rgba(248,113,113,0.25);
  font-weight: 600; font-size: 14px;
  padding: 10px 20px; border-radius: 10px; cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.btn-danger:hover { background: rgba(248,113,113,0.18); }
.btn-sm { padding: 7px 14px !important; font-size: 13px !important; border-radius: 8px !important; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--glass-border); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gray-dim);
  background: var(--bg-2); border-bottom: 1px solid var(--glass-border);
}
.data-table td {
  padding: 14px 16px; font-size: 14px; color: var(--gray);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--glass); }
.data-table td a { color: var(--purple-light); }
.data-table td a:hover { color: #c084fc; text-decoration: underline; }
.data-table td strong { color: var(--white); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-section { margin-bottom: 32px; }
.form-section-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 16px; font-weight: 700; color: var(--white);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label {
  display: block; margin-bottom: 7px;
  font-size: 13px; font-weight: 600; color: var(--gray);
  letter-spacing: 0.04em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-2); color: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 11px 14px;
  font-size: 14px; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-dim); }
.form-select option { background: var(--bg-2); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: 12px; color: var(--gray-dim); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; display: none; }
.form-error.visible { display: block; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 4px;
  margin-bottom: 24px; width: fit-content;
}
.tab-btn {
  padding: 8px 20px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--gray);
  background: transparent; border: none;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}
.tab-btn:hover { color: var(--white); }
.tab-btn.active {
  background: var(--purple-glass); color: var(--purple-light);
  border: 1px solid rgba(124,58,237,0.28);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Toast ─────────────────────────────────────────────────── */
#app-toast, .toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  background: var(--bg-2); color: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 14px 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s;
  max-width: 360px;
  pointer-events: none;
}
#app-toast.toast-visible { transform: translateY(0); opacity: 1; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--purple); }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--glass-2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.full-page-loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.full-page-loader .spinner { width: 40px; height: 40px; border-width: 3px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--bg-2); border: 1px solid var(--glass-border);
  border-radius: 20px; padding: 32px;
  max-width: 440px; width: 100%;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  transform: scale(0.95); transition: transform 0.25s;
}
.modal-overlay.open .modal-card { transform: scale(1); }
.modal-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 20px; font-weight: 700; color: var(--white);
  margin-bottom: 12px;
}
.modal-desc { font-size: 14px; color: var(--gray); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 64px 24px;
  color: var(--gray-dim);
}
.empty-state-icon {
  font-size: 48px; margin-bottom: 16px; opacity: 0.6;
}
.empty-state-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 18px; font-weight: 700; color: var(--gray);
  margin-bottom: 8px;
}
.empty-state-desc { font-size: 14px; color: var(--gray-dim); margin-bottom: 24px; }

/* ── Gradient text ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #c084fc 0%, var(--cyan) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Alert ─────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: 10px;
  font-size: 14px; margin-bottom: 16px;
}
.alert-error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: #fca5a5; }
.alert-success { background: rgba(74,222,128,0.1);  border: 1px solid rgba(74,222,128,0.3);  color: #86efac; }
.alert-info    { background: var(--purple-glass); border: 1px solid rgba(124,58,237,0.3); color: var(--purple-light); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-nav-inner { padding: 0 20px; }
  .nav-user-name { display: none; }
  .app-nav-links { gap: 16px; }
  .app-container { padding: 24px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .app-nav-links a:not(.nav-new-order) { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .tabs { width: 100%; }
  .tab-btn { flex: 1; text-align: center; }
}
