/* ============================================================
   DESIGN SYSTEM — IngegneriPro (Area Membri)
   Stessi token della landing: navy scuro + gradiente arancio/ambra
   ============================================================ */

:root {
  --navy: #090d14;
  --navy-2: #0a0f19;
  --navy-deep: #05070e;
  --surface: #111725;
  --surface-2: #161d2e;
  --border: #232b3d;
  --border-soft: rgba(255, 255, 255, 0.08);
  --orange: #f97316;
  --amber: #f59e0b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --emerald: #34d399;
  --red: #f87171;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 1rem;
  --radius-lg: 1.25rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: #fff;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

button { font-family: inherit; cursor: pointer; }

/* ── Background texture (igual à landing) ── */
body {
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(249, 115, 22, 0.08), transparent 45%),
    radial-gradient(circle at 85% 30%, rgba(245, 158, 11, 0.05), transparent 40%);
  background-size: 32px 32px, auto, auto;
  background-attachment: fixed;
}

/* ============================================================
   LOGIN / SET-PASSWORD / RESET-PASSWORD (auth pages)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--navy-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6), 0 0 60px -30px rgba(249, 115, 22, 0.15);
  text-align: center;
}

.auth-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  font-family: var(--font-display);
}

.auth-card h1 {
  font-size: 1.375rem;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 28px;
}

.field {
  text-align: left;
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--navy-deep);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--orange);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 0.9375rem;
  font-family: var(--font-display);
  transition: all 0.15s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-orange {
  background: linear-gradient(135deg, var(--orange), var(--amber));
  color: var(--navy);
  box-shadow: 0 10px 25px -8px rgba(234, 88, 12, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--text-dim); }

.auth-links {
  margin-top: 18px;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.auth-links a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover { text-decoration: underline; }

.form-msg {
  display: none;
  font-size: 0.8125rem;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: left;
  line-height: 1.4;
}

.form-msg.visible { display: block; }

.form-msg.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

.form-msg.success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}

.auth-footer {
  margin-top: 28px;
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* ============================================================
   MEMBERS DASHBOARD
   ============================================================ */
.members-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 13, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.header-brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--navy);
}

.members-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.welcome-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 28px;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.welcome-bar strong { color: #fff; }
.wave { font-size: 1.5rem; }

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: auto;
}

.plan-badge.essenziale {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.plan-badge.completo {
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.375rem;
  margin-bottom: 4px;
}

.section-header p {
  color: var(--text-dim);
  font-size: 0.875rem;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 28px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 9px 18px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8125rem;
  border-radius: 9px;
  transition: all 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--surface-2);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
}

.locked-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.locked-note a { color: var(--orange); font-weight: 700; text-decoration: none; }

/* ── Prompt / Agent copyable cards ── */
.prompt-grid {
  display: grid;
  gap: 14px;
}

.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.prompt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.prompt-card-head h3 {
  font-size: 0.9375rem;
  font-weight: 700;
}

.prompt-card-tag {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prompt-card-body {
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  background: var(--navy-deep);
}

/* Dentro del modale contenuto (order bump): niente scroll interno per card —
   scorre solo il modale, altrimenti si ottiene uno scroll dentro lo scroll. */
#contentBody .prompt-card-body {
  max-height: none;
  overflow-y: visible;
}

.prompt-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.15s;
}

.copy-btn:hover { border-color: var(--orange); color: var(--orange); }
.copy-btn.copied { border-color: var(--emerald); color: var(--emerald); }

/* ── Bonus grid (iframe embed) ── */
.bonus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.bonus-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.bonus-card:hover { border-color: rgba(249, 115, 22, 0.4); transform: translateY(-2px); }

/* ── Store card (order bump — stessa base visiva di .bonus-card) ── */
.store-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.store-card:hover { transform: translateY(-2px); }
.store-card-owned { border-color: rgba(52, 211, 153, 0.3); }
.store-card-owned .bonus-body p { color: var(--emerald); }
.store-card-locked:hover { border-color: rgba(249, 115, 22, 0.4); }

.bonus-cover {
  aspect-ratio: 1;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.bonus-body { padding: 14px 16px; }
.bonus-body h3 { font-size: 0.875rem; font-weight: 700; margin-bottom: 4px; }
.bonus-body p { font-size: 0.75rem; color: var(--text-faint); }

.upsell-owned-pill {
  display: block;
  width: 100%;
  text-align: center;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #6ee7b7;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  transition: border-color 0.15s, background 0.15s;
}

.upsell-owned-pill:hover {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.16);
}

/* ── Banner upsell (carosello 16:9) ── */
.upsell-banner-wrap {
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
}

.upsell-track {
  display: flex;
  transition: transform 0.6s ease;
}

.upsell-slide {
  flex: 0 0 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
}

.upsell-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.upsell-slide:hover img { transform: scale(1.015); }

.upsell-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.upsell-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}

.upsell-dot.active { background: var(--orange); }

/* ── Viewer modal (Drive iframe embed) ── */
.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 14, 0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.viewer-overlay.open { display: flex; }

.viewer-box {
  width: 100%;
  max-width: 900px;
  height: 85vh;
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: hidden;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.viewer-head h3 { font-size: 0.9375rem; }

.viewer-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 8px;
}

.viewer-close:hover { color: #fff; }

.viewer-box iframe {
  flex: 1;
  border: none;
  width: 100%;
}

/* ── Utility ── */
.btn-back {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 8px 0;
}

.btn-back:hover { color: var(--orange); }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

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

@media (max-width: 640px) {
  .header-inner, .members-main { padding-left: 16px; padding-right: 16px; }
  .auth-card { padding: 32px 24px; }

  .welcome-bar {
    flex-wrap: wrap;
  }
  .welcome-bar .plan-badge {
    margin-left: 0;
    order: 3;
    width: 100%;
  }

  .prompt-card-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .viewer-box {
    height: 90vh;
    max-height: 100dvh;
  }

  .bonus-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

.auth-icon { width: 96px; height: 96px; margin: 0 auto 14px; }
