/* css/base.css - utilidades base compartidas */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

:root { --tn-primary: #b13333; --tn-secondary: #1f4f7a; --tn-accent: #2f855a; --bg:#ffffff; --muted:#6b7280; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.2rem; }

html,body{height:100%;}
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; color:#111827; background:var(--bg); line-height:1.45; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; border: none; padding: 0.6rem 1.1rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, var(--tn-primary), var(--tn-secondary)); color: #fff; }
.btn-outline { background: transparent; border: 1px solid rgba(0,0,0,0.08); color: inherit; }

.badge { display:inline-block; padding:0.25rem 0.6rem; border-radius:999px; font-weight:700; font-size:0.75rem; }

.muted { color: var(--muted); }

.tn-loading { padding:1.5rem; text-align:center; color:var(--muted); }

/* Form error / inline messages */
.form-error { padding:0.8rem 1rem; background:#fff6f6; border:1px solid #fecaca; color:#991b1b; border-radius:8px; margin-bottom:1rem; font-weight:600; }

/* Generic inline status message (created dynamically) */
.status-message { padding:0.8rem 1rem; background:#ffffff; border:1px solid rgba(0,0,0,0.06); border-radius:8px; margin-bottom:1rem; font-weight:600; }
.status-message { word-wrap: break-word; }
.status-success { background: #ecfdf5; border-color: #bbf7d0; color: #065f46; }
.status-error { background:#fff6f6; border-color:#fecaca; color:#991b1b; }
.status-info { background:#f0f9ff; border-color:#bfdbfe; color:#1e40af; }
.status-warning { background:#fffbeb; border-color:#fde68a; color:#92400e; }

/* Pagination small helpers */
.pagination { display:flex; gap:0.5rem; align-items:center; justify-content:center; padding:1rem 0; }
.pagination .pagination-btn { background: transparent; border:1px solid rgba(0,0,0,0.06); padding:0.45rem 0.75rem; border-radius:8px; cursor:pointer; }
.pagination .pagination-btn.active { background: var(--tn-secondary); color: #fff; border-color: var(--tn-secondary); }
.pagination .pagination-btn:disabled { opacity:0.5; cursor:default; }

/* Header / nav common helpers */
.site-header { background: #fff; border-bottom:1px solid #eef2f6; }
.site-header .header-inner { max-width:1200px; margin:0 auto; padding:0.8rem 1.2rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.brand { display:flex; align-items:center; gap:0.75rem; text-decoration:none; color:inherit; }
.brand-mark { height:44px; width:44px; object-fit:contain; }
.brand-text .brand-title { font-weight:800; font-size:1.05rem; }
.brand-text .brand-subtitle { font-size:0.86rem; color:var(--tn-secondary); }
.main-nav { display:flex; gap:0.75rem; align-items:center; }
.nav-toggle { display:none; background:transparent; border:none; }

/* Footer */
.site-footer { margin-top:2rem; padding:2rem; background:#f8fafc; border-top:1px solid #e6edf3; }
.site-footer .footer-inner { max-width:1000px; margin:0 auto; display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; }

/* Hero CTA group */
.hero-ctas { margin-top:1rem; display:flex; gap:0.75rem; flex-wrap:wrap; }

/* Session block */
.session-info { display:flex; align-items:center; gap:1rem; }
.session-info .session-email { font-size:0.95rem; color:#374151; text-align:right; }

/* Form improvements */
.form-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:1rem; }
.field-full { grid-column: 1 / -1; }
.section-title { font-weight:700; margin-top:0.6rem; margin-bottom:0.4rem; }
.form-group { display:flex; flex-direction:column; gap:0.35rem; }
label { font-weight:600; }
input[type="text"], input[type="email"], input[type="number"], textarea, select { padding:0.6rem 0.75rem; border:1px solid #e6eef4; border-radius:8px; font-size:0.95rem; width:100%; box-sizing:border-box; }
textarea { min-height:80px; }
.required-indicator { color:#ef4444; margin-left:0.25rem; font-weight:700; }
.optional-indicator { color:#6b7280; margin-left:0.25rem; font-weight:400; font-size:0.85em; }

.form-actions { display:flex; gap:0.6rem; align-items:center; }

/* Sección de login en registro */
.registro-login-section {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}
.registro-login-section p {
  color: #6b7280;
  font-size: 0.95rem;
}
.registro-login-section .link-login {
  color: #16a34a;
  font-weight: 600;
  text-decoration: none;
}
.registro-login-section .link-login:hover {
  text-decoration: underline;
}

.mb-1 { margin-bottom:1rem; }

@media (max-width:720px) {
	.nav-toggle { display:block; }
	.main-nav { display:none; }
}

/* Elements created by JS */
.card-small-meta { font-size:0.75rem; color:var(--muted); }
.icon-inline { margin-right:0.4rem; vertical-align:middle; }
.wa-btn { margin-top:0.8rem; }
.map-frame { width:100%; height:360px; border-radius:12px; overflow:hidden; border:1px solid #e6eef4; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.map-iframe { width:100%; height:100%; border:0; }
.map-title { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 0.8rem;
  font-size: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.map-external-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-secondary, #0284c7);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.1);
  transition: all 0.2s ease;
}
.map-external-link:hover {
  background: rgba(2, 132, 199, 0.2);
  color: #0369a1;
}
.map-address {
  margin: 0 0 0.8rem 0;
  color: var(--color-text-muted, #64748b);
  font-size: 0.95rem;
}
.zoom-cursor { cursor: zoom-in; }

/* Preview grid for image uploads / galleries */
.preview-grid { display:flex; gap:0.5rem; flex-wrap:wrap; margin-top:0.6rem; }
.preview-item { width:120px; height:90px; border-radius:8px; overflow:hidden; position:relative; border:1px solid #e6eef4; background:#f8fafc; }
.preview-item img { width:100%; height:100%; object-fit:cover; display:block; }
.preview-remove { position:absolute; top:6px; right:6px; background:rgba(0,0,0,0.6); color:white; border:none; border-radius:6px; padding:0.15rem 0.4rem; cursor:pointer; }

/* Admin user cards */
.usuario-card { padding:1rem; border:1px solid #e5e7eb; border-radius:8px; margin-bottom:0.8rem; background:#fafafa; }
.usuario-card .usuario-meta { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; }
.usuario-card .empresa-text { font-size:0.85rem; color:#9ca3af; margin-top:0.3rem; }
.usuario-actions { display:flex; gap:0.5rem; }
.btn-aprobar { background:#10b981; color:white; border:none; padding:0.5rem 1rem; border-radius:6px; cursor:pointer; font-size:0.9rem; }
.btn-rechazar { background:#ef4444; color:white; border:none; padding:0.5rem 1rem; border-radius:6px; cursor:pointer; font-size:0.9rem; }
.link-profile { color:#3b82f6; text-decoration:underline; }

/* ========== HEADER SYSTEM ========== */
/* Card header - for headers inside cards */
.card-header { margin-bottom: 1.25rem; }
.card-header h2 { font-size: 1.25rem; font-weight: 700; color: #1e293b; margin: 0 0 0.25rem 0; }
.card-header p { color: #64748b; font-size: 0.875rem; margin: 0; }

/* Section header - for sections within pages */
.section-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #e2e8f0; }
.section-header h2 { font-size: 1.35rem; font-weight: 700; color: #1e293b; margin: 0 0 0.25rem 0; display: flex; align-items: center; gap: 0.5rem; }
.section-header p { color: #64748b; font-size: 0.9rem; margin: 0; }

/* Small helpers */
.form-actions { display:flex; gap:0.6rem; align-items:center; }
.mb-1 { margin-bottom:1rem; }

/* ========== BOTÓN VOLVER AL INICIO ========== */
.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-back-home:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateX(-2px);
}
.btn-back-home:focus {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}
/* Container para posicionar el botón */
.back-home-container {
  padding: 0.8rem 1.2rem;
  background: transparent;
}

/* ========== MEJORAS UX USUARIOS MAYORES ========== */
/* Botón grande para CTAs principales */
.btn-lg {
  font-size: 1.1rem !important;
  padding: 0.9rem 1.6rem !important;
  min-height: 52px;
}
/* Texto más grande en móvil para mejor legibilidad */
@media (max-width: 720px) {
  .btn-lg {
    font-size: 1.15rem !important;
    padding: 1rem 1.4rem !important;
    width: 100%;
  }
}
/* Labels más grandes */
.form-group label {
  font-size: 1rem;
}
/* Campos de formulario más grandes */
.input-lg {
  font-size: 1.05rem !important;
  padding: 0.8rem 1rem !important;
  min-height: 48px;
}

.visually-hidden { display:none !important; }
/* Generic hidden helper (use for elements toggled via JS) */
.hidden { display: none !important; }
/* Small spacing helpers */
.mt-1 { margin-top: 0.5rem; }

/* Small muted text */
.small-muted { font-size:0.85rem; color:var(--muted); }

/* Error text (inline messages) */
.error-text { color:#dc2626; font-size:0.9rem; margin-top:0.5rem; }

/* WhatsApp / link accent */
.wa-link { color:#0ea5e9; }

/* Utilities */
.text-right { text-align: right; }

/* Section title inline variant (icon + title) */
.section-title-inline { display:flex; align-items:center; gap:0.5rem; font-size:1.1rem; }

/* Narrow centered container for forms and single-column pages */
.narrow-container { max-width:900px; margin:1.5rem auto; padding: 0 1rem; }

/* Debug helpers (used in debug.html) */
.debug-input { padding: 0.5rem; width: 250px; border: 1px solid #e5e7eb; border-radius: 4px; }
.debug-input-wide { padding: 0.5rem; width: 350px; border: 1px solid #e5e7eb; border-radius: 4px; }

/* Admin user card status styles */
.usuario-aprobado { background: #d1fae5; border-color: #bbf7d0; }
.usuario-rechazado { background: #fee2e2; border-color: #fecaca; }
.status-success { color: #059669; }
.status-error { color: #991b1b; }

.status-info { color: #6366f1; }

/* Admin user row helpers */
.usuario-meta-row { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; margin-bottom:0.8rem; }
.usuario-meta-left { flex:1; }
.usuario-name { font-size:1rem; font-weight:700; }
.ml-1 { margin-left:0.5rem; }
.mr-1 { margin-right:0.25rem; }

/* Data table for small admin lists */
.data-table { width:100%; border-collapse:collapse; }
.data-table th, .data-table td { padding:0.6rem 0.5rem; border-bottom:1px solid #f3f4f6; text-align:left; }
/* Utility to reset margin on small messages */
.no-margin { margin: 0 !important; }

/* Prevent body scroll when overlays are open */
.no-scroll { overflow: hidden; }

/* Mobile / touch improvements */
@media (max-width: 420px) {
	.brand-mark { width: 36px; height: 36px; }
	.brand-title { font-size: 1rem; }
	.brand-subtitle { font-size: 0.72rem; }
	.nav-toggle { padding: 6px; }
	.main-nav a, .main-nav button { font-size: 1rem; padding: 0.9rem 1rem; }
	.btn { min-height: 44px; padding: 0.7rem 1rem; }
	input[type="text"], input[type="number"], select, textarea { font-size: 0.95rem; }
	.form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
	.usuario-actions { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
	.usuario-actions .btn-aprobar, .usuario-actions .btn-rechazar { width: auto; }
}

/* Table responsive wrapper */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Map and gallery smaller on phones */
@media (max-width: 420px) {
	.map-frame { height: 220px; }
	.card-image { height: 140px; }
	.form-grid { grid-template-columns: 1fr; }
	.form-actions { flex-direction: column; align-items: stretch; }
	.usuario-card { padding: 0.8rem; }
}

@media (max-width: 360px) {
	.map-frame { height: 180px; }
	.card-image { height: 120px; }
	.brand-mark { width: 32px; height: 32px; }
}

/* Map responsiveness and preview sizing tweaks */
@media (max-width: 480px) {
	.map-frame { height: 260px; }
	.preview-item { width: 100px; height: 80px; }
}

@media (max-width: 360px) {
	.map-frame { height: 220px; }
	.preview-item { width: 88px; height: 68px; }
}

@media (min-width: 721px) and (max-width: 1024px) {
	.map-frame { height: 420px; }
}

@media (max-width: 360px) {
	.brand-mark { width: 32px; height: 32px; }
	.main-nav a, .main-nav button { font-size: 0.98rem; padding: 0.8rem 0.9rem; }
	.btn { font-size: 0.95rem; }
}

@media (min-width: 721px) and (max-width: 1024px) {
	.main-nav a { font-size: 0.95rem; }
}

/* Confirm modal small tweaks to match TerreNet styles */
.confirm-modal-content { max-width: 520px; width: calc(100% - 2rem); border-radius: 12px; padding: 1rem; }
.confirm-modal-content .modal-header { display:flex; align-items:center; justify-content:space-between; gap:0.5rem; }
.confirm-modal-content .modal-body { padding: 0.6rem 0; color: #374151; }
.confirm-modal-content .modal-footer { display:flex; gap:0.5rem; justify-content:flex-end; margin-top:0.8rem; }
.confirm-modal-content .btn { min-width: 96px; }

@media (max-width: 420px) {
	.confirm-modal-content { width: calc(100% - 1.2rem); padding: 0.8rem; }
	.confirm-modal-content .modal-footer { flex-direction: column-reverse; gap:0.6rem; }
	.confirm-modal-content .btn { width: 100%; }
}

/* ============================================
   BANNER BETA ABIERTA - Premium Style
   ============================================ */

/* Beta Banner - Estilo limpio y premium */
.beta-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0f9ff 100%);
  border-bottom: 1px solid rgba(22, 163, 74, 0.12);
  position: relative;
}

.beta-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.beta-banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, #16a34a, #15803d);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #fff;
  white-space: nowrap;
}

.beta-badge svg {
  width: 11px;
  height: 11px;
}

.beta-banner-text {
  margin: 0;
  color: #374151;
  font-size: 0.875rem;
  line-height: 1.4;
}

.beta-banner-text strong {
  color: #15803d;
  font-weight: 600;
}

.beta-banner-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  color: #16a34a;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1.5px solid #16a34a;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.beta-banner-cta:hover {
  background: #16a34a;
  color: #fff;
}

.beta-banner-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.beta-banner-cta:hover svg {
  transform: translateX(2px);
}

@media (max-width: 700px) {
  .beta-banner-inner {
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
  }
  
  .beta-banner-content {
    flex-direction: column;
    gap: 0.4rem;
    text-align: center;
  }
  
  .beta-banner-text {
    font-size: 0.8rem;
  }
  
  .beta-banner-cta {
    width: auto;
    padding: 0.5rem 1rem;
  }
}
