/* ============================================================
   Petronas — Panel de Administración (admin.html)
   ============================================================ */

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background-size: cover; background-position: center; position: relative;
}
.login-page::after { content: ""; position: absolute; inset: 0; background: rgba(8,32,36,.82); z-index: 0; }
[data-theme="dark"] .login-page::after { background: rgba(5,16,19,.86); }
.login-card { position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 2.4rem; }
.login-card .brand { justify-content: center; margin-bottom: 1.6rem; }
.login-card h2 { text-align: center; margin-bottom: .3rem; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.6rem; }
.login-err { background: rgba(220,60,60,.12); color: #c0392b; border: 1px solid rgba(220,60,60,.3); padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1rem; display: none; }
[data-theme="dark"] .login-err { color: #ff8f8f; }
.login-hint { margin-top: 1.2rem; text-align: center; font-size: .85rem; background: var(--surface-2); padding: .8rem; border-radius: var(--radius-sm); color: var(--text-soft); }

/* ---------- Layout ---------- */
.admin-body { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--petro-900); color: #cfe0e3; padding: 1.4rem 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
[data-theme="dark"] .sidebar { background: #07181c; }
.sidebar .brand { padding: 0 1.4rem 1.4rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { height: 38px; }
.sidebar .brand .name small { color: var(--gold-400); }
.side-nav { margin-top: 1rem; flex: 1; padding: 0 .8rem; }
.side-nav a { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 10px; color: #a9c1c5; font-weight: 600; font-size: .93rem; transition: all var(--dur); }
.side-nav a svg { width: 20px; height: 20px; flex: none; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: linear-gradient(120deg, var(--gold-500), var(--gold-600)); color: #082024; }
.side-nav a.active svg { color: #082024; }
.side-nav a .count { margin-left: auto; background: rgba(255,255,255,.15); font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; }
.side-nav a.active .count { background: rgba(8,32,36,.2); }
.sidebar .side-foot { padding: 1rem 1.4rem; border-top: 1px solid rgba(255,255,255,.08); }

.main { padding: 1.6rem 2rem; overflow-y: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.8rem; gap: 1rem; flex-wrap: wrap; }
.topbar h1 { font-size: 1.6rem; }
.topbar .view-sub { display: block; font-size: .9rem; color: var(--muted); font-weight: 500; margin-top: .2rem; }
.topbar-right { display: flex; align-items: center; gap: .8rem; }
.admin-user { display: flex; align-items: center; gap: .7rem; }
.admin-user .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: #082024; display: grid; place-items: center; font-weight: 800; }
.admin-user .info b { display: block; font-size: .88rem; }
.admin-user .info span { color: var(--muted); font-size: .78rem; }

/* ---------- Tarjetas de estadísticas ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.2rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); display: flex; gap: 1rem; align-items: center; }
.stat-card .ico { width: 52px; height: 52px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--gold-500); flex: none; }
[data-theme="light"] .stat-card .ico { color: var(--gold-600); }
.stat-card .ico svg { width: 26px; height: 26px; }
.stat-card .num { font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-card .lbl { color: var(--muted); font-size: .85rem; }

/* ---------- Paneles ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.15rem; }
.panel-body { padding: 1.4rem; }

/* ---------- Toolbar / búsqueda / filtros ---------- */
.toolbar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-box input { padding-left: 40px; background: var(--surface-2); border: none; }
.filter-sel { padding: .6rem .9rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
td { font-size: .92rem; }
tr:hover td { background: var(--surface-2); }
.tbl-img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; }
.tbl-title { font-weight: 700; }
.tbl-sub { color: var(--muted); font-size: .8rem; }
.actions { display: flex; gap: .4rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); display: grid; place-items: center; transition: all var(--dur); }
.icon-btn:hover { border-color: var(--gold-500); color: var(--gold-500); }
.icon-btn.danger:hover { border-color: #d9534f; color: #d9534f; }
.icon-btn.approve:hover { border-color: #28a745; color: #28a745; }
.icon-btn.reject:hover { border-color: #d9534f; color: #d9534f; }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Paginación ---------- */
.pagination { display: flex; justify-content: center; gap: .4rem; margin-top: 1.3rem; }
.pagination button { min-width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; }
.pagination button.active { background: var(--gold-500); color: #082024; border-color: var(--gold-500); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Modal admin ---------- */
.admin-modal .modal-box { max-width: 760px; }
.modal-form { padding: 1.6rem; }
.modal-form .grid { grid-template-columns: repeat(2,1fr); }
.modal-form .grid-3 { grid-template-columns: repeat(3,1fr); }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1.4rem; }
.switch-row { display: flex; align-items: center; gap: .7rem; }
.switch { position: relative; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: var(--dur); cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: var(--dur); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--gold-500); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* Preview imágenes subida */
.upload-preview { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
.upload-preview img { width: 90px; height: 66px; object-fit: cover; border-radius: 8px; border: 2px solid var(--border); }
.upload-preview .rm { position: relative; }
.upload-preview .rm button { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: none; background: #d9534f; color: #fff; font-size: .7rem; }
.upload-hint { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

/* ---------- Vitrina "editor enriquecido" ---------- */
.rte { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.rte-toolbar { display: flex; gap: .2rem; padding: .4rem; background: var(--surface-2); border-bottom: 1.5px solid var(--border); flex-wrap: wrap; }
.rte-toolbar button { width: 36px; height: 36px; border: none; background: transparent; border-radius: 6px; color: var(--text); font-size: .95rem; font-family: serif; }
.rte-toolbar button:hover { background: var(--surface); color: var(--gold-500); }
.rte-area { min-height: 260px; padding: 1rem; color: var(--text); background: var(--surface); }
.rte-area:focus { outline: none; }
.rte-area h3 { margin: .8rem 0 .4rem; }
.rte-area p { margin-bottom: .6rem; }
.rte-area ul { list-style: disc; padding-left: 1.4rem; margin-bottom: .6rem; }

/* ---------- Lista testimoniales pendientes destaque ---------- */
.kpi-banner { display: flex; gap: 1rem; margin-bottom: 1.4rem; }
.kpi-banner .kpi { flex: 1; background: var(--surface); border: 1px solid var(--border); padding: 1rem 1.2rem; border-radius: var(--radius); }
.kpi-banner .kpi b { font-size: 1.6rem; color: var(--gold-500); }
[data-theme="light"] .kpi-banner .kpi b { color: var(--gold-600); }
.kpi-banner .kpi span { color: var(--muted); font-size: .85rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty svg { width: 54px; height: 54px; opacity: .5; margin: 0 auto 1rem; }

/* ---------- Responsive admin ---------- */
@media (max-width: 900px) {
  .admin-body { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .3s ease; z-index: 80; width: 260px; }
  .sidebar.open { transform: none; }
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .main { padding: 1.2rem; }
  .modal-form .grid, .modal-form .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .stat-cards { grid-template-columns: 1fr; }
}
