/*
 * HostPanel Pro – Panel Cliente (embebido)
 * Se integra dentro del tema de WordPress sin romperlo.
 * No tiene layout propio, no tiene sidebar oscura, no tiene marca.
 * Usa las variables de color del sistema de diseño de WP/Elementor si existen.
 */

/* ── Variables ──────────────────────────────────────────────────────────── */
.hp-panel {
  --hp-primary:    #2563eb;
  --hp-primary-h:  #1d4ed8;
  --hp-primary-lt: #dbeafe;
  --hp-success:    #16a34a;
  --hp-success-lt: #dcfce7;
  --hp-warning:    #d97706;
  --hp-warning-lt: #fef3c7;
  --hp-danger:     #dc2626;
  --hp-danger-lt:  #fee2e2;
  --hp-bg:         #f8fafc;
  --hp-card:       #ffffff;
  --hp-border:     #e2e8f0;
  --hp-border-2:   #cbd5e1;
  --hp-text:       #0f172a;
  --hp-text-2:     #475569;
  --hp-text-3:     #94a3b8;
  --hp-radius:     10px;
  --hp-radius-sm:  7px;
  --hp-shadow:     0 1px 3px rgba(0,0,0,.06);
  --hp-shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --hp-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-family: var(--hp-font);
  font-size: 14px;
  color: var(--hp-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ── Navegación horizontal ──────────────────────────────────────────────── */
.hp-panel-nav {
  background: var(--hp-card);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  margin-bottom: 20px;
  box-shadow: var(--hp-shadow);
}

.hp-panel-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hp-panel-nav-inner::-webkit-scrollbar { display: none; }

.hp-panel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.hp-panel-tabs::-webkit-scrollbar { display: none; }

.hp-panel-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border: none;
  background: none;
  color: var(--hp-text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--hp-font);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  line-height: 1;
}
.hp-panel-tab:hover { color: var(--hp-text); }
.hp-panel-tab.active {
  color: var(--hp-primary);
  border-bottom-color: var(--hp-primary);
  font-weight: 600;
}
.hp-panel-tab svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Usuario y botón salir en la nav */
.hp-panel-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  flex-shrink: 0;
  border-left: 1px solid var(--hp-border);
  margin-left: 4px;
}
.hp-panel-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--hp-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hp-panel-avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.hp-panel-uname {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hp-text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hp-panel-logout {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--hp-border);
  border-radius: 6px;
  color: var(--hp-text-2);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--hp-font);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.hp-panel-logout:hover { color: var(--hp-danger); border-color: var(--hp-danger); }

/* ── Cabecera móvil ──────────────────────────────────────────────────────── */
.hp-panel-mobile-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--hp-border);
}
.hp-panel-hamburger {
  background: none; border: none; cursor: pointer;
  color: var(--hp-text-2); padding: 4px;
  display: flex; align-items: center;
}
.hp-panel-mobile-menu {
  padding: 8px;
  border-top: 1px solid var(--hp-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.hp-panel-mobile-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--hp-text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--hp-font);
  cursor: pointer;
  transition: background .1s;
  text-align: left;
}
.hp-panel-mobile-item:hover { background: var(--hp-bg); color: var(--hp-text); }
.hp-panel-mobile-item svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Cuerpo del panel ────────────────────────────────────────────────────── */
.hp-panel-body { /* sin padding propio — usa el del tema WP */ }
.hp-panel-actions {
  margin-bottom: 12px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  min-height: 0;
}

/* ── Carga / spinner ─────────────────────────────────────────────────────── */
.hp-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 20px; flex-direction: column; gap: 12px;
  color: var(--hp-text-3); font-size: 13px;
}
.hp-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--hp-border);
  border-top-color: var(--hp-primary);
  border-radius: 50%;
  animation: hp-spin .7s linear infinite;
}
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.hp-card {
  background: var(--hp-card);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  box-shadow: var(--hp-shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.hp-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hp-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.hp-card-title {
  font-size: 14px; font-weight: 700; color: var(--hp-text);
  display: flex; align-items: center; gap: 8px;
}
.hp-card-title svg { width: 16px; height: 16px; color: var(--hp-primary); }
.hp-card-body { padding: 18px; }

/* ── Grid KPIs ───────────────────────────────────────────────────────────── */
.hp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.hp-kpi {
  background: var(--hp-card);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  padding: 16px 18px;
  box-shadow: var(--hp-shadow);
}
.hp-kpi-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--hp-text-3); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.hp-kpi-label svg { width: 14px; height: 14px; }
.hp-kpi-value { font-size: 28px; font-weight: 800; color: var(--hp-text); }
.hp-kpi-sub   { font-size: 11.5px; color: var(--hp-text-3); margin-top: 3px; }
.hp-kpi.accent-blue   { border-top: 3px solid var(--hp-primary); }
.hp-kpi.accent-yellow { border-top: 3px solid var(--hp-warning); }
.hp-kpi.accent-red    { border-top: 3px solid var(--hp-danger); }

/* ── Dashboard 2-col grid ────────────────────────────────────────────────── */
.hp-dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Listas vacías ───────────────────────────────────────────────────────── */
.hp-empty {
  text-align: center; padding: 40px 20px;
  color: var(--hp-text-3); font-size: 13px;
}
.hp-empty svg {
  width: 36px; height: 36px;
  stroke: var(--hp-border); margin-bottom: 10px; display: block; margin: 0 auto 10px;
}

/* ── Service cards ───────────────────────────────────────────────────────── */
.hp-service-card {
  background: var(--hp-card);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  margin-bottom: 8px;
  text-decoration: none !important;
}
.hp-service-card:hover { border-color: var(--hp-primary); box-shadow: var(--hp-shadow-md); }
.hp-service-icon {
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--hp-primary-lt);
  color: var(--hp-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hp-service-icon svg { width: 19px; height: 19px; }
.hp-service-name  { font-size: 14px; font-weight: 700; color: var(--hp-text); }
.hp-service-domain{ font-size: 12px; color: var(--hp-text-3); }
.hp-service-arrow { margin-left: auto; color: var(--hp-text-3); }
.hp-service-arrow svg { width: 16px; height: 16px; }

/* ── Package detail tabs ─────────────────────────────────────────────────── */
.hp-pkg-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--hp-border);
  margin-bottom: 18px; padding-bottom: 0;
}
.hp-pkg-tab {
  padding: 8px 14px;
  border: none; background: none;
  color: var(--hp-text-2); font-size: 12.5px; font-weight: 500;
  font-family: var(--hp-font); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .1s, border-color .1s;
}
.hp-pkg-tab:hover { color: var(--hp-text); }
.hp-pkg-tab.active { color: var(--hp-primary); border-bottom-color: var(--hp-primary); font-weight: 600; }

/* ── Tablas ──────────────────────────────────────────────────────────────── */
.hp-table-wrap { overflow-x: auto; border-radius: var(--hp-radius-sm); }
.hp-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.hp-table th {
  padding: 10px 12px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--hp-text-3);
  border-bottom: 1px solid var(--hp-border);
  background: var(--hp-bg);
}
.hp-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hp-border);
  color: var(--hp-text);
  vertical-align: middle;
}
.hp-table tr:last-child td { border-bottom: none; }
.hp-table tr:hover td { background: var(--hp-bg); }

/* ── Formularios ─────────────────────────────────────────────────────────── */
.hp-field { margin-bottom: 14px; }
.hp-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--hp-text-2); margin-bottom: 5px;
}
/* Usar especificidad alta para sobrescribir estilos del tema */
.hp-panel .hp-input,
.hp-panel .hp-select,
.hp-panel .hp-textarea,
.hp-modal .hp-input,
.hp-modal .hp-select,
.hp-modal .hp-textarea,
.hp-input, .hp-select, .hp-textarea {
  width: 100% !important;
  padding: 9px 12px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-family: inherit !important;
  color: #0f172a !important;
  background: #fff !important;
  outline: none !important;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}
.hp-panel .hp-input:focus,
.hp-panel .hp-select:focus,
.hp-panel .hp-textarea:focus,
.hp-modal .hp-input:focus,
.hp-modal .hp-select:focus,
.hp-modal .hp-textarea:focus,
.hp-input:focus, .hp-select:focus, .hp-textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
}
.hp-input::placeholder,
.hp-panel .hp-input::placeholder,
.hp-modal .hp-input::placeholder { color: #94a3b8 !important; }
.hp-textarea,
.hp-modal .hp-textarea { min-height: 80px; resize: vertical; }
.hp-select,
.hp-modal .hp-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  padding-right: 30px !important;
  cursor: pointer;
}

/* ── Botones ─────────────────────────────────────────────────────────────── */
.hp-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--hp-radius-sm);
  font-size: 13px; font-weight: 600;
  font-family: var(--hp-font);
  cursor: pointer; transition: all .15s;
  border: none; white-space: nowrap; text-decoration: none;
}
.hp-btn svg { width: 14px; height: 14px; }
.hp-btn-primary { background: var(--hp-primary); color: #fff; }
.hp-btn-primary:hover { background: var(--hp-primary-h); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(37,99,235,.3); }
.hp-btn-ghost { background: transparent; color: var(--hp-text-2); border: 1.5px solid var(--hp-border); }
.hp-btn-ghost:hover { color: var(--hp-text); border-color: var(--hp-border-2); background: var(--hp-bg); }
.hp-btn-sm { padding: 6px 12px; font-size: 12px; }
.hp-btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Badges / estados ────────────────────────────────────────────────────── */
.hp-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.hp-badge-green  { background: var(--hp-success-lt); color: var(--hp-success); }
.hp-badge-yellow { background: var(--hp-warning-lt); color: var(--hp-warning); }
.hp-badge-red    { background: var(--hp-danger-lt);  color: var(--hp-danger); }
.hp-badge-blue   { background: var(--hp-primary-lt); color: var(--hp-primary); }
.hp-badge-gray   { background: #f1f5f9; color: #64748b; }

/* ── Alertas ─────────────────────────────────────────────────────────────── */
.hp-alert {
  padding: 10px 14px; border-radius: var(--hp-radius-sm);
  font-size: 12.5px; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 8px;
}
.hp-alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.hp-alert-success { background: var(--hp-success-lt); color: #15803d; border: 1px solid #bbf7d0; }
.hp-alert-error   { background: var(--hp-danger-lt);  color: #b91c1c; border: 1px solid #fecaca; }
.hp-alert-warning { background: var(--hp-warning-lt); color: #92400e; border: 1px solid #fde68a; }
.hp-alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Toast notificación ──────────────────────────────────────────────────── */
#hp-toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 99999;
  padding: 11px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  max-width: 320px; font-family: var(--hp-font);
  transition: opacity .3s; pointer-events: none;
}

/* ── Ticket card ─────────────────────────────────────────────────────────── */
.hp-ticket-card {
  background: var(--hp-card); border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius); padding: 14px 16px;
  cursor: pointer; transition: all .15s; margin-bottom: 8px;
  display: flex; gap: 12px; align-items: flex-start;
}
.hp-ticket-card:hover { border-color: var(--hp-primary); box-shadow: var(--hp-shadow-md); }
.hp-ticket-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.hp-ticket-dot.open      { background: var(--hp-primary); }
.hp-ticket-dot.pending   { background: var(--hp-warning); }
.hp-ticket-dot.closed,
.hp-ticket-dot.resolved  { background: var(--hp-text-3); }
.hp-ticket-subject { font-size: 13.5px; font-weight: 600; color: var(--hp-text); margin-bottom: 3px; }
.hp-ticket-meta    { font-size: 11.5px; color: var(--hp-text-3); }

/* ── Invoice card ────────────────────────────────────────────────────────── */
.hp-invoice-card {
  background: var(--hp-card); border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.hp-invoice-ref   { font-weight: 700; font-size: 13px; color: var(--hp-text); }
.hp-invoice-date  { font-size: 11.5px; color: var(--hp-text-3); margin-top: 2px; }
.hp-invoice-total { font-size: 16px; font-weight: 800; color: var(--hp-text); margin-left: auto; }

/* ── Planes grid (página pública) ────────────────────────────────────────── */
.hp-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.hp-plan-card {
  background: var(--hp-card); border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius); padding: 24px 20px;
  display: flex; flex-direction: column;
  position: relative; transition: box-shadow .2s;
}
.hp-plan-card:hover { box-shadow: var(--hp-shadow-md); }
.hp-plan-card.featured {
  border-color: var(--hp-primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12), var(--hp-shadow-md);
}
.hp-plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--hp-primary); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 12px;
  border-radius: 99px; white-space: nowrap;
}
.hp-plan-name  { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.hp-plan-desc  { font-size: 12.5px; color: var(--hp-text-3); margin-bottom: 16px; min-height: 32px; }
.hp-plan-price { font-size: 32px; font-weight: 800; color: var(--hp-text); }
.hp-plan-price span { font-size: 14px; font-weight: 400; color: var(--hp-text-3); }
.hp-plan-cycle { font-size: 11.5px; color: var(--hp-text-3); margin-bottom: 18px; }
.hp-plan-feats {
  list-style: none; padding: 0; margin: 0 0 20px; flex: 1;
  display: flex; flex-direction: column; gap: 7px;
}
.hp-plan-feats li {
  font-size: 13px; color: var(--hp-text-2);
  display: flex; align-items: center; gap: 7px;
}
.hp-plan-feats li::before {
  content: ''; width: 16px; height: 16px; flex-shrink: 0;
  background: var(--hp-success-lt);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}

/* ── Responsivo ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hp-panel-nav-inner { display: none; }
  .hp-panel-mobile-head { display: flex; }
  .hp-kpi-grid { grid-template-columns: 1fr 1fr; }
  .hp-dash-grid { grid-template-columns: 1fr; }
  .hp-plans-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .hp-kpi-grid { grid-template-columns: 1fr; }
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.hp-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important; left: 0 !important;
  right: 0 !important; bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0,0,0,.5);
  z-index: 999999 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: hp-fade .15s ease;
  /* Romper stacking context de Elementor/tema */
  transform: none !important;
  will-change: auto !important;
}
@keyframes hp-fade { from { opacity:0; } to { opacity:1; } }

.hp-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: hp-modal-in .2s cubic-bezier(.34,1.56,.64,1);
}
.hp-modal-lg { max-width: 720px; }
@keyframes hp-modal-in { from { transform:scale(.92); opacity:0; } to { transform:none; opacity:1; } }

.hp-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hp-border);
  flex-shrink: 0;
}
.hp-modal-title { font-size: 15px; font-weight: 700; color: var(--hp-text); }
.hp-modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--hp-text-3); font-size: 20px; line-height: 1;
  padding: 2px 6px; border-radius: 5px; transition: background .1s;
}
.hp-modal-close:hover { background: var(--hp-bg); }
.hp-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.hp-modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--hp-border);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Misc ────────────────────────────────────────────────────────────────── */
.hp-code {
  font-family: 'Courier New', monospace;
  background: var(--hp-bg);
  padding: 2px 7px; border-radius: 5px; font-size: 12px;
}
.hp-input-group { display: flex; gap: 8px; }
.hp-input-group .hp-input { flex: 1; }
