/* =====================================================
   Opinia — Panel de gestión (cuenta.css)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --sidebar-w:    240px;
  --sidebar-bg:   #0A0F1C;
  --sidebar-hover:#151E33;
  --gold:         #FFD400;
  --pink:         #FF2DBF;
  --grad:         linear-gradient(135deg, #FFD400 0%, #FF2DBF 100%);
  --bg:           #F0F2F8;
  --white:        #FFFFFF;
  --text:         #0D1A30;
  --muted:        #6B7280;
  --border:       #E5E7EB;
  --card-shadow:  0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --radius:       14px;
  --radius-sm:    8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ────────────────────────────────────────── */

.panel-wrapper { display: flex; min-height: 100vh; }

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

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-pin {
  width: 32px; height: 32px;
  background: var(--grad);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.2px;
}

.sidebar-sub {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,.4);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-link:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.85); }

.nav-link.active {
  background: rgba(255,212,0,.12);
  color: var(--gold);
}

.nav-link svg { flex-shrink: 0; opacity: .7; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* Main content */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.topbar-meta {
  font-size: 12px;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.content {
  padding: 32px;
  flex: 1;
}

/* ── Cards ─────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 24px;
}

.card-sm { padding: 18px 20px; }

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

/* ── Metric cards ──────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ── Dashboard grid ────────────────────────────────── */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.dash-col { display: flex; flex-direction: column; gap: 20px; }

/* ── Review card (últimas reseñas) ─────────────────── */

.review-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.review-item:last-child { border-bottom: none; }

.review-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.review-body { flex: 1; min-width: 0; }

.review-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.badge-copiada {
  background: #E3F7EC;
  color: #007039;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.badge-pendiente {
  background: #F3F4F6;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

/* ── Bar chart ─────────────────────────────────────── */

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
  margin-bottom: 6px;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--grad);
  min-height: 4px;
  transition: opacity .2s;
}

.chart-bar:hover { opacity: .8; }
.chart-bar.zero { background: var(--border); }

.chart-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Source list ────────────────────────────────────── */

.source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.source-item:last-child { border-bottom: none; }

.source-count {
  font-weight: 700;
  color: var(--text);
}

/* ── Slot status ────────────────────────────────────── */

.slot-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.slot-status-item:last-child { border-bottom: none; }

.slot-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.slot-dot.on  { background: #00A550; }
.slot-dot.off { background: var(--border); }

/* ── Period filter ─────────────────────────────────── */

.period-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.period-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
}

.period-tab:hover { border-color: var(--gold); color: var(--text); }
.period-tab.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ── Slot management page ──────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.slot-section { display: flex; flex-direction: column; gap: 0; }

.slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.slot-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
}

.slot-tag-pill {
  background: var(--grad);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }

.toggle {
  position: relative;
  width: 36px; height: 20px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}

.toggle input:checked + .toggle-slider { background: #00A550; }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Item row in slot list */
.slot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.slot-item:last-child { border-bottom: none; }

.slot-item-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.slot-item-text.inactive { color: var(--muted); text-decoration: line-through; }

.btn-icon {
  width: 28px; height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background .15s, color .15s;
}

.btn-icon:hover { background: #FEF2F2; color: #DC2626; }
.btn-icon.edit:hover { background: #EFF6FF; color: #2563EB; }

/* Add inline form */
.add-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

/* ── Buttons ────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, box-shadow .15s;
}

.btn-primary {
  background: var(--text);
  color: #fff;
}

.btn-primary:hover { opacity: .88; }

.btn-grad {
  background: var(--grad);
  color: #fff;
}

.btn-grad:hover { box-shadow: 0 4px 16px rgba(255,45,191,.35); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--text); }

.btn-danger { background: #FEF2F2; color: #DC2626; }
.btn-danger:hover { background: #FEE2E2; }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Form controls ──────────────────────────────────── */

.form-ctrl {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s;
}

.form-ctrl:focus { border-color: var(--gold); }

.form-ctrl::placeholder { color: var(--muted); }

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.form-col { flex: 1; display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ── Sucursales ─────────────────────────────────────── */

.branch-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.branch-card:last-child { border-bottom: none; }

.branch-icon {
  width: 40px; height: 40px;
  background: var(--bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.branch-info { flex: 1; min-width: 0; }

.branch-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.branch-address {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.branch-url {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.branch-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.branch-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-align: right;
}

.branch-count-label { font-size: 10px; color: var(--muted); font-weight: 500; }

/* ── Reseñas list ───────────────────────────────────── */

.resena-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.resena-item:last-child { border-bottom: none; }

.resena-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.resena-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
  cursor: pointer;
}

.resena-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resena-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

/* ── Filters bar ────────────────────────────────────── */

.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--gold); }

/* ── Pagination ─────────────────────────────────────── */

.pagination {
  display: flex;
  gap: 6px;
  margin-top: 24px;
  justify-content: center;
}

.page-link {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--white);
}

.page-link:hover { border-color: var(--text); }
.page-link.current { background: var(--text); color: #fff; border-color: var(--text); }

/* ── Login page ─────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: #111827;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.login-pin {
  width: 40px; height: 40px;
  background: var(--grad);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.login-brand {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.login-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.login-desc {
  font-size: 13px;
  color: rgba(255,255,255,.5);
  margin-bottom: 28px;
}

.login-field { margin-bottom: 16px; }

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: border-color .15s;
}

.login-input:focus { border-color: var(--gold); }
.login-input::placeholder { color: rgba(255,255,255,.25); }

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--grad);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity .15s;
}

.login-btn:hover { opacity: .9; }

.login-error {
  background: rgba(220,38,38,.15);
  border: 1px solid rgba(220,38,38,.3);
  color: #FCA5A5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Misc ───────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
}

.active-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.active-pill.on  { background: #E3F7EC; color: #007039; }
.active-pill.off { background: #F3F4F6; color: var(--muted); }

.inline-form { display: inline; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid    { grid-template-columns: 1fr; }
  .slots-grid   { grid-template-columns: 1fr; }
}
