/* ================================================================
   sp-cards.css — Bento Grid + Bottom-Sheet Modal
   NORA · SaaS Fiscal & Inmobiliario
   ================================================================ */

/* Fuente consistente en todos los elementos del módulo */
.sp2-section, .sp2-sheet, .sp2-sheet-backdrop,
.sp2-section *, .sp2-sheet * {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── Variables ────────────────────────────────────────────────── */
:root {
  --sp2-navy:    #00274e;
  --sp2-dark:    #edf1f7;
  --sp2-card-bg: #ffffff;
  --sp2-border:  rgba(0,39,78,0.12);
  --sp2-gold:    #c49a30;
  --sp2-gold-dk: #a07a18;
  --sp2-text:    #00274e;
  --sp2-muted:   rgba(0,39,78,0.55);
  --sp2-radius:  12px;
  --sp2-gap:     14px;
}

/* ── Section ──────────────────────────────────────────────────── */
.sp2-section {
  background: var(--sp2-dark);
  padding: clamp(4rem, 7vw, 7rem) 0;
  position: relative;
}

/* ── Intro ────────────────────────────────────────────────────── */
.sp2-intro {
  text-align: center;
  max-width: 680px;
  margin: 0 auto clamp(2.5rem, 4vw, 4rem);
  padding: 0 1rem;
}

.sp2-eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sp2-gold);
  margin-bottom: .75rem;
}

.sp2-h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 800;
  color: var(--sp2-navy);
  line-height: 1.2;
  margin: 0 0 1rem;
}

.sp2-sub {
  font-size: clamp(.9rem, 1.4vw, 1.05rem);
  color: var(--sp2-muted);
  line-height: 1.65;
  margin: 0;
}

/* ── Bento Grid ───────────────────────────────────────────────── */
.sp2-bento {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--sp2-gap);
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(.75rem, 3vw, 1.5rem);
}

/* ── Card base ────────────────────────────────────────────────── */
.sp2-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--sp2-card-bg);
  border: 1px solid var(--sp2-border);
  border-radius: var(--sp2-radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: border-color .25s ease, transform .22s ease, box-shadow .25s ease;
  padding: 0;
  min-height: 200px;
}

.sp2-card:hover {
  border-color: rgba(0,39,78,0.22);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,39,78,0.12);
}

.sp2-card:focus-visible {
  outline: 2px solid var(--sp2-gold);
  outline-offset: 2px;
}

/* ── Expand indicator ────────────────────────────────────────── */
.sp2-card__expand {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(0,39,78,0.07);
  border: 1px solid rgba(0,39,78,0.1);
  color: rgba(0,39,78,0.4);
  transition: background .22s ease, color .22s ease, border-color .22s ease, transform .22s ease;
  pointer-events: none;
  flex-shrink: 0;
}

/* Dark cards: lighter expand icon */
.sp2-card--nie .sp2-card__expand,
.sp2-card--lic .sp2-card__expand,
.sp2-card__main-left .sp2-card__expand {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.45);
}

/* Hover: expand icon animates + card bg shifts */
.sp2-card:hover .sp2-card__expand {
  background: rgba(0,39,78,0.09);
  border-color: var(--sp2-gold);
  color: var(--sp2-gold);
  transform: scale(1.1);
}

.sp2-card--nie:hover .sp2-card__expand,
.sp2-card--lic:hover .sp2-card__expand {
  background: rgba(255,255,255,0.15);
  border-color: #f0cb6a;
  color: #f0cb6a;
}

/* Main card: expand icon sits on left dark panel */
.sp2-card__main-left {
  position: relative;
}

/* Light card hover: subtle background tint */
.sp2-card--fin:hover,
.sp2-card--share:hover {
  background: #f0f4ff;
  border-color: rgba(0,39,78,0.2);
}

/* Dark card hover: slightly lighter */
.sp2-card--nie:hover {
  background: #002558;
}

.sp2-card--lic:hover {
  background: #3d1c00;
}

/* ── Card placements ─────────────────────────────────────────── */
.sp2-card--main  { grid-column: 1 / 3; flex-direction: row; min-height: 260px; overflow: hidden; }
.sp2-card--fin   { grid-column: 3 / 4; }
.sp2-card--share { grid-column: 1 / 2; min-height: 180px; }
.sp2-card--nie   { grid-column: 2 / 3; min-height: 220px; }
.sp2-card--lic   { grid-column: 3 / 4; min-height: 220px; }

/* ── Main card: split dark-left / light-right ────────────────── */
.sp2-card--main { background: none; padding: 0; }

.sp2-card__main-left {
  flex: 0 0 46%;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: clamp(1.4rem, 2.5vw, 2rem) clamp(1.25rem, 2vw, 1.75rem);
  background: linear-gradient(145deg, #001f46 0%, #00274e 100%);
  position: relative;
  z-index: 2;
}

.sp2-card__main-right {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f5f8fc;
  min-height: 200px;
}

.sp2-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Card icons ───────────────────────────────────────────────── */
.sp2-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0,39,78,0.07);
  border: 1px solid rgba(0,39,78,0.12);
  color: var(--sp2-navy);
  flex-shrink: 0;
  margin-bottom: .15rem;
}

/* Overlay & dark-panel icons stay white */
.sp2-card__content--over .sp2-card__icon,
.sp2-card__main-left .sp2-card__icon {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}

.sp2-card__content--over .sp2-card__icon {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
}

/* ── Card content tweaks ─────────────────────────────────────── */
.sp2-card__main-left .sp2-card__title {
  font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  line-height: 1.25;
  color: #fff;
}

.sp2-card__main-left .sp2-card__desc {
  color: rgba(200,218,240,0.75);
}

.sp2-card__main-left .sp2-card__label {
  font-size: .68rem;
}

.sp2-card__main-left .sp2-card__arrow {
  margin-top: auto;
}

/* Dark panels: use lighter gold for readability */
.sp2-card__main-left .sp2-card__label,
.sp2-card__main-left .sp2-card__arrow,
.sp2-card__content--over .sp2-card__label {
  color: #f0cb6a;
}

/* ── Card content ────────────────────────────────────────────── */
.sp2-card__content {
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
  position: relative;
  z-index: 2;
}

.sp2-card__content--over {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,20,50,0.95) 0%, rgba(0,20,50,0.5) 75%, transparent 100%);
  padding: 1.25rem 1.25rem 1.4rem;
  gap: .3rem;
}

/* Ensure all text in overlay is white */
.sp2-card__content--over .sp2-card__desc { color: rgba(220,235,255,0.8); }
.sp2-card__content--over .sp2-card__arrow { color: #f0cb6a; }

.sp2-card__label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sp2-gold);
}

.sp2-card__title {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  font-weight: 700;
  color: var(--sp2-text);
  margin: 0;
  line-height: 1.3;
}

/* Overlay cards (NIE/LIC globe) keep white text */
.sp2-card__content--over .sp2-card__title { color: #fff; }

.sp2-card--main .sp2-card__title {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.sp2-card__desc {
  font-size: clamp(.8rem, 1.2vw, .9rem);
  color: var(--sp2-muted);
  line-height: 1.55;
  margin: 0;
}

.sp2-card__arrow {
  font-size: .82rem;
  font-weight: 600;
  color: var(--sp2-gold);
  margin-top: auto;
  padding-top: .25rem;
}

/* ── Price tag ───────────────────────────────────────────────── */
.sp2-card__tag {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  background: rgba(100,160,255,0.18);
  border: 1px solid rgba(100,160,255,0.3);
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  color: #a8d0ff;
  width: fit-content;
  letter-spacing: .03em;
}

.sp2-card__tag--gold {
  background: rgba(240,203,106,0.15);
  border-color: rgba(240,203,106,0.3);
  color: var(--sp2-gold);
}

/* ── Visuals ─────────────────────────────────────────────────── */
.sp2-card__visual {
  flex-shrink: 0;
}

/* Dashboard visual (main card) */
.sp2-card__visual--dashboard {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.5rem 1.5rem 0;
}

.sp2-dash {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  width: 100%;
  max-width: 240px;
}

.sp2-dash__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .3rem 0;
  font-size: .78rem;
  color: rgba(200,218,240,0.65);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sp2-dash__row:last-of-type,
.sp2-dash__row--total {
  border-bottom: none;
}

.sp2-dash__row--total {
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
  margin-top: .25rem;
  padding-top: .4rem;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sp2-dash__lbl { color: rgba(200,218,240,0.6); }
.sp2-dash__val { color: #fff; font-weight: 600; font-size: .82rem; }
.sp2-dash__val--gold { color: var(--sp2-gold); }

.sp2-dash__divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: .4rem 0;
}

.sp2-dash__bar-wrap {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.sp2-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .7rem;
  color: rgba(200,218,240,0.7);
}

.sp2-bar::after {
  content: '';
  height: 4px;
  width: var(--w, 50%);
  background: linear-gradient(90deg, var(--sp2-gold) 0%, rgba(240,203,106,0.4) 100%);
  border-radius: 4px;
  order: -1;
  flex-shrink: 0;
}

.sp2-bar span { order: -2; min-width: 4.5rem; }
.sp2-bar em { font-style: normal; margin-left: auto; }

/* Chart visual (fin card) */
.sp2-card__visual--chart {
  padding: 0 1.25rem 1rem;
  opacity: .85;
}

/* Lines visual (share card) */
.sp2-card__visual--lines {
  padding: 0 1.25rem 1.25rem;
}

.sp2-lines {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.sp2-line {
  height: 6px;
  border-radius: 6px;
  width: var(--w, 60%);
  background: rgba(0,39,78,0.1);
}

.sp2-line--gold {
  background: linear-gradient(90deg, var(--sp2-gold) 0%, rgba(240,203,106,0.3) 100%);
}

/* Globe canvas (nie / licencia cards) */
.sp2-globe-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

/* Card accents */
.sp2-card--nie {
  background: #001f46;
}

.sp2-card--lic {
  background: #2d1500;
}

.sp2-card--main {
  background: var(--sp2-card-bg);
  border-color: var(--sp2-border);
}

.sp2-card--fin {
  background: #ffffff;
}

.sp2-card--share {
  background: #ffffff;
}

/* ── Globe canvas ─────────────────────────────────────────────── */
.sp2-globe-canvas {
  pointer-events: none;
}

/* ================================================================
   BOTTOM-SHEET MODAL
   ================================================================ */

/* Backdrop */
.sp2-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 5, 15, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 900;
  opacity: 0;
  transition: opacity .3s ease;
}

.sp2-sheet-backdrop.sp2--in {
  opacity: 1;
}

/* Sheet */
.sp2-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 901;
  background: #0d1f36;
  border-top: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px 14px 0 0;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(110%);
  transition: transform .38s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sp2-sheet.sp2--in {
  transform: translateY(0);
}

/* Handle + close */
.sp2-sheet__handle {
  width: 44px;
  height: 4px;
  background: rgba(255,255,255,0.22);
  border-radius: 4px;
  margin: 14px auto 0;
  cursor: grab;
}

.sp2-sheet__close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  color: var(--sp2-text);
  cursor: pointer;
  transition: background .2s;
}

.sp2-sheet__close:hover { background: rgba(255,255,255,0.16); }
.sp2-sheet__close:focus-visible { outline: 2px solid var(--sp2-gold); }

/* Sheet inner layout */
.sp2-sheet__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: 2rem 2.5rem 2.5rem;
  max-width: 960px;
  margin: 0 auto;
}

/* Left panel */
.sp2-sheet__left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sp2-sheet__globe-wrap {
  width: 100%;
  aspect-ratio: 1;
  max-width: 280px;
  margin: 0 auto;
  position: relative;
  border-radius: 50%;
  overflow: hidden;
}

.sp2-sheet__globe-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sp2-sheet__stats {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.sp2-stat {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.sp2-stat__label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(200,218,240,0.6);
}

.sp2-stat__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.sp2-stat__value--gold { color: var(--sp2-gold); }

.sp2-stat__bar-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-top: .3rem;
}

.sp2-stat__bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--sp2-gold), rgba(240,203,106,0.5));
  transition: width .6s ease;
}

/* Right panel */
.sp2-sheet__right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sp2-sheet__title {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.sp2-sheet__price {
  font-size: .9rem;
  font-weight: 700;
  color: var(--sp2-gold);
  margin-top: -.25rem;
}

.sp2-sheet__rows {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-top: .25rem;
}

.sp2-srow {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
}

.sp2-srow__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
  margin-top: .05rem;
}

.sp2-srow__body {
  flex: 1;
}

.sp2-srow__title {
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 .15rem;
}

.sp2-srow__text {
  font-size: .82rem;
  color: rgba(200,218,240,0.7);
  line-height: 1.55;
  margin: 0;
}

/* Sheet CTA */
.sp2-sheet__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1.75rem;
  background: linear-gradient(180deg, var(--sp2-gold) 0%, var(--sp2-gold-dk) 100%);
  color: #001f3d;
  font-weight: 700;
  font-size: .95rem;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity .2s, transform .2s;
  margin-top: auto;
}

.sp2-sheet__cta:hover {
  opacity: .9;
  transform: translateY(-1px);
}

/* ================================================================
   RESPONSIVE — mobile-first overrides
   ================================================================ */

/* ── Tablet (≤900px) ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sp2-section { padding: clamp(2.5rem, 5vw, 4rem) 0; }

  .sp2-bento {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .sp2-card--main  { grid-column: 1 / 3; flex-direction: column; min-height: auto; }
  .sp2-card__main-left { flex: none; padding: 1.4rem 1.25rem 1.25rem; }
  .sp2-card__main-right { min-height: 200px; }
  .sp2-card--fin   { grid-column: 1 / 2; }
  .sp2-card--share { grid-column: 2 / 3; }
  .sp2-card--nie   { grid-column: 1 / 2; min-height: 200px; }
  .sp2-card--lic   { grid-column: 2 / 3; min-height: 200px; }

  .sp2-card__visual--dashboard { padding: .75rem; }
  .sp2-dash { max-width: 100%; }

  .sp2-sheet__inner {
    grid-template-columns: 1fr;
    padding: 1.5rem 1.25rem 2rem;
    gap: 1.25rem;
  }
  .sp2-sheet__globe-wrap { max-width: 180px; }
  .sp2-sheet__title { font-size: 1.4rem; }
}

/* ── Large phone (≤600px) ─────────────────────────────────────── */
@media (max-width: 600px) {
  .sp2-section { padding: 2.5rem 0; }
  .sp2-intro { margin-bottom: 1.5rem; }
  .sp2-h2 { font-size: clamp(1.4rem, 6vw, 1.9rem); }
  .sp2-sub { font-size: .88rem; }

  .sp2-bento {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sp2-card--main,
  .sp2-card--fin,
  .sp2-card--share,
  .sp2-card--nie,
  .sp2-card--lic {
    grid-column: 1 / 2;
  }

  /* Main card: left panel full, right map compact */
  .sp2-card--main { flex-direction: column; }
  .sp2-card__main-left { padding: 1.25rem 1.1rem 1.1rem; gap: .4rem; }
  .sp2-card__main-left .sp2-card__title { font-size: 1.05rem; }
  .sp2-card__main-right { min-height: 160px; }

  /* Other cards */
  .sp2-card { min-height: auto !important; }
  .sp2-card__content { padding: 1.1rem; gap: .35rem; }
  .sp2-card__content--over { padding: 1rem; }
  .sp2-card__title { font-size: .95rem; }
  .sp2-card__desc { font-size: .8rem; }
  .sp2-card__icon { width: 34px; height: 34px; }

  /* NIE/Licencia globe cards: fixed height */
  .sp2-card--nie,
  .sp2-card--lic { min-height: 180px !important; }

  /* Fin card: hide chart on mobile */
  .sp2-card__visual--chart { display: none; }

  /* Share card: compact lines */
  .sp2-card__visual--lines { padding: 0 1.1rem .9rem; }
  .sp2-line { height: 5px; }

  /* Bottom-sheet modal */
  .sp2-sheet {
    max-height: 92svh;
    border-radius: 18px 18px 0 0;
  }
  .sp2-sheet__inner {
    grid-template-columns: 1fr;
    padding: 1rem 1rem 1.5rem;
    gap: 1rem;
  }
  .sp2-sheet__left { display: none; } /* hide globe/stats on very small */
  .sp2-sheet__right { padding: 0; }
  .sp2-sheet__title { font-size: 1.15rem; }
  .sp2-sheet__price { font-size: .82rem; }
  .sp2-sheet__rows { gap: .65rem; }
  .sp2-srow { gap: .65rem; }
  .sp2-srow__icon svg { width: 18px; height: 18px; }
  .sp2-srow__title { font-size: .82rem; }
  .sp2-srow__text { font-size: .78rem; }
  .sp2-sheet__cta { padding: .75rem 1.25rem; font-size: .88rem; }

  .sp2-stat__value { font-size: 1.2rem; }
}

/* ── Small phone (≤375px) ─────────────────────────────────────── */
@media (max-width: 375px) {
  .sp2-h2 { font-size: 1.35rem; }
  .sp2-card__main-right { min-height: 130px; }
  .sp2-card--nie, .sp2-card--lic { min-height: 160px !important; }
  .sp2-sheet__title { font-size: 1rem; }
  .sp2-srow__text { font-size: .75rem; }
}
