/* Estilos WAIMoney InsurTech Mobile PWA */
:root {
  --bg-primary: #0b1120;
  --bg-surface: #111827;
  --bg-card: rgba(30, 41, 59, 0.7);
  --border-card: rgba(56, 189, 248, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --brand-blue: #0284c7;
  --brand-blue-glow: #38bdf8;
  --brand-green: #10b981;
  --brand-amber: #f59e0b;
  --brand-red: #ef4444;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: calc(75px + var(--safe-bottom));
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--brand-blue-glow);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.badge-network {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-network.offline {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* Banner de Instalación PWA */
.install-banner {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
  animation: slideDown 0.3s ease-out;
}

.install-banner.hidden {
  display: none !important;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.install-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.install-info .icon {
  font-size: 1.6rem;
}

.install-info h4 {
  font-size: 0.88rem;
  font-weight: 700;
}

.install-info p {
  font-size: 0.72rem;
  color: #e0f2fe;
}

.btn-install {
  background: #ffffff;
  color: #0369a1;
  border: none;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-close-banner {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

/* Institutional Badge Header */
.institutional-bar {
  background: rgba(15, 23, 42, 0.9);
  padding: 6px 18px;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.institutional-bar span strong {
  color: #e2e8f0;
}

/* Main Content & Tabs */
main {
  flex: 1;
  padding: 16px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & UI Elements */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #ffffff;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

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

.form-control, .form-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-blue-glow);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.price-summary-box {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  padding: 16px;
  margin: 18px 0;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: #cbd5e1;
}

.price-row.total {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  padding-top: 10px;
  margin-top: 8px;
  margin-bottom: 0;
}

.price-row.total .highlight {
  color: #38bdf8;
}

.bcv-note {
  font-size: 0.72rem;
  color: var(--brand-blue-glow);
  text-align: right;
  margin-top: 4px;
}

/* Botones principales */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-danger-sos {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
  font-size: 1.05rem;
  padding: 16px;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

/* Carnet Digital */
.digital-carnet {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 2px solid #38bdf8;
  border-radius: 18px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  margin-bottom: 16px;
}

.carnet-watermark {
  position: absolute;
  right: -20px;
  bottom: -20px;
  font-size: 8rem;
  opacity: 0.04;
  pointer-events: none;
}

.carnet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.carnet-entity {
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
}

.carnet-subentity {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.carnet-badge-active {
  background: #10b981;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.carnet-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}

.carnet-field-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.carnet-field-val {
  font-weight: 700;
  color: #f8fafc;
}

.carnet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.qr-placeholder {
  width: 60px;
  height: 60px;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* SOS TuGruero Panel */
.sos-radar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  border: 2px solid #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto 20px;
  position: relative;
  animation: pulseRadar 2s infinite;
}

@keyframes pulseRadar {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 25px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sos-radar .radar-icon {
  font-size: 2.5rem;
}

.location-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0;
  font-size: 0.82rem;
  color: #cbd5e1;
}

/* Renovaciones y Cartera */
.renewal-card-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.renewal-badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.renewal-badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(65px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(11, 17, 32, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  gap: 4px;
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
  background: transparent;
  border: none;
  padding: 8px 0;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  transition: transform 0.2s;
}

.nav-item.active {
  color: var(--brand-blue-glow);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* Modal iOS Instructions */
.ios-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.ios-modal-overlay.hidden {
  display: none !important;
}

.ios-modal-card {
  background: #1e293b;
  border: 1px solid #38bdf8;
  border-radius: 24px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.ios-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  text-align: left;
  font-size: 0.88rem;
}

.ios-step-num {
  width: 28px;
  height: 28px;
  background: #0284c7;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}
