/* =========================================
   SMM Refill Manager — style.css
   ========================================= */

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

:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --bg3:       #1e2535;
  --bg4:       #252d3e;
  --bg5:       #2d3650;
  --accent:    #4f8ef7;
  --accent2:   #3d6fd4;
  --green:     #22c55e;
  --green-bg:  #14532d;
  --red:       #ef4444;
  --red-bg:    #7f1d1d;
  --amber:     #f59e0b;
  --amber-bg:  #78350f;
  --text:      #e2e8f0;
  --muted:     #8892a4;
  --border:    #2a3347;
  --radius:    8px;
  --radius-lg: 12px;
}

html, body {
  min-height: 100vh;
  background: #080c14;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  font-size: 14px;
}

/* ── Panel ── */
.panel {
  max-width: 1200px;
  margin: 24px auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Header ── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.header h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.header p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
}

.connected-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(34,197,94,.25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── Tabs ── */
.tabs {
  display: flex;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  padding: 13px 22px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}

.tab:hover:not(.active) {
  color: var(--text);
  background: rgba(255,255,255,.03);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg);
}

.badge-count {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Content ── */
.content {
  padding: 24px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Form Fields ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

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

.field { display: flex; flex-direction: column; }

label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .3px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,.12);
}

select option { background: var(--bg3); }

/* ── Buttons ── */
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
}

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

.btn-primary  { background: var(--accent);   color: #fff; }
.btn-primary:hover  { background: var(--accent2); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg4); border-color: var(--bg5); }

.btn-success  { background: var(--green-bg); color: var(--green); }
.btn-success:hover  { filter: brightness(1.15); }

.btn-danger   { background: var(--red-bg);   color: var(--red); }
.btn-danger:hover   { filter: brightness(1.15); }

.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Info Card ── */
.info-card { background: var(--bg3); }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.info-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.info-block b {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.info-block code {
  font-size: 11px;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.stat-val {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 4px;
}
.stat-val.blue   { color: var(--accent); }
.stat-val.amber  { color: var(--amber); }
.stat-val.green  { color: var(--green); }
.stat-val.red    { color: var(--red); }

.stat-label { font-size: 11px; color: var(--muted); }

/* ── Table Toolbar ── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

/* ── Orders Table ── */
.table-wrap { overflow-x: auto; }

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.orders-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--bg3);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.orders-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.orders-table tr:last-child td { border-bottom: none; }
.orders-table tbody tr:hover td { background: rgba(255,255,255,.02); }

.order-id {
  font-family: 'Courier New', monospace;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.link-cell {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-cell a {
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
}

.link-cell a:hover { text-decoration: underline; }

.svc-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Progress Bar ── */
.progress-wrap { width: 90px; }

.progress-bar {
  height: 5px;
  background: var(--bg4);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .4s ease;
}

.progress-pct {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-amber  { background: var(--amber-bg); color: var(--amber); }
.badge-red    { background: var(--red-bg);   color: var(--red); }
.badge-blue   { background: #1e3a5f;         color: var(--accent); }
.badge-gray   { background: var(--bg4);      color: var(--muted); }

/* ── Action Buttons in Table ── */
.action-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Empty State ── */
.empty-cell {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-cell i {
  font-size: 32px;
  opacity: .3;
  display: block;
  margin-bottom: 10px;
}

.empty-cell p {
  font-size: 13px;
}

/* ── Queue List ── */
.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}

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

.queue-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.queue-svc { font-size: 12px; color: var(--text); }

.queue-link { font-size: 11px; color: var(--muted); }

/* ── Batch Progress ── */
.batch-block { padding: 10px 0; }

.batch-label {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 10px;
}

.batch-bar-wrap { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }

.batch-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width .4s ease;
}

.batch-pct { font-size: 12px; color: var(--muted); }

.progress-msg {
  font-size: 13px;
  padding: 10px 0;
}
.progress-msg.muted { color: var(--muted); }
.progress-msg.success { color: var(--green); }

/* ── Log Box ── */
.log-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  max-height: 400px;
  overflow-y: auto;
  line-height: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 14px;
}

.log-box span { display: block; }
.log-info   { color: var(--accent); }
.log-ok     { color: var(--green); }
.log-err    { color: var(--red); }
.log-warn   { color: var(--amber); }
.log-muted  { color: var(--muted); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg4);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: all .3s;
  pointer-events: none;
  z-index: 999;
  max-width: 340px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
