/* ============================
   app.css — Auth + Account UI
   Hereda tokens de public.css
   ============================ */

/* ---- Auth pages (register / login) ---- */
.auth-page {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.auth-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: min(960px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: #0f1425; /* Color sólido y oscuro */
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  position: relative;
  z-index: 10;
}

/* Panel izquierdo — decorativo */
.auth-promo {
  background: #131a2d; /* Color sólido */
  border-right: 1px solid var(--line);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-promo::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,70,239,0.3), transparent 70%);
  top: -80px; left: -80px;
  pointer-events: none;
}
.auth-promo-logo { height: 48px; width: auto; }
.auth-promo-title {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.2;
  margin-top: 32px;
}
.auth-promo-sub {
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.7;
  font-size: 0.95rem;
}
.auth-promo-features {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}
.auth-promo-feat {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c4d0f7;
  font-size: 14px;
}
.auth-promo-feat i { color: var(--teal); width: 16px; }
.auth-plan-badge {
  margin-top: 32px;
  border: 1px solid rgba(34,211,197,0.4);
  border-radius: 16px;
  padding: 16px;
  background: rgba(34,211,197,0.06);
}
.auth-plan-badge .plan-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--teal);
}
.auth-plan-badge .plan-price {
  font-size: 1.6rem;
  font-weight: 900;
  margin-top: 4px;
}
.auth-plan-badge .plan-period {
  color: var(--muted);
  font-size: 13px;
}

/* Panel derecho — formulario */
.auth-form-panel {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form-panel h2 {
  font-size: 1.5rem;
  font-weight: 800;
}
.auth-form-panel .auth-sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  line-height: 1.6;
}

/* Stepper */
.auth-steps {
  display: flex;
  gap: 6px;
  margin: 20px 0;
}
.auth-step-dot {
  height: 4px;
  flex: 1;
  border-radius: 99px;
  background: var(--line);
  transition: background 0.3s;
}
.auth-step-dot.active {
  background: linear-gradient(90deg, var(--violet), var(--teal));
}

/* Campos del form */
.form-group {
  margin-top: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group input,
.form-group select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}
.form-group select option {
  background: #131a2d;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.form-row .form-group { margin-top: 0; }

/* Password wrapper con ojo */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.pass-eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--muted);
  background: none;
  border: none;
  font-size: 15px;
  padding: 0;
  line-height: 1;
}

/* Botón submit */
.btn-auth {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  background: linear-gradient(90deg, #aa16cc, #5712d7, #429d86);
  color: white;
  box-shadow: 0 8px 30px rgba(124,58,237,0.4);
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-auth:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-auth:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-auth-ghost {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  transition: border-color 0.2s;
}
.btn-auth-ghost:hover { border-color: var(--violet); }

/* Términos */
.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.terms-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--violet);
}
.terms-check a { color: var(--teal); }

/* Alertas de error/éxito */
.auth-alert {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}
.auth-alert.error {
  background: rgba(255,70,70,0.1);
  border: 1px solid rgba(255,70,70,0.3);
  color: #ff9999;
}
.auth-alert.success {
  background: rgba(34,211,197,0.1);
  border: 1px solid rgba(34,211,197,0.3);
  color: var(--teal);
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.auth-link a { color: var(--teal); font-weight: 600; }

/* Spinner inline */
.spinner-sm {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Success state */
.auth-success {
  text-align: center;
  padding: 20px 0;
}
.auth-success-icon {
  font-size: 3rem;
  color: var(--teal);
  margin-bottom: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-promo { display: none; }
  .auth-form-panel { padding: 32px 24px; }
}

/* ============================================
   Account Portal — Dark SaaS Premium Redesign
   ============================================ */

/* ---- Layout base ---- */
.account-page {
  min-height: calc(100vh - 72px);
  background: var(--bg);
  padding: 40px 0 60px;
}

.account-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  width: min(1140px, 92vw);
  margin: 32px auto 0;
  align-items: start;
}

/* ---- Sidebar ---- */
.account-sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Avatar + user info */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
}
.sidebar-user .avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(124,58,237,0.45);
}
.sidebar-user .info {
  overflow: hidden;
  min-width: 0;
}
.sidebar-user strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--text);
}
.sidebar-user small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin-top: 2px;
}

/* Plan badge inline */
.sidebar-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: linear-gradient(90deg, rgba(124,58,237,0.2), rgba(34,211,197,0.15));
  border: 1px solid rgba(124,58,237,0.35);
  color: var(--teal);
}
.sidebar-plan-badge i { font-size: 9px; }

/* Nav links */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  position: relative;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  transform: translateX(2px);
}
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(124,58,237,0.15), rgba(34,211,197,0.06));
  color: #e0d6ff;
  font-weight: 600;
  border: 1px solid rgba(124,58,237,0.25);
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--violet), var(--teal));
}
.sidebar-nav a i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* Separator line */
.sidebar-sep {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

/* Logout button */
.sidebar-bottom { margin-top: 4px; }
.btn-sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,80,80,0.2);
  background: rgba(255,80,80,0.05);
  color: rgba(255,130,130,0.85);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
}
.btn-sidebar-logout:hover {
  background: rgba(255,80,80,0.12);
  border-color: rgba(255,80,80,0.4);
  color: #ff9999;
}
.btn-sidebar-logout i { font-size: 13px; }

/* ---- Main content area ---- */
.account-content {
  background: linear-gradient(180deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.018) 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 40px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Page header */
.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.account-header-title h1 {
  font-size: 1.65rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.3px;
}
.account-header-title p {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 6px;
}

/* ---- Stat cards (dashboard) ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover {
  border-color: rgba(124,58,237,0.3);
  transform: translateY(-2px);
}
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.04), transparent);
  pointer-events: none;
}
.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  margin-bottom: 14px;
  background: rgba(124,58,237,0.12);
  color: var(--violet);
  border: 1px solid rgba(124,58,237,0.2);
}
.stat-card-icon.teal { background: rgba(34,211,197,0.1); color: var(--teal); border-color: rgba(34,211,197,0.2); }
.stat-card-icon.lime { background: rgba(126,231,135,0.1); color: var(--lime); border-color: rgba(126,231,135,0.2); }
.stat-card-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ---- Card block (generic) ---- */
.card-block {
  background: rgba(255,255,255,0.022);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.card-block:last-child { margin-bottom: 0; }
.card-block:hover { border-color: rgba(255,255,255,0.1); }

.card-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.card-block-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-block-header h3 i {
  font-size: 14px;
  color: var(--violet);
}
/* backward compat */
.card-block > h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

/* ---- Plan card ---- */
.plan-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(34,211,197,0.06));
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.plan-card::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.2), transparent 70%);
  top: -60px; right: -60px;
  pointer-events: none;
}
.plan-card-name {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--teal);
  margin-bottom: 8px;
}
.plan-card-title {
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(90deg, #fff, var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.plan-card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(34,211,197,0.1);
  border: 1px solid rgba(34,211,197,0.25);
  color: var(--teal);
}
.plan-card-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ---- Invoice table ---- */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}
.invoice-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.invoice-table td {
  padding: 14px;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  transition: background 0.15s;
}
.invoice-table tbody tr:hover td {
  background: rgba(255,255,255,0.025);
}
.invoice-table tbody tr:last-child td { border-bottom: none; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-paid {
  background: rgba(126,231,135,0.1);
  color: var(--lime);
  border: 1px solid rgba(126,231,135,0.2);
}
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-weight: 600;
  font-size: 13px;
  transition: opacity 0.2s;
}
.btn-download:hover { opacity: 0.75; text-decoration: underline; }
.btn-download i { font-size: 12px; }

/* ---- CTA to app ---- */
.app-cta-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(34,211,197,0.08));
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
}
.app-cta-card::before {
  content: '';
  position: absolute;
  width: 250px; height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,197,0.12), transparent 70%);
  bottom: -80px; right: -60px;
  pointer-events: none;
}
.app-cta-text p {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 6px;
  max-width: 360px;
  line-height: 1.6;
}
.app-cta-text strong {
  font-size: 1.05rem;
  font-weight: 700;
}

/* ---- Responsive (Native App Feel) ---- */
@media (max-width: 860px) {
  .account-page {
    padding: 0 0 80px 0; /* Espacio para el bottom nav */
    background: var(--bg);
  }
  
  .account-layout {
    display: block;
    width: 100%;
    margin-top: 0;
    padding: 0;
  }

  /* El sidebar se convierte en Bottom Nav */
  .account-sidebar {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0;
    right: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    background: rgba(13, 18, 32, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    padding: 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
  }

  .sidebar-user, .sidebar-sep, .sidebar-bottom {
    display: none; /* Escondemos info de usuario y logout en el nav principal */
  }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    justify-content: space-around;
    gap: 0;
  }

  .sidebar-nav a {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 0;
    font-size: 11px;
    color: var(--muted);
    background: transparent !important;
    border: none !important;
    transform: none !important;
  }

  .sidebar-nav a ion-icon {
    font-size: 26px;
    margin-bottom: 2px;
  }

  .sidebar-nav a.active {
    color: var(--teal);
  }

  .sidebar-nav a.active::before {
    display: none;
  }

  /* Ajuste de contenido */
  .account-content {
    border: none;
    border-radius: 0;
    padding: 24px 16px;
    background: transparent;
    backdrop-filter: none;
  }

  .account-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .card-block {
    padding: 20px 16px;
    border-radius: 20px;
    margin-bottom: 16px;
  }

  /* Auth pages */
  .auth-page {
    padding: 16px;
    min-height: 100vh;
  }
  .auth-wrap {
    grid-template-columns: 1fr;
    border: none;
    box-shadow: none;
    background: transparent;
  }
  .auth-promo {
    display: none;
  }
  .auth-form-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  }
  /* Optimizacion de tabla de facturas */
  .invoice-table, 
  .invoice-table thead, 
  .invoice-table tbody, 
  .invoice-table th, 
  .invoice-table td, 
  .invoice-table tr {
    display: block;
    width: 100%;
  }
  
  .invoice-table thead tr {
    display: none;
  }
  
  .invoice-table tr {
    margin-bottom: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
  }
  
  .invoice-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  
  .invoice-table td:last-child {
    border-bottom: none;
  }
  
  .invoice-table td::before {
    content: attr(data-label);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    color: var(--muted);
    text-align: left;
  }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; } /* Mantenemos 2 columnas en mobile pequeño */
  .form-row { grid-template-columns: 1fr; }
  
  .account-header-title h1 {
    font-size: 1.4rem;
  }
}

