/* ==========================================================================
   Fiable - Sistema Universal de Pasaportes de Fiabilidad
   Estilos Principales | Diseño de Alta Confianza & Seguridad
   ========================================================================== */

:root {
  --primary-bg: #090e17;
  --surface: #0f172a;
  --surface-card: #141f36;
  --surface-hover: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
  
  --emerald: #059669;
  --emerald-light: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.35);

  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --amber-bg: rgba(245, 158, 11, 0.12);

  --blue: #2563eb;
  --blue-light: #38bdf8;
  --blue-bg: rgba(56, 189, 248, 0.12);

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-emerald: 0 10px 30px -10px rgba(16, 185, 129, 0.4);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* Header & Nav */
.navbar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 16px 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-light) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  color: #fff;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-light) 100%);
  color: #ffffff;
  box-shadow: var(--shadow-emerald);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -8px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-emerald {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  color: #34d399;
}

.badge-amber {
  background: var(--amber-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.badge-blue {
  background: var(--blue-bg);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

/* Hero Section */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-bg-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(15, 23, 42, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 46px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.text-gradient {
  background: linear-gradient(135deg, #ffffff 30%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 36px;
}

/* Buscador Hero */
.search-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 8px 10px 8px 20px;
  display: flex;
  align-items: center;
  max-width: 640px;
  margin: 0 auto 40px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--emerald-light);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  outline: none;
  font-family: inherit;
  padding: 10px 8px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* Tarjetas de Entidades */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.passport-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.passport-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-md);
}

.passport-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.passport-avatar {
  width: 54px;
  height: 54px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.passport-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.passport-category {
  font-size: 13px;
  color: var(--text-muted);
}

/* Estrellas Clásicas de 5 puntos */
.stars-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.star-icon {
  width: 18px;
  height: 18px;
  fill: #334155; /* Estrella inactiva */
}

.star-icon.filled {
  fill: var(--amber);
}

.rating-score {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin-left: 6px;
}

.rating-total {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Pasaporte Oficial Hero (Vista Passport.php) */
.passport-hero {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin: 30px 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Marca de agua de seguridad guilloché */
.passport-security-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--emerald) 0%, var(--blue-light) 50%, var(--amber) 100%);
}

.passport-header-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
}

.passport-big-avatar {
  width: 90px;
  height: 90px;
  background: var(--surface-card);
  border: 2px solid var(--border-strong);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: var(--shadow-md);
}

.passport-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.passport-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.passport-serial-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: right;
  min-width: 220px;
}

.passport-serial-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.passport-serial-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 16px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Panel de Puntuación & Desglose 5 Estrellas */
.score-dashboard {
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 40px;
}

.score-main-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  padding-right: 24px;
}

.score-huge-number {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.score-stars-row {
  margin: 12px 0;
  display: flex;
  justify-content: center;
}

.score-breakdown-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-label {
  width: 70px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.bar-count {
  width: 40px;
  text-align: right;
  color: var(--text-muted);
  font-weight: 600;
}

.trust-meter-card {
  border-left: 1px solid var(--border);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.trust-score-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid var(--emerald-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.trust-circle-num {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.trust-circle-lbl {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--emerald-light);
  font-weight: 700;
}

/* Lista de Reseñas */
.reviews-section {
  margin-top: 40px;
}

.reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.reviews-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active, .filter-btn:hover {
  background: var(--surface-card);
  color: #ffffff;
}

/* Tarjeta individual de reseña */
.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.review-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.review-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.reviewer-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reviewer-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.reviewer-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.reviewer-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.review-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin: 10px 0 8px;
}

.review-body {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Comprobante de Evidencia */
.evidence-box {
  margin-top: 14px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.evidence-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6ee7b7;
}

/* Recibo Criptográfico */
.crypto-receipt-bar {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.receipt-hash {
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  color: #94a3b8;
}

/* Respuesta oficial del propietario */
.owner-reply-box {
  margin-top: 16px;
  padding: 16px;
  background: rgba(30, 41, 59, 0.5);
  border-left: 3px solid var(--emerald-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.owner-reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.owner-reply-text {
  font-size: 13.5px;
  color: #e2e8f0;
}

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

/* Formularios */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--emerald-light);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.interactive-stars {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.star-btn svg {
  width: 32px;
  height: 32px;
  fill: #334155;
  transition: fill 0.15s, transform 0.15s;
}

.star-btn.hovered svg, .star-btn.active svg {
  fill: var(--amber);
  transform: scale(1.1);
}

/* Tabs */
.tab-list {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  margin-bottom: 20px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
}

.tab-btn.active {
  color: #ffffff;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--emerald-light);
}

.code-box {
  background: #06090e;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12.5px;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  margin: 12px 0;
}

/* Footer */
.footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 50px 0 30px;
  color: var(--text-muted);
  font-size: 14px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 900px) {
  .score-dashboard {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .score-main-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 20px;
  }
  .trust-meter-card {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 20px;
  }
  .passport-header-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .passport-big-avatar {
    margin: 0 auto;
  }
  .passport-meta-list {
    justify-content: center;
  }
  .passport-serial-box {
    text-align: center;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
