/* QuickGigs — shared polish (mobile, light mode, motion). Safe additive layer. */

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }

body {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: fadeIn 0.3s ease;
}

button, .task-card, .nav-item, .tab-item, .act-btn, .stat-card, .action-card, .sec, .mini-card, .chk, .skill-toggle, .cat-chip, .mpill {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:active, .task-card:active, .tab-item:active, .act-btn:active, .empty-btn:active, .save-btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

input, textarea, select {
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--purple-light, #9b6fc4);
  box-shadow: 0 0 0 3px rgba(107,63,160,0.15);
}

.tab-bar {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(11,1,24,0.85);
  border-bottom: 0.5px solid rgba(200,168,233,0.1);
  transition: background 0.25s;
}

body.light .nav {
  background: rgba(250,250,254,0.88);
}

.task-card, .stat-card, .action-card, .sec, .mini-card, .review-card, .notif-item {
  border-radius: 18px;
  border: 0.5px solid rgba(200,168,233,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.task-card:hover, .stat-card:hover, .action-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200,168,233,0.25);
  box-shadow: 0 8px 32px rgba(107,63,160,0.15);
}

.modal-overlay { animation: fadeIn 0.2s ease; }
.modal, .bottom-sheet { animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }

.tc-badge, .status-pill, .role-pill, .skill, .tag, .wbadge, .badge, .cat-chip, .mpill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.btn-primary, .save-btn, .empty-btn, .submit-btn, .accept-btn, .modal-confirm.purple {
  background: linear-gradient(135deg, #6b3fa0, #9b6fc4);
  border: none;
  box-shadow: 0 4px 15px rgba(107,63,160,0.3);
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover, .save-btn:hover, .empty-btn:hover {
  box-shadow: 0 6px 20px rgba(107,63,160,0.45);
  transform: translateY(-1px);
}

body.light .task-card, body.light .stat-card, body.light .action-card, body.light .mini-card, body.light .review-card {
  background: #fff;
  border-color: #f0eeff;
  box-shadow: 0 2px 12px rgba(107,63,160,0.06);
}

body.light .task-card:hover {
  box-shadow: 0 6px 24px rgba(107,63,160,0.12);
}

img[loading="lazy"] {
  content-visibility: auto;
}

/* Nav link underline (scaleX) */
.nav a:not(.nav-logo):not(.back-btn),
.tab-item,
.legal-footer a,
.app-legal-footer a,
.site-footer a {
  position: relative;
}
.nav a:not(.nav-logo):not(.back-btn)::after,
.legal-footer a::after,
.app-legal-footer a::after,
.site-footer a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
  opacity: 0.85;
}
.nav a:not(.nav-logo):not(.back-btn):hover::after,
.legal-footer a:hover::after,
.app-legal-footer a:hover::after,
.site-footer a:hover::after {
  transform: scaleX(1);
}

/* Card stagger on first paint */
.qg-stagger-in {
  animation: qgCardIn 0.32s ease both;
}
@keyframes qgCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Help FAB — above bottom nav; never cover card text */
.qg-help-root,
.help-fab {
  position: fixed;
  left: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
}
/* Profile: lift FAB fully above tab bar; left:16px; z-index:40 */
body.page-profile .qg-help-root,
body.page-profile .help-fab,
body[data-qg-page="profile"] .qg-help-root,
body[data-qg-page="profile"] .help-fab,
html[data-qg-page="profile"] .qg-help-root,
html[data-qg-page="profile"] .help-fab {
  left: 16px !important;
  /* nav height (~76) + gap so "?" never sits on card text */
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 40 !important;
}
/* Chat: sit above composer so "?" never covers the last bubble */
body.page-chat .qg-help-root,
html[data-qg-page="chat"] .qg-help-root,
body.page-chat .help-fab {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 140px);
  z-index: 40;
}
/* Messages inbox: clear the fixed tab bar (not the chat composer) */
body.page-messages .qg-help-root,
html[data-qg-page="messages"] .qg-help-root,
body.page-messages .help-fab,
html[data-qg-page="messages"] .help-fab {
  left: 16px !important;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 40 !important;
}

/* Task title capitalization safety net (existing lowercase rows) */
.task-title::first-letter,
.tc-title::first-letter {
  text-transform: uppercase;
}
.qg-help-root.is-composer-focused {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.qg-help-fab {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #6b3fa0, #9b6fc4); color: #fff;
  font: 600 18px/1 'DM Sans', sans-serif; box-shadow: 0 6px 20px rgba(107,63,160,0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.qg-help-fab:hover { transform: translateY(-1px); }
.qg-help-fab:focus-visible { outline: 2px solid #c8a8e9; outline-offset: 2px; }
.qg-help-panel {
  position: absolute; left: 0; bottom: 54px; width: min(320px, calc(100vw - 32px));
  background: var(--nav-bg, #0b0118); color: var(--text, #fff);
  border: 0.5px solid var(--border, rgba(200,168,233,0.15)); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35); padding: 14px 14px 12px;
  animation: qgCardIn 0.28s ease both;
}
body.light .qg-help-panel { background: #fff; color: #1a0a3d; }
.qg-help-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qg-help-title { font-size: 15px; font-weight: 500; }
.qg-help-close {
  border: none; background: transparent; color: inherit; font-size: 22px; line-height: 1;
  cursor: pointer; opacity: 0.7; width: 32px; height: 32px;
}
.qg-help-q {
  width: 100%; text-align: left; border: none; background: transparent; color: inherit;
  font: 500 13px/1.4 'DM Sans', sans-serif; padding: 10px 4px; cursor: pointer;
  border-top: 0.5px solid var(--border, rgba(200,168,233,0.12));
}
.qg-help-q[aria-expanded="true"] { color: var(--purple-light, #9b6fc4); }
.qg-help-a {
  font-size: 12px; line-height: 1.55; color: var(--text-muted, rgba(255,255,255,0.68));
  padding: 0 4px 10px;
}
body.light .qg-help-a { color: #6b6580; }
.qg-help-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 10px; border-top: 0.5px solid var(--border, rgba(200,168,233,0.12)); }
.qg-help-link {
  font-size: 12px; font-weight: 500; color: var(--purple-light, #9b6fc4); text-decoration: none;
}
body.light .qg-help-link { color: #6b3fa0; }

@media (prefers-reduced-motion: reduce) {
  body, .qg-stagger-in, .qg-help-panel, .modal, .bottom-sheet, .modal-overlay {
    animation: none !important;
    transition: none !important;
  }
  .nav a:not(.nav-logo):not(.back-btn)::after,
  .legal-footer a::after,
  .app-legal-footer a::after,
  .site-footer a::after {
    transition: none !important;
  }
  .task-card:hover, .stat-card:hover, .action-card:hover { transform: none; }
}
