/* =========================================================================
   COMPONENTS: botons, xips, targetes, etiquetes, títols de secció i degradats
   ========================================================================= */

/* ---------- Botons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background-color .15s, box-shadow .15s, transform .1s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:active { transform: scale(.98); }

.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-filled:hover { box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 40%, transparent); }
.btn-tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn-tonal:hover { background: color-mix(in srgb, var(--secondary-container) 85%, var(--on-secondary-container)); }
.btn-text { color: var(--primary); padding: 0 12px 0 10px; }
.btn-text:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.btn-outline { border: 1px solid var(--outline); color: var(--primary); }
.btn-outline:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn-white { background: #fff; color: var(--brand-violet); }
.btn-outline-white { border: 1px solid #fff; color: #fff; }
.btn-outline-white:hover { background: rgba(255, 255, 255, .14); }
.btn-lg { min-height: 56px; font-size: 15px; }
.btn-xl { min-height: 60px; font-size: 16px; font-weight: 700; padding: 0 28px 0 22px; }
@media (max-width: 360px) { .btn-xl { white-space: normal; text-align: center; } }
.btn-xl .icon { width: 22px; height: 22px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  color: var(--on-bg);
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--surface-low); }
.icon-btn-light { color: #fff; }
.icon-btn-light:hover { background: rgba(255, 255, 255, .14); }

/* ---------- Xips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Targetes ---------- */
.card { background: var(--surface-low); border-radius: var(--r-md); }
.card-text { padding: 20px; color: var(--on-variant); font-size: 16px; line-height: 1.6; }
.card.chip-row { padding: 16px; }

/* ---------- Etiquetes ---------- */
.pill-glass,
.pill-dark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.pill-glass { background: rgba(255, 255, 255, .22); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pill-dark { background: rgba(21, 19, 40, .62); }
.pill-glass .icon, .pill-dark .icon { width: 16px; height: 16px; }

/* ---------- Títols de pàgina i de secció ---------- */
.page-head { padding: 8px 4px 0; }
.page-title { font-size: clamp(28px, 4vw, 40px); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.page-sub { margin-top: 4px; color: var(--on-variant); font-size: 14px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 12px 4px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}
.section-title .icon { color: var(--primary); }
.section-hint { margin: -6px 0 14px 4px; color: var(--on-variant); font-size: 14px; max-width: 60ch; }
.subhead { margin: 22px 0 8px; font-size: 16px; font-weight: 700; }

/* ---------- Degradats (iguals que res/drawable/grad_*.xml) ---------- */
.grad-hero    { background: linear-gradient(135deg, var(--brand-violet), var(--brand-magenta), var(--brand-coral)); }
.grad-contact { background: linear-gradient(135deg, var(--brand-teal), var(--brand-blue), var(--brand-violet)); }
.grad-android { background: linear-gradient(135deg, var(--brand-teal), var(--brand-green)); }
.grad-os      { background: linear-gradient(135deg, var(--brand-indigo), var(--brand-cyan)); }
.grad-web     { background: linear-gradient(135deg, var(--brand-blue), var(--brand-violet)); }
.grad-game    { background: linear-gradient(135deg, var(--brand-pink), var(--brand-amber)); }
.grad-other   { background: linear-gradient(135deg, var(--brand-coral), var(--brand-amber)); }
/* Colors extra per a categories noves (es trien al panell) */
.grad-berry   { background: linear-gradient(135deg, var(--brand-violet), var(--brand-magenta)); }
.grad-ocean   { background: linear-gradient(135deg, var(--brand-cyan), var(--brand-blue)); }
.grad-sunset  { background: linear-gradient(135deg, var(--brand-magenta), var(--brand-coral)); }
.grad-night   { background: linear-gradient(135deg, var(--brand-indigo), var(--brand-violet)); }
.grad-lime    { background: linear-gradient(135deg, var(--brand-green), var(--brand-cyan)); }

/* ---------- Cercles decoratius dins dels degradats ---------- */
.deco { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); pointer-events: none; }
.deco-a { width: 220px; height: 220px; right: -70px; top: -80px; }
.deco-b { width: 140px; height: 140px; left: -50px; bottom: -40px; }
.deco-c { width: 170px; height: 170px; right: -40px; top: -60px; }
.deco-d { width: 90px; height: 90px; left: 60px; bottom: -45px; }
.deco-e { width: 220px; height: 220px; right: -60px; bottom: -90px; }

/* ---------- Bàner de projecte (degradat o primera captura) ---------- */
.banner {
  position: relative;
  display: grid;
  place-items: center;
  height: 168px;
  overflow: hidden;
  color: #fff;
}
.banner-icon { width: 64px; height: 64px; position: relative; }
.banner-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.banner-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, .4));
}
.banner .pill-glass { position: absolute; }
.pill-cat { left: 14px; top: 14px; }
.pill-year { right: 14px; top: 14px; }
.pill-count { right: 14px; bottom: 14px; }

/* ---------- Logotip d'una habilitat (web i panell) ---------- */
.skill-logo {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--logo-bg, var(--surface-high)); color: var(--logo-fg, var(--on-bg));
}
.skill-logo svg { width: 22px; height: 22px; fill: currentColor; }
.skill-logo.is-initials { background: var(--c-violet); color: var(--on-violet); font-size: 14px; font-weight: 700; letter-spacing: .02em; }

/* ---------- Portada dels projectes ----------
 * Generada: nom (amb l'any i la categoria) a l'esquerra i la icona de la categoria a la dreta, sobre el degradat.
 * Pròpia: la imatge pujada (retallada a 16:9) omple tota la portada.
 */
.banner.cover {
  isolation: isolate;
  grid-template-columns: minmax(0, 1fr) auto; place-items: center start; gap: 18px;
  height: 200px; padding: 22px 26px 22px 24px;
}
.banner.cover::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .22) 1.2px, transparent 1.6px);
  background-size: 16px 16px;
  -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 85%);
  mask-image: linear-gradient(100deg, transparent 35%, #000 85%);
}
.cover-text { display: grid; gap: 12px; align-content: center; min-width: 0; }
.cover-name {
  margin: 0; font-size: 29px; font-weight: 900; line-height: 1.06; letter-spacing: -.025em; text-wrap: balance;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .12);
}
.cover-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.banner .cover-meta .pill-glass { position: static; }
.cover-badge {
  justify-self: end;
  display: grid; place-items: center; width: 104px; height: 104px; border-radius: 30px;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .4);
  box-shadow: 0 14px 30px rgba(20, 10, 60, .18), inset 0 1px 0 rgba(255, 255, 255, .35);
  transform: rotate(-6deg);
}
.cover-badge .icon.cover-icon { width: 58px; height: 58px; fill: #fff; color: #fff; }
.cover-badge .cat-img.cover-icon { width: 64px; height: 64px; object-fit: contain; }
.banner.cover-image { display: block; padding: 0; }
.banner.cover-image::before { content: none; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-detail.cover { height: 260px; padding: 32px 40px; border-radius: var(--r-lg); }
.banner-detail .cover-name { font-size: 40px; }
.banner-detail .cover-badge { width: 140px; height: 140px; border-radius: 38px; }
.banner-detail .cover-badge .icon.cover-icon { width: 78px; height: 78px; }
.banner-detail.cover-image { height: auto; aspect-ratio: 16 / 9; padding: 0; }
@media (max-width: 420px) {
  .banner.cover { height: 176px; padding: 18px 18px 18px 20px; gap: 12px; }
  .cover-name { font-size: 24px; }
  .cover-badge { width: 80px; height: 80px; border-radius: 24px; }
  .cover-badge .icon.cover-icon { width: 44px; height: 44px; }
  .banner-detail.cover { height: 210px; padding: 22px; }
  .banner-detail .cover-name { font-size: 30px; }
  .banner-detail .cover-badge { width: 96px; height: 96px; }
  .banner-detail .cover-badge .icon.cover-icon { width: 54px; height: 54px; }
}

/* ---------- Icona d'un complement (web, àrea de client i panell) ---------- */
.addon-face { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; color: #fff; }
.addon-face .icon, .addon-face .cat-img { width: 22px; height: 22px; }
.addon-face .cat-img { object-fit: contain; }
.addon-face-lg { width: 52px; height: 52px; border-radius: 16px; }
.addon-face-lg .icon, .addon-face-lg .cat-img { width: 28px; height: 28px; }
.addon-pick-text { display: grid; gap: 2px; min-width: 0; }
.addon-pick-text small { color: var(--on-variant); font-size: 13px; line-height: 1.4; }
.addon-price { font-weight: 700; font-size: 14px; color: var(--primary); }

/* Avís de mode manteniment (només el veu l'administrador) */
.maint-banner { position: sticky; top: 0; z-index: 90; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px;
  padding: 8px 16px; background: #C3134A; color: #fff; font-size: 14px; font-weight: 500; text-align: center; }
.maint-banner .icon { flex: none; width: 18px; height: 18px; }
.maint-banner a { color: #fff; font-weight: 700; text-decoration: underline; }

/* L'administrador mirant l'àrea d'un client (views/view-as-banner.php) */
.view-as-banner { position: sticky; top: 0; z-index: 91; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px;
  padding: 8px 16px; background: #1F1A3D; color: #fff; font-size: 14px; font-weight: 500; text-align: center; }
.view-as-banner > .icon { flex: none; width: 18px; height: 18px; }
.view-as-banner form { margin: 0; }
.view-as-banner button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 14px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 999px;
  background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.view-as-banner button:hover, .view-as-banner button:focus-visible { background: rgba(255, 255, 255, .14); outline: none; }
.view-as-banner button .icon { width: 18px; height: 18px; }

/* ---------- Llista de fitxers adjunts d'un contracte (àrea de client i panell) ---------- */
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 12px; border-radius: 14px; background: var(--bg); }
.file-item .file-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-container); color: var(--primary); }
.file-item .file-icon .icon { width: 20px; height: 20px; }
.file-item .file-main { display: grid; flex: 1; min-width: 0; }
.file-item .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-item small { color: var(--on-variant); font-size: 12px; }
