/* ============================================================
   BINOV.NET — Ads Panel  |  Hybrid Theme (dark sidebar + light content)  v3
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Main area */
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --border:      rgba(0,0,0,0.07);
  --border-hi:   rgba(0,0,0,0.12);

  /* Sidebar stays dark */
  --sb-bg:       #0f0f1a;
  --sb-border:   rgba(255,255,255,0.07);
  --sb-txt:      #cbd5e1;
  --sb-txt2:     #64748b;
  --sb-hover:    rgba(255,255,255,0.06);
  --sb-active:   rgba(124,58,237,0.18);

  /* Brand */
  --accent:      #7c3aed;
  --accent2:     #a855f7;
  --accent-glow: rgba(124,58,237,0.25);
  --cyan:        #0891b2;

  /* Text (main area) */
  --txt:         #0f172a;
  --txt-2:       #475569;
  --txt-3:       #94a3b8;

  /* Status colors */
  --green:       #16a34a;
  --green-bg:    #dcfce7;
  --green-txt:   #15803d;
  --yellow:      #d97706;
  --yellow-bg:   #fef3c7;
  --yellow-txt:  #b45309;
  --red:         #dc2626;
  --red-bg:      #fee2e2;
  --red-txt:     #b91c1c;

  --radius:      10px;
  --radius-sm:   7px;
  --radius-lg:   14px;
  --sidebar-w:   228px;
  --transition:  0.16s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  background: #f1f5f9;
  background: var(--bg);
  color: #0f172a;
  color: var(--txt);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────── */
.wrap {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar (dark) ────────────────────────────────────────── */
.sidebar {
  width: 228px;
  width: var(--sidebar-w);
  min-width: 228px;
  min-width: var(--sidebar-w);
  background: #0f0f1a;
  background: var(--sb-bg);
  border-right: 1px solid rgba(255,255,255,0.07);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-bottom: 1px solid var(--sb-border);
  margin-bottom: 8px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #ffffff 30%, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo::before {
  content: '';
  display: block;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 0 14px rgba(124,58,237,0.4);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Cpath d='M14 17h7M17.5 14v7'/%3E%3C/svg%3E");
  background-size: 17px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Nav section label */
.nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  color: var(--sb-txt2);
  padding: 12px 18px 4px;
}

/* Nav links */
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  color: var(--sb-txt);
  text-decoration: none;
  padding: 8px 14px 8px 18px;
  margin: 1px 8px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.16s, color 0.16s;
  position: relative;
  line-height: 1;
}

.nav:hover {
  background: rgba(255,255,255,0.06);
  background: var(--sb-hover);
  color: #ffffff;
}

.nav.active,
.nav:focus-visible {
  background: rgba(124,58,237,0.18);
  background: var(--sb-active);
  color: #c4b5fd;
}

.nav.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #7c3aed, #a855f7);
}

.nav.danger { color: #f87171; }
.nav.danger:hover { background: rgba(239,68,68,0.1); color: #fca5a5; }

/* Nav icon */
.nav-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  opacity: 0.65;
}
.nav:hover .nav-icon,
.nav.active .nav-icon { opacity: 1; }

/* Spacer */
.spacer { flex: 1; }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.07);
  border-top: 1px solid var(--sb-border);
  padding: 8px 0;
  margin-top: 8px;
}

/* ── Main Content ──────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
  background: #f1f5f9;
  background: var(--bg);
}

/* ── Typography ────────────────────────────────────────────── */
.h1 {
  font-size: 21px;
  font-weight: 700;
  color: #0f172a;
  color: var(--txt);
  margin: 0 0 20px;
  letter-spacing: -0.3px;
}

.h2 {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  color: var(--txt);
  margin: 0 0 4px;
}

.small {
  font-size: 12px;
  color: #475569;
  color: var(--txt-2);
}

.label {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  color: var(--txt-2);
  margin: 12px 0 5px;
  display: block;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  background: var(--surface);
  border: 1px solid rgba(0,0,0,0.07);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ── Divider ────────────────────────────────────────────────── */
.hr {
  height: 1px;
  background: rgba(0,0,0,0.07);
  background: var(--border);
  margin: 16px 0;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s;
  white-space: nowrap;

  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 1px 2px rgba(124,58,237,0.15);
}

.btn:hover {
  opacity: 0.9;
  box-shadow: 0 4px 14px rgba(124,58,237,0.3);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); opacity: 1; }

.btn.light, .btn.secondary {
  background: #ffffff;
  color: #475569;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn.light:hover, .btn.secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.btn.cyan {
  background: linear-gradient(135deg, #0284c7, #0891b2);
  color: #fff;
}

.btn.red {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
}

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

/* ── Inputs ─────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 9px 12px;
  background: #f8fafc;
  background: var(--surface2);
  border: 1px solid rgba(0,0,0,0.12);
  border: 1px solid var(--border-hi);
  border-radius: 7px;
  border-radius: var(--radius-sm);
  color: #0f172a;
  color: var(--txt);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus {
  border-color: #7c3aed;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
  background: #fff;
}

.input::placeholder { color: #94a3b8; color: var(--txt-3); }

select.input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

textarea.input { resize: vertical; min-height: 90px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}

/* На узком экране таблица прокручивается внутри себя. Раньше при 390px весь
   документ уезжал вбок вместе с сайдбаром (scrollWidth 993 против 334). */
@media (max-width: 900px) {
  .table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.table thead tr {
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.table th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  color: var(--txt-3);
  text-align: left;
  white-space: nowrap;
  background: #f8fafc;
}

.table td {
  padding: 11px 12px;
  font-size: 13.5px;
  color: #0f172a;
  color: var(--txt);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.14s;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid rgba(0,0,0,0.08);
}

.badge.green {
  color: #15803d;
  color: var(--green-txt);
  background: #dcfce7;
  background: var(--green-bg);
  border-color: rgba(22,163,74,0.2);
}

.badge.yellow {
  color: #b45309;
  color: var(--yellow-txt);
  background: #fef3c7;
  background: var(--yellow-bg);
  border-color: rgba(217,119,6,0.2);
}

.badge.red {
  color: #b91c1c;
  color: var(--red-txt);
  background: #fee2e2;
  background: var(--red-bg);
  border-color: rgba(220,38,38,0.2);
}

.badge.gray {
  color: #64748b;
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.07);
}

.badge.blue {
  color: #0891b2;
  background: #e0f2fe;
  border-color: rgba(8,145,178,0.2);
}

/* ── Flex row ────────────────────────────────────────────────── */
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Grid ────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* ── Plan cards ──────────────────────────────────────────────── */
.plan {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 14px;
  padding: 20px;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.plan:hover {
  border-color: #7c3aed;
  box-shadow: 0 4px 20px rgba(124,58,237,0.12);
  transform: translateY(-2px);
}

.plan .price {
  font-size: 32px;
  font-weight: 800;
  margin: 10px 0 4px;
  color: #0f172a;
}

/* ── Stat metric cards ──────────────────────────────────────── */
.metric-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.metric-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.metric-icon.purple {
  background: #ede9fe;
  color: #7c3aed;
}

.metric-icon.cyan {
  background: #e0f2fe;
  color: #0891b2;
}

.metric-icon.green {
  background: #dcfce7;
  color: #16a34a;
}

.metric-val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: #0f172a;
}

.metric-label {
  font-size: 12px;
  color: #475569;
  margin-top: 2px;
}

/* ── Alert / info box ────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid;
}

.alert.info {
  background: #e0f2fe;
  border-color: rgba(8,145,178,0.25);
  color: #0c4a6e;
}

.alert.warn {
  background: #fef3c7;
  border-color: rgba(217,119,6,0.3);
  color: #78350f;
}

.alert.error {
  background: #fee2e2;
  border-color: rgba(220,38,38,0.25);
  color: #7f1d1d;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #94a3b8;
}

.empty-state-icon { font-size: 40px; margin-bottom: 14px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.empty-state-text { font-size: 13px; }

/* ── Page header row ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header .h1 { margin-bottom: 0; }

/* ── Breadcrumb / back ───────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 0.14s;
}
.back-link:hover { color: #0f172a; }

/* ── Code / mono ─────────────────────────────────────────────── */
.mono {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 5px;
  padding: 2px 7px;
  color: #0891b2;
  word-break: break-all;
}

/* ── Rich text editor toolbar ────────────────────────────────── */
.rte-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.1);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
}

.rte-btn {
  padding: 5px 10px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 5px;
  color: #475569;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.14s;
}

.rte-btn:hover {
  background: #ede9fe;
  color: #7c3aed;
  border-color: rgba(124,58,237,0.3);
}

.rte-editor {
  min-height: 140px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 0 0 7px 7px;
  padding: 10px 12px;
  color: #0f172a;
  outline: none;
  font-size: 13.5px;
  line-height: 1.6;
}

.rte-editor:focus { border-color: #7c3aed; }

/* ── Form layout helpers ─────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── QR / Invoice ────────────────────────────────────────────── */
.qr-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.08);
}

.qr-wrap img { border-radius: 6px; }

.invoice-address {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #0891b2;
  word-break: break-all;
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 7px;
  padding: 10px 12px;
  line-height: 1.6;
}

/* ── Ticket thread ───────────────────────────────────────────── */
.message-bubble {
  border-radius: 14px;
  padding: 12px 16px;
  max-width: 85%;
  line-height: 1.6;
  font-size: 13.5px;
}

.message-bubble.admin {
  background: #ede9fe;
  border: 1px solid rgba(124,58,237,0.15);
  color: #0f172a;
}

.message-bubble.user {
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.07);
  color: #0f172a;
  margin-left: auto;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* Sidebar scrollbar stays dark-style */
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 58px; }
  .logo span, .nav span { display: none; }
  .nav { justify-content: center; padding: 10px; }
  .nav-icon { margin: 0; }
  .nav-section { display: none; }
  .content { padding: 16px; }
}
