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

:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --tint: #f1f5f9;
  --card: #ffffff;
  --border-soft: rgba(0, 0, 0, 0.1);
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.1);
  --accent-strong: #ea580c;
  --accent-light: #FBBF24;
  --text: #1f2937;
  --text-light: #374151;
  --muted: #6b7280;
  --danger: #dc2626;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 1.25rem;
}

/* HEADER */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
}

.header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.7rem;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
}

.logo__text {
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  font-style: italic;
  background: linear-gradient(90deg, #6b7280 0%, #9ca3af 25%, #d97706 60%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo__text em {
  font-style: italic;
}

.logo__text strong {
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.nav a {
  position: relative;
  padding-block: 0.15rem;
  color: var(--muted);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.18s ease-out;
}

.nav a:hover {
  color: var(--text);
}

.nav a:hover::after {
  width: 100%;
}

.burger {
  display: none;
  border: 1px solid var(--border-soft);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 1.2rem;
}

/* SECTIONS */

.section {
  padding: 3.5rem 0;
}

.section--tint {
  background: var(--tint);
}

.section__header {
  margin-bottom: 2rem;
  text-align: left;
}

.section__header h2 {
  font-size: 1.7rem;
  margin-bottom: 0.5rem;
}

.section__header p {
  color: var(--muted);
  max-width: 36rem;
}

/* ABOUT / SOBRE NOSOTROS */

.about-content {
  text-align: center;
  padding: 2rem 0;
}

.about-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text);
}

.about-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-soft);
  max-width: 800px;
  margin: 0 auto;
}

.about-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 1rem;
}

.about-stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-stat__number {
  display: inline-block;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent);
  font-style: italic;
  padding: 0.3rem 0.8rem;
  border: 2px solid rgba(147, 197, 253, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
}

.about-stat__label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .about-stats {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .about-title {
    font-size: 2rem;
  }

  .about-stat__number {
    font-size: 2rem;
  }
}

/* HERO */

.hero {
  position: relative;
  padding: 6rem 0;
  min-height: 85vh;
  display: flex;
  align-items: center;
  background-image: url('images/fondoglobos.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.85) 100%);
}

.hero__layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(248, 171, 113, 0.12);
  border-radius: 999px;
  border: 1px solid rgba(248, 171, 113, 0.5);
  padding: 0.28rem 0.75rem;
  margin-bottom: 0.9rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}

.hero__subtitle {
  color: var(--text-light);
  max-width: 42rem;
  margin: 0 auto;
  font-size: 1.1rem;
}

.hero__subtitle strong {
  color: var(--accent);
  font-weight: 600;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0 1.2rem;
}

.hero__highlights {
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero__highlights li::before {
  content: "• ";
  color: var(--accent);
}

.hero__visual {
  display: grid;
  gap: 1rem;
}

.hero__card {
  background: linear-gradient(135deg, var(--accent-light) 0%, #FCD34D 100%);
  border-radius: var(--radius-xl);
  padding: 1.25rem 2rem;
  border: none;
  box-shadow: var(--shadow-soft);
  display: inline-block;
  margin-top: 1rem;
}

.hero__card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.hero__card p {
  color: var(--text-light);
  font-size: 0.85rem;
  margin: 0;
}

.card__rows {
  display: grid;
  gap: 0.4rem;
}

.card__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--muted);
}

.card__row strong {
  color: var(--text);
}

.hero__image-wrapper {
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: var(--shadow-soft);
  max-height: 260px;
}

.hero__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* BUTTONS */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out, border-color 0.12s ease-out;
}

.btn--primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.btn--primary:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.btn--ghost {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn--ghost:hover {
  background: var(--accent-soft);
}

.btn--danger {
  border-color: rgba(239, 68, 68, 0.7);
  color: #fecaca;
}

/* FIELDS */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.field span {
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0.55rem 0.9rem;
  font: inherit;
  color: var(--text);
}

.field textarea {
  border-radius: var(--radius-lg);
  resize: vertical;
  min-height: 80px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.field--inline {
  max-width: 260px;
}

/* MAP LAYOUT */

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 2rem;
}

.map-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  padding: 1.3rem 1.35rem;
  box-shadow: var(--shadow-soft);
  height: 100%;
}

.map-card__header h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.map-card__header p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

#map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  margin-bottom: 0.7rem;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

#spain-map {
  width: 100%;
  height: 100%;
}

#spain-map path {
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

#spain-map .province-inactive {
  fill: rgba(0, 0, 0, 0.08);
}

#spain-map .province-active {
  fill: rgba(249, 115, 22, 0.6);
}

#spain-map .province-hover {
  fill: rgba(249, 115, 22, 0.75);
  stroke: rgba(0, 0, 0, 0.3);
  stroke-width: 1;
}

#spain-map .province-selected {
  fill: rgba(249, 115, 22, 0.9);
  stroke: var(--accent-strong);
  stroke-width: 1.2;
}

.map-error {
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

.map-viewport {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.5);
  margin-bottom: 0.7rem;
  aspect-ratio: 4 / 3;
  min-height: 260px;
  background: #0b1225;
}

.map-viewport__bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(251, 146, 60, 0.32), transparent 55%),
    radial-gradient(circle at 75% 25%, rgba(251, 113, 133, 0.32), transparent 55%),
    radial-gradient(circle at 45% 80%, rgba(56, 189, 248, 0.32), transparent 55%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), #020617 60%);
}

.map-viewport__bg::after {
  content: "";
  position: absolute;
  inset: 6%;
  background-image: url("data:image/svg+xml,%3Csvg width='400' height='300' viewBox='0 0 400 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M70 140 L85 110 L120 70 L170 40 L240 30 L300 55 L345 110 L350 150 L330 200 L290 235 L230 260 L170 255 L120 230 L90 195 Z' fill='%2325d3c7' fill-opacity='0.22' stroke='%235eead4' stroke-width='4' stroke-linejoin='round'/%3E%3Ccircle cx='320' cy='230' r='10' fill='%2325d3c7' fill-opacity='0.18' stroke='%235eead4' stroke-width='3'/%3E%3Ccircle cx='60' cy='230' r='9' fill='%2325d3c7' fill-opacity='0.18' stroke='%235eead4' stroke-width='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.8;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.35));
}

.map-viewport__mesh {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  mix-blend-mode: screen;
  opacity: 0.6;
}

.map-pins {
  position: absolute;
  inset: 0;
}

.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.2rem;
  background: rgba(2, 6, 23, 0.62);
  color: var(--muted);
  font-size: 0.9rem;
}

.map-pin {
  position: absolute;
  top: var(--y);
  left: var(--x);
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease-out, border-color 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

.map-pin:hover {
  transform: translate(-50%, -52%) scale(1.02);
  border-color: var(--accent);
  background: rgba(2, 6, 23, 0.9);
}

.map-pin__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.18);
}

.map-pin__label {
  white-space: nowrap;
}

.map-pin--active {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.14);
  box-shadow: 0 10px 28px rgba(6, 182, 212, 0.26);
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-soft);
  border-top: 1px solid var(--border-soft);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-soft);
}

.dot--active {
  background: var(--accent);
  border-color: var(--accent-strong);
}

.map-note {
  font-size: 0.82rem;
  color: var(--muted);
}

/* PROVINCE SELECTOR */

.province-selector__controls {
  margin-bottom: 0.8rem;
}

.province-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 260px;
  overflow: auto;
  padding-right: 0.25rem;
}

.province-tag {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease-out, border-color 0.12s ease-out, transform 0.08s;
}

.province-tag:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.province-tag--active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}

/* SELECTED COMPANY */

.selected-company {
  margin-top: 1.2rem;
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  padding: 1rem 1.1rem;
  min-height: 120px;
  box-shadow: var(--shadow-soft);
}

.selected-company__title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.selected-company h3 {
  margin-bottom: 0.1rem;
}

.selected-company__subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.selected-company__meta {
  display: grid;
  gap: 0.2rem;
  font-size: 0.88rem;
}

.selected-company__meta a {
  color: var(--accent);
  text-decoration: underline;
}

/* COMPANY LIST */

.list-controls {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.company-list {
  display: grid;
  gap: 0.9rem;
}

.company-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 0.75rem;
}

.company-card__province {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 0.1rem;
}

.company-card h3 {
  font-size: 1rem;
}

.company-card__empty {
  font-size: 0.9rem;
  color: var(--muted);
}

.company-card--highlight {
  animation: highlightCard 2s ease-out;
}

@keyframes highlightCard {
  0% {
    box-shadow: 0 0 0 3px var(--accent);
    background: var(--accent-soft);
  }
  100% {
    box-shadow: var(--shadow-soft);
    background: var(--card);
  }
}

.company-card__data {
  font-size: 0.88rem;
  color: var(--muted);
}

.company-card__data strong {
  color: var(--text);
}

.company-card__data a {
  color: #bfdbfe;
  text-decoration: underline;
}

/* ADMIN */

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
  gap: 1.5rem;
}

.admin-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-soft);
}

.admin-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.admin-help {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.admin-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.admin-status {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
}

.admin-status--success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #166534;
}

.admin-status--error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.admin-status--warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #b45309;
}

/* Province checkboxes grid */
.province-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
}

.province-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.province-checkbox:hover {
  background: rgba(0, 0, 0, 0.05);
}

.province-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.province-checkbox__name {
  font-weight: 500;
  color: var(--text);
}

.province-checkbox__company {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.province-checkbox--has-company {
  background: rgba(249, 115, 22, 0.08);
}

.province-checkbox--has-company .province-checkbox__name {
  color: var(--accent-strong);
}

/* Confirm checkbox */
.field--confirm {
  margin-top: 0.5rem;
}

.confirm-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  color: #b45309;
  cursor: pointer;
}

.confirm-checkbox input[type="checkbox"] {
  margin-top: 0.15rem;
  accent-color: var(--accent);
}

/* Load company selector */
.load-company-select {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.load-company-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.admin-card--secondary textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* FOOTER */

.footer {
  padding: 2rem 0 2.3rem;
  border-top: 1px solid var(--border-soft);
  background: var(--tint);
}

.footer__content {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer__small {
  margin-top: 0.3rem;
  font-size: 0.78rem;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .hero__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__visual {
    order: -1;
  }

  .map-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .company-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .nav {
    position: absolute;
    top: 3.1rem;
    inset-inline: 0;
    background: rgba(255, 255, 255, 0.98);
    flex-direction: column;
    padding: 0.75rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
    box-shadow: var(--shadow-md);
  }

  .nav.nav--open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .burger {
    display: inline-flex;
  }

  .field--inline {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .section {
    padding-block: 3rem;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

  .hero__card {
    padding: 1rem 1.05rem;
  }

  .hero__image-wrapper {
    max-height: 220px;
  }
}
