/* ============================================================
   EcoFlow Admin — Estilos
   ============================================================ */

:root {
  --eco-purple:  #7C3AED;
  --eco-purple2: #6D28D9;
  --eco-purple3: #EDE9FE;
  --eco-if:      #185FA5;
  --eco-cf:      #0F6E56;
  --eco-cd:      #7C3AED;
  --sidebar-w:   240px;
  --topbar-h:    56px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .925rem;
  background: #F3F4F6;
  color: #1F2937;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #111827;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #374151;
}
.sidebar-brand h5 {
  margin: 0;
  color: #fff;
  font-weight: 700;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-brand .eco-badge {
  background: var(--eco-purple);
  color: #fff;
  font-size: .65rem;
  padding: .15rem .4rem;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: .5px;
}

.sidebar nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section {
  padding: .5rem 1rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #6B7280;
  text-transform: uppercase;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .55rem 1.25rem;
  color: #D1D5DB;
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar a:hover, .sidebar a.active {
  background: #1F2937;
  color: #fff;
}
.sidebar a.active { border-left: 3px solid var(--eco-purple); }
.sidebar a i { font-size: 1rem; opacity: .8; min-width: 18px; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #374151;
}
.sidebar-footer .admin-info {
  display: flex; align-items: center; gap: .625rem;
}
.sidebar-footer .admin-avatar {
  width: 32px; height: 32px;
  background: var(--eco-purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
}
.sidebar-footer .admin-name { font-size: .8rem; color: #D1D5DB; font-weight: 500; }
.sidebar-footer .admin-role { font-size: .7rem; color: #6B7280; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  display: flex; align-items: center;
  padding: 0 1.5rem;
  z-index: 99;
}
.topbar-title { font-weight: 600; font-size: 1rem; color: #111827; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.page-body { padding: 1.5rem; }

/* ── Cards ──────────────────────────────────────────────────── */
.card { border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: 10px; }
.card-header { background: transparent; border-bottom: 1px solid #F3F4F6; font-weight: 600; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border-left: 4px solid transparent;
}
.stat-card.if { border-color: var(--eco-if); }
.stat-card.cf { border-color: var(--eco-cf); }
.stat-card.cd { border-color: var(--eco-cd); }

.stat-card .stat-label { font-size: .75rem; color: #6B7280; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; color: #111827; }
.stat-card .stat-sub   { font-size: .8rem; color: #6B7280; margin-top: .25rem; }

/* ── Badges de producto ─────────────────────────────────────── */
.badge-if  { background: #DBEAFE; color: #1D4ED8; }
.badge-cf  { background: #D1FAE5; color: #065F46; }
.badge-cd  { background: #EDE9FE; color: #5B21B6; }

.product-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: .35rem;
}

/* ── Tabla de tenants ───────────────────────────────────────── */
.table-eco { font-size: .875rem; }
.table-eco th { font-weight: 600; color: #6B7280; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid #E5E7EB; background: #F9FAFB; }
.table-eco td { vertical-align: middle; }
.table-eco tbody tr:hover { background: #F9FAFB; }

/* ── Storage bar ─────────────────────────────────────────────── */
.storage-wrap { min-width: 140px; }
.storage-wrap .progress { height: 6px; border-radius: 3px; }
.storage-text { font-size: .72rem; color: #6B7280; margin-top: 2px; }

/* ── Status badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.status-badge.active    { background: #D1FAE5; color: #065F46; }
.status-badge.suspended { background: #FEE2E2; color: #B91C1C; }
.status-badge.pending   { background: #FEF3C7; color: #92400E; }
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4C1D95 100%);
}
.login-card { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h2 { color: #fff; font-weight: 800; margin: 0; letter-spacing: -1px; }
.login-logo p  { color: rgba(255,255,255,.6); font-size: .85rem; margin: .25rem 0 0; }

/* ── Flash alerts ───────────────────────────────────────────── */
.flash-top {
  position: fixed; top: calc(var(--topbar-h) + .75rem);
  right: 1.5rem; z-index: 9999;
  min-width: 300px; max-width: 460px;
}

/* ── Formulario de tenant ───────────────────────────────────── */
.form-section-title {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: #6B7280; padding-bottom: .5rem;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 1rem; margin-top: 1.5rem;
}
.form-section-title:first-child { margin-top: 0; }

/* ── Detalle del tenant ─────────────────────────────────────── */
.tenant-header {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin-bottom: 1.5rem;
}
.tenant-header .company-name { font-size: 1.4rem; font-weight: 700; margin: 0; }
.tenant-header .company-meta { color: #6B7280; font-size: .875rem; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.info-item .info-label { font-size: .7rem; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: .5px; }
.info-item .info-value { font-size: .9rem; font-weight: 500; color: #111827; margin-top: .15rem; }

/* ── Confirmación de eliminación ────────────────────────────── */
.danger-zone {
  border: 2px dashed #FCA5A5;
  border-radius: 10px;
  padding: 1.5rem;
  background: #FFF5F5;
}
.code-input {
  font-size: 2rem; font-weight: 700;
  letter-spacing: .5em; text-align: center;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  padding: .5rem;
  width: 100%;
}
.code-input:focus { outline: none; border-color: var(--eco-purple); box-shadow: 0 0 0 3px var(--eco-purple3); }

/* ── Activity log ───────────────────────────────────────────── */
.log-item {
  display: flex; gap: .75rem;
  padding: .625rem 0;
  border-bottom: 1px solid #F3F4F6;
}
.log-item:last-child { border-bottom: 0; }
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: #D1D5DB; margin-top: .35rem; flex-shrink: 0; }
.log-action { font-weight: 600; font-size: .82rem; }
.log-detail { font-size: .8rem; color: #6B7280; }
.log-time   { font-size: .75rem; color: #9CA3AF; margin-left: auto; flex-shrink: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
}
