/* ============================================================
   BlastMail Pro — License Admin CSS
   Color palette: dark theme matching the Python GUI
   ============================================================ */

:root {
  --bg:       #0d0d0d;
  --panel:    #161616;
  --panel2:   #1e1e1e;
  --border:   #2a2a2a;
  --accent:   #5865F2;
  --accent2:  #3b3f6e;
  --blue:     #4fa3e3;
  --green:    #3dbb6f;
  --red:      #e05252;
  --yellow:   #f0b429;
  --text:     #f0f0f0;
  --subtext:  #7a7a7a;
  --muted:    #3a3a3a;
  --sidebar-w: 220px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7b87f5; }

ion-icon { vertical-align: middle; }

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

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

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 1.5rem; color: var(--accent); }
.brand-text { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.brand-pro  { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: .75rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .8rem;
  border-radius: 8px;
  color: var(--subtext);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item ion-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-item:hover  { background: var(--panel2); color: var(--text); }
.nav-item.active { background: var(--accent2); color: var(--text); }

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.admin-badge {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--subtext);
  font-size: .8rem;
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .8rem;
  border-radius: 8px;
  color: var(--red);
  font-size: .875rem;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(224,82,82,.12); color: var(--red); }

/* ── Main Content ────────────────────────────────────────── */

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 1.1rem; font-weight: 600; }
.version-badge {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .2rem .7rem;
  font-size: .75rem;
  color: var(--subtext);
}

.content-body {
  padding: 1.5rem;
  flex: 1;
}

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

.card-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-section-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--subtext);
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.card-section-header ion-icon { font-size: 1rem; }
.header-link { margin-left: auto; font-size: .8rem; text-transform: none; letter-spacing: 0; }

/* ── Stats Grid ──────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon-blue   { background: rgba(79,163,227,.15); color: var(--blue); }
.stat-icon-green  { background: rgba(61,187,111,.15); color: var(--green); }
.stat-icon-yellow { background: rgba(240,180,41,.15); color: var(--yellow); }
.stat-icon-red    { background: rgba(224,82,82,.15);  color: var(--red); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--subtext); margin-top: .2rem; }

/* ── Row two columns ─────────────────────────────────────── */

.row-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.mini-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .5rem 0;
}
.mini-stat { text-align: center; flex: 1; }
.mini-stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--text); }
.mini-stat-label { display: block; font-size: .75rem; color: var(--subtext); margin-top: .2rem; }
.mini-stat-divider { width: 1px; height: 40px; background: var(--border); }

.quick-actions { display: flex; flex-direction: column; gap: .5rem; }
.quick-btn {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .9rem;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .85rem;
  transition: border-color .15s, background .15s;
}
.quick-btn:hover { border-color: var(--accent); background: var(--accent2); color: var(--text); }

/* ── Table ───────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.data-table th {
  text-align: left;
  padding: .6rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--subtext);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid rgba(42,42,42,.5);
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: rgba(255,255,255,.03); }
.data-table.small td, .data-table.small th { padding: .45rem .6rem; font-size: .8rem; }

/* ── Status Badges ───────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.status-active    { background: rgba(61,187,111,.18);  color: var(--green); }
.status-trial     { background: rgba(79,163,227,.18);  color: var(--blue); }
.status-suspended { background: rgba(240,180,41,.18);  color: var(--yellow); }
.status-expired   { background: rgba(224,82,82,.18);   color: var(--red); }
.status-inactive  { background: rgba(122,122,122,.15); color: var(--subtext); }

/* ── Log action tags ─────────────────────────────────────── */

.log-action {
  display: inline-flex; align-items: center;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem; font-weight: 600;
  font-family: monospace;
}
.log-activate { background: rgba(61,187,111,.15);  color: var(--green); }
.log-verify   { background: rgba(79,163,227,.15);  color: var(--blue); }
.log-failed   { background: rgba(224,82,82,.15);   color: var(--red); }

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

.btn-primary {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--accent);
  color: #fff;
  border: none; border-radius: 8px;
  padding: .55rem 1.1rem;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: #4752d6; color: #fff; }

.btn-primary-full {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--accent);
  color: #fff; border: none; border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .9rem; font-weight: 600;
  cursor: pointer; margin-top: .5rem; transition: background .15s;
}
.btn-primary-full:hover { background: #4752d6; }

.btn-outline {
  display: inline-flex; align-items: center; gap: .4rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: .5rem 1rem; font-size: .875rem;
  cursor: pointer; transition: border-color .15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--text); }

.btn-filter {
  background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: .5rem .9rem; font-size: .85rem;
  cursor: pointer; transition: border-color .15s;
}
.btn-filter:hover { border-color: var(--accent); }

.btn-clear {
  color: var(--subtext); font-size: .85rem; padding: .5rem .75rem;
}
.btn-clear:hover { color: var(--text); }

.btn-table-action {
  display: inline-flex; align-items: center;
  padding: .25rem .7rem;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-size: .78rem; transition: border-color .15s;
}
.btn-table-action:hover { border-color: var(--accent); color: var(--text); }

.btn-copy {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: .5rem .9rem; font-size: .85rem;
  cursor: pointer; transition: border-color .15s;
  width: 100%; justify-content: center; margin-top: .5rem;
}
.btn-copy:hover { border-color: var(--accent); }

/* ── Action buttons (detail page) ───────────────────────── */

.action-buttons {
  display: flex; flex-direction: column; gap: .6rem;
}
.btn-action {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem; border: none; border-radius: 8px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: filter .15s; width: 100%;
}
.btn-action-green  { background: rgba(61,187,111,.18);  color: var(--green); }
.btn-action-yellow { background: rgba(240,180,41,.18);  color: var(--yellow); }
.btn-action-blue   { background: rgba(79,163,227,.18);  color: var(--blue); }
.btn-action-red    { background: rgba(224,82,82,.18);   color: var(--red); }
.btn-action:hover  { filter: brightness(1.25); }

/* ── Toolbar ─────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar-form {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; flex: 1;
}
.search-wrap {
  display: flex; align-items: center; gap: .5rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem .75rem; flex: 1; min-width: 200px;
}
.search-wrap ion-icon { color: var(--subtext); font-size: 1rem; flex-shrink: 0; }
.search-input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: .875rem; width: 100%;
}
.search-input::placeholder { color: var(--subtext); }
.filter-select {
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: .45rem .75rem; font-size: .85rem; outline: none;
}
.filter-select:focus { border-color: var(--accent); }

/* ── Form inputs ─────────────────────────────────────────── */

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--subtext); margin-bottom: .4rem; }

.form-input {
  width: 100%; background: var(--panel2);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: .875rem;
  padding: .55rem .8rem; outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.form-input:focus { border-color: var(--accent); }
.form-input:disabled { opacity: .5; cursor: not-allowed; }

.required { color: var(--red); }

/* ── Alerts ──────────────────────────────────────────────── */

.alert-error, .alert-success {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  font-size: .875rem;
}
.alert-error   { background: rgba(224,82,82,.12);  border: 1px solid rgba(224,82,82,.3);  color: var(--red); }
.alert-success { background: rgba(61,187,111,.12); border: 1px solid rgba(61,187,111,.3); color: var(--green); }

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

.pagination {
  display: flex; gap: .4rem; padding: .75rem 0 0;
  border-top: 1px solid var(--border); margin-top: .75rem;
}
.page-btn {
  padding: .3rem .65rem; border-radius: 6px;
  background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); font-size: .8rem; transition: border-color .15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Detail page ─────────────────────────────────────────── */

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

.detail-grid { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex; align-items: flex-start;
  padding: .6rem 0; border-bottom: 1px solid rgba(42,42,42,.5);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  width: 140px; flex-shrink: 0;
  font-size: .8rem; font-weight: 600; color: var(--subtext);
}
.detail-value { flex: 1; font-size: .875rem; word-break: break-all; }

.breadcrumb-bar {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: var(--subtext); margin-bottom: 1rem;
}
.breadcrumb-bar a { color: var(--subtext); }
.breadcrumb-bar a:hover { color: var(--text); }
.breadcrumb-bar ion-icon { font-size: .75rem; }

/* ── Generate page ───────────────────────────────────────── */

.two-col-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }

.key-result {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.25rem; text-align: center; margin-bottom: 1rem;
}
.key-display {
  font-family: 'Courier New', monospace;
  font-size: 1rem; font-weight: 700;
  color: var(--accent); letter-spacing: .05em;
  margin-bottom: .75rem; word-break: break-all;
}
.key-info { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.key-info-row {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: var(--subtext);
}

.whatsapp-template {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem;
}
.wt-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 600; color: var(--subtext);
  margin-bottom: .75rem;
}
.wt-body {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: .75rem;
  font-size: .82rem; color: var(--text);
  white-space: pre-wrap; line-height: 1.6;
  font-family: inherit; margin-bottom: .5rem;
}

.device-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  background: rgba(79,163,227,.12); color: var(--blue);
  border-radius: 6px; padding: .15rem .5rem; font-size: .75rem;
}

/* ── Empty State ─────────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--subtext);
}
.empty-state ion-icon { font-size: 2.5rem; display: block; margin: 0 auto .75rem; }

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

.login-body { display: flex; align-items: center; justify-content: center; }

.login-wrapper {
  width: 100%; max-width: 400px; padding: 1.5rem;
}
.login-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 2.5rem 2rem;
}
.login-brand {
  text-align: center; margin-bottom: 2rem;
}
.login-brand ion-icon {
  font-size: 2.5rem; color: var(--accent); display: block; margin: 0 auto .5rem;
}
.login-brand h1 { font-size: 1.4rem; font-weight: 700; }
.login-brand h1 span { color: var(--accent); }
.login-brand p  { color: var(--subtext); font-size: .85rem; margin-top: .25rem; }

.input-icon-wrap {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .8rem;
  transition: border-color .15s;
}
.input-icon-wrap:focus-within { border-color: var(--accent); }
.input-icon-wrap ion-icon { color: var(--subtext); font-size: 1rem; flex-shrink: 0; }
.input-icon-wrap input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: .9rem;
}

/* ── Toast ───────────────────────────────────────────────── */

.toast-msg {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--green); color: #fff;
  padding: .65rem 1.25rem; border-radius: 8px;
  font-size: .875rem; font-weight: 600;
  z-index: 9999; animation: fadeInOut 2.2s ease forwards;
}
@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateY(10px); }
  15%  { opacity: 1; transform: translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* ── Utilities ───────────────────────────────────────────── */

.font-mono   { font-family: 'Courier New', monospace; }
.small       { font-size: .8rem; }
.text-muted  { color: var(--subtext); }
.text-danger { color: var(--red); }
.text-center { text-align: center; }
.link-subtle { color: var(--text); }
.link-subtle:hover { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1024px) {
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
  .row-two-col  { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .two-col-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
