/* ============================================================
   Clube ToolNest — folha de estilos partilhada
   Identidade ToolNest: azuis + verdes, Space Grotesk + Inter
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --b900:#0a2f4a; --b700:#0f4c75; --b500:#1a6fa6; --b200:#a8d4f0; --b50:#eaf5fc;
  --g800:#0e4a2d; --g600:#1a7a4a; --g400:#2db870; --g200:#9de8c0; --g50:#eafaf2;
  --n900:#141414; --n800:#1e1e1e; --n600:#4a4a4a; --n400:#8a8a8a;
  --n200:#d4d4d4; --n100:#f0f0f0; --n50:#fafafa;
  --red:#c62828; --red-bg:#fff5f5; --red-border:#ffcdd2;
  --amber:#b45309; --amber-bg:#fffbeb; --amber-border:#fde68a;
  --fd:'Space Grotesk', sans-serif;
  --fb:'Inter', sans-serif;
  --shadow-sm:0 1px 3px rgba(10,47,74,.08);
  --shadow-md:0 8px 30px rgba(10,47,74,.10);
  --shadow-lg:0 20px 60px rgba(10,47,74,.18);
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--fb);
  background: var(--n50);
  color: var(--n800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--fb); font-size: 15px; font-weight: 600;
  padding: 13px 26px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  line-height: 1; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--g400); color: #04371f; box-shadow: 0 6px 18px rgba(45,184,112,.35); }
.btn-primary:hover { background: var(--g600); color: #fff; box-shadow: 0 8px 24px rgba(26,122,74,.4); }
.btn-ghost { background: transparent; color: var(--b700); border-color: var(--n200); }
.btn-ghost:hover { border-color: var(--b500); background: var(--b50); }
.btn-light { background: #fff; color: var(--b900); box-shadow: var(--shadow-sm); }
.btn-light:hover { box-shadow: var(--shadow-md); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- Nav topo (páginas públicas) ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--n100);
}
.brand { font-family: var(--fd); font-size: 20px; font-weight: 800; letter-spacing: -.5px; color: var(--b900); }
.brand span { color: var(--g400); }
.brand small { display:block; font-family: var(--fb); font-size: 10px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--n400); margin-top: 2px; }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- Autenticação (registo / login / recuperar) ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-side {
  background: linear-gradient(150deg, var(--b900) 0%, var(--b700) 55%, var(--g800) 100%);
  color: #fff; padding: 56px 48px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side::before { content:''; position:absolute; width:420px; height:420px; border-radius:50%; border:1px solid rgba(255,255,255,.07); top:-140px; right:-140px; }
.auth-side::after  { content:''; position:absolute; width:260px; height:260px; border-radius:50%; border:1px solid rgba(45,184,112,.18); bottom:-90px; left:-70px; }
.auth-side-brand { font-family: var(--fd); font-size: 22px; font-weight: 800; letter-spacing: -.5px; position: relative; z-index: 1; }
.auth-side-brand span { color: var(--g400); }
.auth-side-mid { position: relative; z-index: 1; }
.auth-side-badge { display:inline-block; background:rgba(45,184,112,.18); border:1px solid rgba(45,184,112,.4); color:var(--g400); font-size:11px; font-weight:700; letter-spacing:2px; text-transform:uppercase; padding:6px 14px; border-radius:20px; margin-bottom:22px; }
.auth-side h2 { font-family: var(--fd); font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin-bottom: 16px; }
.auth-side p { color: rgba(255,255,255,.65); font-size: 15px; max-width: 380px; }
.auth-side ul { list-style: none; margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.auth-side li { display:flex; gap:10px; align-items:flex-start; font-size:14px; color:rgba(255,255,255,.8); }
.auth-side li::before { content:'✓'; color: var(--g400); font-weight: 800; flex-shrink:0; }
.auth-side-foot { position: relative; z-index: 1; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,.3); }

.auth-form-col { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-family: var(--fd); font-size: 28px; font-weight: 800; letter-spacing: -.8px; color: var(--b900); margin-bottom: 6px; }
.auth-card .sub { color: var(--n600); font-size: 15px; margin-bottom: 28px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--n800); margin-bottom: 7px; }
.field input {
  width: 100%; font-family: var(--fb); font-size: 15px; color: var(--n900);
  padding: 13px 15px; border: 1.5px solid var(--n200); border-radius: 11px;
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { outline: none; border-color: var(--g400); box-shadow: 0 0 0 4px rgba(45,184,112,.14); }
.field input::placeholder { color: var(--n400); }
.field .hint { font-size: 12px; color: var(--n400); margin-top: 6px; }

.field-pass { position: relative; }
.field-pass .toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--n400);
  font-size: 13px; font-weight: 600; padding: 4px;
}
.field-pass .toggle:hover { color: var(--b700); }

.auth-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: 13px; }
.auth-row a { color: var(--b700); font-weight: 600; }
.auth-row a:hover { text-decoration: underline; }

.auth-foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--n600); }
.auth-foot a { color: var(--b700); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

/* mensagens de feedback */
.msg { border-radius: 11px; padding: 12px 15px; font-size: 13.5px; line-height: 1.5; margin-bottom: 18px; display: none; }
.msg.show { display: block; }
.msg-error { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); }
.msg-ok { background: var(--g50); border: 1px solid var(--g200); color: var(--g800); }

/* ---------- Biblioteca ---------- */
.lib-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--n100);
}
.lib-user { display: flex; align-items: center; gap: 12px; }
.lib-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(140deg, var(--b500), var(--g400)); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--fd); font-weight: 700; font-size: 15px; }
.lib-user-info .n { font-size: 14px; font-weight: 600; color: var(--n900); line-height: 1.2; }
.lib-user-info .p { font-size: 11px; color: var(--g600); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.link-logout { font-size: 13px; font-weight: 600; color: var(--n400); cursor: pointer; background: none; border: none; }
.link-logout:hover { color: var(--red); }

.lib-hero { background: linear-gradient(150deg, var(--b900), var(--b700) 70%, var(--g800)); color: #fff; padding: 44px 28px 40px; }
.lib-hero-inner { max-width: 1080px; margin: 0 auto; }
.lib-hero .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--g400); margin-bottom: 10px; }
.lib-hero h1 { font-family: var(--fd); font-size: 32px; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px; }
.lib-hero p { color: rgba(255,255,255,.65); font-size: 15px; max-width: 560px; }

.lib-body { max-width: 1080px; margin: 0 auto; padding: 36px 28px 80px; }

.cat-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 34px; position: sticky; top: 67px; z-index: 20; background: var(--n50); padding: 12px 0; }
.cat-pill { font-family: var(--fb); font-size: 13.5px; font-weight: 600; padding: 9px 18px; border-radius: 30px; border: 1.5px solid var(--n200); background: #fff; color: var(--n600); cursor: pointer; transition: all .15s ease; }
.cat-pill:hover { border-color: var(--g400); color: var(--g600); }
.cat-pill.active { background: var(--b900); border-color: var(--b900); color: #fff; }

.cat-block { margin-bottom: 48px; scroll-margin-top: 130px; }
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cat-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cat-icon.c-org { background: var(--b50); }
.cat-icon.c-redes { background: var(--g50); }
.cat-icon.c-vender { background: #fff3e0; }
.cat-title { font-family: var(--fd); font-size: 21px; font-weight: 700; letter-spacing: -.5px; color: var(--b900); }
.cat-sub { font-size: 13.5px; color: var(--n400); margin-bottom: 20px; padding-left: 54px; }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.res-card {
  background: #fff; border: 1px solid var(--n200); border-radius: 16px; padding: 22px;
  display: flex; flex-direction: column; gap: 12px; transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.res-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--b200); }
.res-top { display: flex; align-items: center; justify-content: space-between; }
.res-type { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; }
.res-type.t-pdf { background: var(--red-bg); color: var(--red); }
.res-type.t-template { background: var(--b50); color: var(--b700); }
.res-type.t-video { background: #f3e8ff; color: #7c3aed; }
.res-type.t-link { background: var(--g50); color: var(--g600); }
.res-card h3 { font-family: var(--fd); font-size: 17px; font-weight: 700; color: var(--n900); letter-spacing: -.3px; }
.res-card p { font-size: 13.5px; color: var(--n600); flex: 1; }
.res-card .res-cta { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--g600); display: inline-flex; align-items: center; gap: 6px; }
.res-card:hover .res-cta { gap: 10px; }

.empty { text-align: center; padding: 60px 20px; color: var(--n400); }
.empty .ico { font-size: 40px; margin-bottom: 12px; }
.empty h3 { font-family: var(--fd); font-size: 18px; color: var(--n600); margin-bottom: 6px; }

/* skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--n100) 25%, #e8e8e8 50%, var(--n100) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* spinner nos botões */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 560px) {
  .nav { padding: 14px 18px; }
  .lib-topbar { padding: 12px 16px; }
  .lib-hero { padding: 32px 18px; }
  .lib-hero h1 { font-size: 26px; }
  .lib-body { padding: 24px 16px 60px; }
  .cat-nav { top: 63px; }
  .res-grid { grid-template-columns: 1fr; }
}
