/* ── Admin Panel Theme CSS — dark (default) + light ─────────────────────── */
/* Reutiliza las mismas variables CSS del POS para consistencia visual       */

:root {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface2:     #243044;
  --surface3:     #2d3f55;
  --border:       #334155;
  --text:         #e2e8f0;
  --text-muted:   #94a3b8;
  --accent:       #3b82f6;
  --accent-hover: #2563eb;
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --nav-bg:       #0f172a;
  --nav-text:     rgba(255,255,255,.75);
  --nav-active:   #ffffff;
  --nav-line:     #3b82f6;
  --card-shadow:  0 2px 12px rgba(0,0,0,.35);
  --input-bg:     #0f172a;
}

[data-pv-theme="light"] {
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface2:     #f8fafc;
  --surface3:     #f1f5f9;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --nav-bg:       #1e293b;
  --card-shadow:  0 2px 12px rgba(0,0,0,.08);
  --input-bg:     #f8fafc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif;
             background: var(--bg); color: var(--text); font-size: 14px; }

/* ── Topnav ──────────────────────────────────────────────────────────────── */
.pv-topnav {
  background: var(--nav-bg);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  position: sticky; top: 0; z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  min-height: 48px;
}
.pv-brand {
  color: #fff; font-weight: 700; font-size: .95rem;
  padding: 14px 14px 14px 0; margin-right: 8px;
  border-right: 1px solid rgba(255,255,255,.15);
  white-space: nowrap;
}
.pv-nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.pv-nav-links a {
  color: var(--nav-text); text-decoration: none;
  padding: 14px 11px; font-size: .83rem; font-weight: 500;
  border-bottom: 3px solid transparent; white-space: nowrap;
  transition: color .15s, background .15s;
}
.pv-nav-links a:hover  { color: #fff; background: rgba(255,255,255,.07); }
.pv-nav-links a.active { color: var(--nav-active); border-bottom-color: var(--nav-line); background: rgba(255,255,255,.1); }
.pv-nav-spacer { flex: 1; }
.pv-theme-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px 10px; font-size: 1.15rem; line-height: 1;
  color: rgba(255,255,255,.7); border-radius: 6px; transition: background .15s;
}
.pv-theme-btn:hover { background: rgba(255,255,255,.1); }
.pv-nav-user   { color: rgba(255,255,255,.6); font-size: .82rem; padding: 0 8px; white-space: nowrap; }
.pv-nav-logout {
  color: rgba(255,255,255,.45) !important; font-size: .8rem;
  padding: 14px 10px; text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.pv-nav-logout:hover { color: #fff !important; }
.pv-nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px 10px; font-size: 1.35rem; line-height: 1;
  color: rgba(255,255,255,.75); border-radius: 6px;
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.adm-page { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }
.adm-page-title {
  font-size: 1.25rem; font-weight: 700; color: var(--text);
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.adm-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; box-shadow: var(--card-shadow);
}
.adm-stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase;
                   letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.adm-stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--text); }
.adm-stat-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.adm-stat-green  .adm-stat-value { color: var(--success); }
.adm-stat-red    .adm-stat-value { color: var(--danger); }
.adm-stat-yellow .adm-stat-value { color: var(--warning); }
.adm-stat-blue   .adm-stat-value { color: var(--accent); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.pv-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--card-shadow);
}
.pv-card-header {
  padding: .65rem 1rem; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .88rem; border-radius: 12px 12px 0 0;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.pv-btn {
  border: none; border-radius: 8px; padding: .45rem 1rem;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s; display: inline-flex; align-items: center; gap: 5px;
}
.pv-btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.pv-btn:active { transform: none; }
.pv-btn:disabled { opacity: .4; cursor: not-allowed; }
.pv-btn-primary  { background: var(--accent);   color: #fff; }
.pv-btn-success  { background: var(--success);  color: #fff; }
.pv-btn-danger   { background: var(--danger);   color: #fff; }
.pv-btn-warning  { background: var(--warning);  color: #fff; }
.pv-btn-ghost    { background: transparent; border: 1px solid var(--border); color: var(--text); }
.pv-btn-ghost:hover:not(:disabled) { background: var(--surface3); }
.pv-btn-sm { padding: .28rem .65rem; font-size: .78rem; border-radius: 6px; }

/* ── Form controls ───────────────────────────────────────────────────────── */
.pv-input {
  background: var(--input-bg) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: 8px;
  padding: .45rem .75rem; width: 100%; font-size: .88rem;
  transition: border-color .15s;
}
.pv-input:focus  { outline: none; border-color: var(--accent) !important; }
.pv-label        { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.pv-form-group   { margin-bottom: 14px; }
.pv-form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.pv-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.pv-table th {
  background: var(--surface2); color: var(--text-muted); font-weight: 600;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  padding: .55rem .75rem; border-bottom: 1px solid var(--border); text-align: left;
}
.pv-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pv-table tbody tr:hover { background: var(--surface2); }
.pv-table tbody tr:last-child td { border-bottom: none; }
.adm-table-wrap { overflow-x: auto; }

/* ── Badge ───────────────────────────────────────────────────────────────── */
.pv-badge { display: inline-block; padding: .2em .55em; border-radius: 5px; font-size: .72rem; font-weight: 700; }
.pv-badge-blue    { background: rgba(59,130,246,.2);  color: #93c5fd; }
.pv-badge-green   { background: rgba(16,185,129,.2);  color: #6ee7b7; }
.pv-badge-red     { background: rgba(239,68,68,.2);   color: #fca5a5; }
.pv-badge-yellow  { background: rgba(245,158,11,.2);  color: #fcd34d; }
.pv-badge-gray    { background: rgba(100,116,139,.2); color: #94a3b8; }

[data-pv-theme="light"] .pv-badge-blue   { color: #1d4ed8; background: #dbeafe; }
[data-pv-theme="light"] .pv-badge-green  { color: #065f46; background: #d1fae5; }
[data-pv-theme="light"] .pv-badge-red    { color: #991b1b; background: #fee2e2; }
[data-pv-theme="light"] .pv-badge-yellow { color: #92400e; background: #fef3c7; }
[data-pv-theme="light"] .pv-badge-gray   { color: #475569; background: #f1f5f9; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.pv-alert { padding: .65rem 1rem; border-radius: 8px; font-size: .88rem; display: flex; align-items: center; gap: .5rem; margin-bottom: 16px; }
.pv-alert-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3); color: var(--success); }
.pv-alert-danger  { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: var(--danger); }
.pv-alert-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: var(--warning); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.pv-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pv-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
            box-shadow: 0 20px 60px rgba(0,0,0,.5); width: 100%; max-width: 520px; overflow: hidden; }
.pv-modal-lg { max-width: 720px; }
.pv-modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.pv-modal-header h6 { font-size: .95rem; font-weight: 700; margin: 0; }
.pv-modal-body   { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
.pv-modal-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }
.pv-modal-close  { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: .2rem .4rem; border-radius: 4px; }
.pv-modal-close:hover { background: var(--surface3); }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.pv-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3);
           border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.adm-no-data { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: .88rem; }
.adm-section  { margin-bottom: 28px; }
.adm-section-title { font-size: .88rem; font-weight: 700; text-transform: uppercase;
                      letter-spacing: .06em; color: var(--text-muted); margin-bottom: 12px; }
.adm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.adm-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.adm-info-item label { font-size: .72rem; font-weight: 600; text-transform: uppercase;
                         letter-spacing: .05em; color: var(--text-muted); display: block; margin-bottom: 2px; }
.adm-info-item span  { font-size: .88rem; color: var(--text); }
.adm-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.adm-tag-sin { color: var(--text-muted); font-style: italic; font-size: .8rem; }
.adm-copy-btn { background: none; border: none; cursor: pointer; color: var(--text-muted);
                padding: 2px 5px; border-radius: 4px; font-size: .75rem; transition: color .15s; }
.adm-copy-btn:hover { color: var(--accent); }

/* ── Mobile nav ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pv-nav-toggle { display: flex; align-items: center; justify-content: center; }
  .pv-nav-links { display: none; position: absolute; top: 48px; left: 0; right: 0;
                  flex-direction: column; background: var(--nav-bg); padding: 8px 0 16px;
                  border-bottom: 1px solid rgba(255,255,255,.1); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
  .pv-nav-links.open { display: flex; }
  .pv-nav-links a { border-bottom: none; border-left: 3px solid transparent; padding: 10px 18px; }
  .pv-nav-links a.active { border-left-color: var(--nav-line); }
  .pv-nav-spacer { display: none; }
  .pv-nav-user   { padding: 10px 18px; }
  .pv-topnav     { position: sticky; top: 0; }
  .pv-form-row   { grid-template-columns: 1fr; }
  .adm-stats     { grid-template-columns: 1fr 1fr; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
