/* Kogakam Admin Panel - Styles */
:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-light: #e3f2fd;
  --accent: #2e7d32;
  --danger: #c62828;
  --warning: #f9a825;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

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

body {
  font-family: 'Segoe UI', Tahoma, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ───────────── Login ───────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d47a1 0%, #1565c0 55%, #42a5f5 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-card .logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px;
  margin: 0 auto 16px;
}
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.login-card p.sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border .2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,101,192,.12); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--accent); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

.error-box {
  background: #fdecea; color: var(--danger);
  border: 1px solid #f5c6cb; padding: 10px 14px;
  border-radius: 8px; font-size: 13px; margin-bottom: 16px;
  display: none;
}

/* ───────────── App layout ───────────── */
.app { display: none; }
.app.visible { display: block; }

.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 250px; background: #0d1b2a; color: #e0e6ed;
  display: flex; flex-direction: column; z-index: 20;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand .logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.sidebar .brand .name { font-size: 16px; font-weight: 700; }
.sidebar .brand .sub { font-size: 11px; opacity: .6; }

.sidebar nav { flex: 1; padding: 12px 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  color: #b8c4d0; text-decoration: none;
  padding: 11px 14px; border-radius: 8px; font-size: 14px;
  transition: all .15s; cursor: pointer;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }

.sidebar .user-box {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.sidebar .user-box .user { font-weight: 600; margin-bottom: 8px; }

.lang-switch {
  display: flex; gap: 4px; padding: 10px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  align-items: center;
}
.lang-switch .lang-btn {
  flex: 1; padding: 6px 4px; font-size: 11.5px;
  background: transparent; color: #b8c4d0;
  border: 1px solid rgba(255,255,255,.15); border-radius: 6px;
  cursor: pointer; transition: all .15s;
}
.lang-switch .lang-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.lang-switch .lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.main {
  margin-right: 250px;
  min-height: 100vh;
  padding: 24px 28px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.topbar h2 { font-size: 20px; }
.topbar .actions { display: flex; gap: 10px; }

/* ───────────── Cards & stats ───────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat-card .icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.stat-card .value { font-size: 26px; font-weight: 800; }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stat-card.blue .icon { background: #e3f2fd; color: var(--primary); }
.stat-card.green .icon { background: #e8f5e9; color: var(--accent); }
.stat-card.amber .icon { background: #fff8e1; color: var(--warning); }
.stat-card.red .icon { background: #ffebee; color: var(--danger); }

/* ───────────── Card & table ───────────── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card .card-head h3 { font-size: 16px; }

.toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar input[type=text], .toolbar select {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; outline: none;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: right; padding: 10px 12px;
  color: var(--text-muted); font-weight: 600; font-size: 12px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: #f9fafb; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700;
}
.badge.active { background: #e8f5e9; color: var(--accent); }
.badge.expired { background: #ffebee; color: var(--danger); }
.badge.disabled { background: #f3f4f6; color: #4b5563; }
.badge.lifetime { background: #e3f2fd; color: var(--primary); }

code.license-code {
  font-family: 'Consolas', monospace; font-size: 14px;
  font-weight: 700; letter-spacing: .5px;
  color: var(--primary); user-select: all;
}

.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.icon-btn {
  width: 30px; height: 30px; border: none; border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .15s;
}
.icon-btn:hover { background: #f0f2f5; }
.icon-btn.green:hover { color: var(--accent); background: #e8f5e9; }
.icon-btn.red:hover { color: var(--danger); background: #ffebee; }
.icon-btn.blue:hover { color: var(--primary); background: #e3f2fd; }

.empty { text-align: center; padding: 40px; color: var(--text-muted); }

/* ───────────── Modal ───────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 480px; padding: 28px;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 6px; font-size: 18px; }
.modal .modal-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.modal .field { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Duration chips */
.duration-group { display: flex; gap: 8px; flex-wrap: wrap; }
.duration-chip {
  padding: 10px 14px; border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .15s; text-align: center; flex: 1; min-width: 80px;
}
.duration-chip:hover { border-color: var(--primary); }
.duration-chip.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

/* Generated code box */
.generated-code {
  background: var(--primary-light); border: 2px dashed var(--primary);
  border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 16px;
}
.generated-code .code {
  font-family: 'Consolas', monospace; font-size: 24px; font-weight: 800;
  letter-spacing: 3px; color: var(--primary-dark); user-select: all;
  word-break: break-all;
}

/* Toast */
.toast-wrap { position: fixed; bottom: 20px; left: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1a1a2e; color: #fff; padding: 12px 18px;
  border-radius: 8px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
  animation: slideUp .2s ease;
}
.toast.success { background: var(--accent); }
.toast.error { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Settings/About */
.info-row {
  display: flex; justify-content: space-between; padding: 12px 0;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-muted); }
.info-row .v { font-weight: 600; }

/* RTL / LTR */
html[dir=rtl] body { font-family: 'Segoe UI', Tahoma, sans-serif; }
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main { margin-right: 200px; padding: 16px; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .main { margin-right: 0; }
}
