/*
 * SmartPLS License Server - Admin Theme v2
 * Modern, aesthetic dark UI with glass-morphism effects
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg-body: #0b1120;
  --bg-card: #141d31;
  --bg-card-hover: #1a2540;
  --bg-nav: #0f1729;
  --bg-input: #0b1120;
  --border: #1e2d4a;
  --border-light: #2a3a5a;
  --text-primary: #e8edf5;
  --text-secondary: #8899b4;
  --text-muted: #556580;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==============================
   NAVIGATION
   ============================== */
.nav {
  background: var(--bg-nav);
  padding: 0 24px;
  display: flex;
  gap: 4px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.nav h2 {
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-right: 24px;
  white-space: nowrap;
}
.nav h2 span {
  color: var(--text-secondary);
  font-weight: 400;
}
.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  transition: all 0.2s ease;
  position: relative;
}
.nav a:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav a.active {
  color: var(--accent);
  background: var(--accent-glow);
}
.nav a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.nav .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav .nav-badge {
  font-size: 10px;
  background: var(--accent-glow);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* ==============================
   CONTAINER & CARDS
   ============================== */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}
.card:hover {
  border-color: var(--border-light);
}
.card h3 {
  color: var(--accent);
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3 .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-body);
  padding: 1px 10px;
  border-radius: 10px;
}

/* ==============================
   STATS GRID
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.stat-card:hover::before {
  opacity: 1;
}
.stat-card .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.stat-card .label {
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 6px;
  font-weight: 600;
}
.stat-card .icon {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.7;
}

/* Dashboard grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* ==============================
   TABLES
   ============================== */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--bg-body);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  position: sticky;
  top: 0;
  z-index: 1;
}
tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}
tr:last-child td {
  border-bottom: none;
}

/* Cell text overflow */
.cell-mono {
  font-family: 'Consolas', 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.cell-mono-sm {
  font-family: 'Consolas', monospace;
  font-size: 10px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.cell-wrap {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-small {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==============================
   BADGES
   ============================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-valid, .badge-activated, .badge-active, .badge-success {
  background: var(--success-bg);
  color: var(--success);
}
.badge-rejected, .badge-revoked, .badge-inactive, .badge-deactivated {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-expired, .badge-not_found, .badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge-used {
  background: var(--info-bg);
  color: var(--info);
}
.badge-info {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ==============================
   FORMS
   ============================== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group textarea {
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 12px;
  min-height: 100px;
  line-height: 1.5;
}
.form-group .hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group { flex: 1; }

/* ==============================
   BUTTONS
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-light); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #34d399; box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #f87171; box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }
.btn-warning {
  background: var(--warning);
  color: #0f172a;
}
.btn-warning:hover { background: #fbbf24; }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-light); color: var(--text-primary); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-xs { padding: 3px 8px; font-size: 10px; border-radius: 4px; }

/* ==============================
   ALERTS & MESSAGES
   ============================== */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(6, 182, 212, 0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }

.msg {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}
.msg.success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.msg.error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================
   FILTERS
   ============================== */
.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filters a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.filters a:hover { color: var(--text-primary); background: var(--bg-card); }
.filters a.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: rgba(59, 130, 246, 0.2);
}
.filter-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  margin-right: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==============================
   SEARCH BOX
   ============================== */
.search-box {
  display: flex;
  gap: 8px;
}
.search-box input {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
  min-width: 200px;
}
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ==============================
   EMPTY STATE
   ============================== */
.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 24px;
  font-size: 14px;
}
.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ==============================
   CODE / MONO
   ============================== */
.code {
  font-family: 'Consolas', 'SF Mono', monospace;
  color: #fbbf24;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.mono {
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 11px;
}
.copy-btn {
  cursor: pointer;
  color: var(--accent);
  font-size: 11px;
  margin-left: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
  background: none;
  border: none;
  font-family: inherit;
}
.copy-btn:hover { opacity: 1; }

/* ==============================
   QUICK LINKS
   ============================== */
.quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.quick-links a {
  padding: 12px 22px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.quick-links a:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

/* ==============================
   TOGGLE EDIT FORMS (Versions)
   ============================== */
.toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s;
  font-family: inherit;
}
.toggle-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.edit-form { display: none; }
.edit-form.open { display: block; margin-top: 12px; padding: 20px; background: var(--bg-body); border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ==============================
   TOOLTIP
   ============================== */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 10;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ==============================
   SCROLLBAR
   ============================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .nav { padding: 0 12px; gap: 2px; flex-wrap: wrap; height: auto; min-height: 52px; }
  .nav h2 { font-size: 14px; margin-right: 8px; }
  .nav a { font-size: 12px; padding: 6px 10px; }
  .card { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; gap: 0; }
  table { font-size: 11px; }
  th, td { padding: 6px 8px; }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { width: 100%; min-width: unset; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .stat-card .num { font-size: 22px; }
}
