/* ==========================================================
   License Manager - Main Stylesheet
   Plain CSS only, no frameworks.
   ========================================================== */

:root {
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-accent: #06b6d4;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-text: #1f2430;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 10px 25px rgba(16, 24, 40, 0.12);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Top navigation ---------- */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: inline-block;
}
.nav-links { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--color-text-muted); font-weight: 500; font-size: 0.92rem; }
.nav-links a:hover { color: var(--color-primary); text-decoration: none; }

/* ---------- Auth / centered card pages ---------- */
.auth-wrapper {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 420px;
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.auth-card .subtitle { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-links { margin-top: 1.25rem; font-size: 0.9rem; text-align: center; color: var(--color-text-muted); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--color-text);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fbfbfe;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  background: #fff;
}
.help-text { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.field-error { font-size: 0.8rem; color: var(--color-danger); margin-top: 0.25rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; text-decoration: none; }
.btn-block { width: 100%; }
.btn-secondary { background: #eef0f7; color: var(--color-text); }
.btn-secondary:hover { background: #e2e5f0; text-decoration: none; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #15803d; text-decoration: none; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: #f4f4f8; text-decoration: none; }

/* ---------- Alerts / flash messages ---------- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #166534; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ---------- Dashboard layout ---------- */
.page-header { padding: 2rem 0 1rem; }
.page-header p { color: var(--color-text-muted); margin: 0; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: 1px solid var(--color-border);
}
.stat-card .stat-label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; margin-top: 0.35rem; }

/* ---------- Tables ---------- */
.table-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  overflow: hidden;
  margin-bottom: 2rem;
}
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.table-toolbar h2 { font-size: 1.05rem; margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td {
  padding: 0.75rem 1.1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}
th {
  background: #fafbfd;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}
tbody tr:hover { background: #f8f9fd; }
tbody tr:last-child td { border-bottom: none; }

.search-box { position: relative; max-width: 280px; width: 100%; }
.search-box input { padding-left: 2.2rem; }
.search-box::before {
  content: "🔍";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.6;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-active   { background: #dcfce7; color: #166534; }
.badge-expired  { background: #fee2e2; color: #991b1b; }
.badge-inactive { background: #f3f4f6; color: #4b5563; }
.badge-disabled { background: #fef3c7; color: #92400e; }

/* ---------- Modal / confirmation dialogs ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 100%;
  padding: 1.5rem;
}
.modal-box h3 { margin-bottom: 0.5rem; }
.modal-box p { color: var(--color-text-muted); font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; }

/* ---------- Toast notifications ---------- */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.toast {
  min-width: 240px;
  max-width: 320px;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.87rem;
  color: #fff;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-info { background: var(--color-primary); }

/* ---------- Misc utilities ---------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 0.5rem; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.actions-cell { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--color-text-muted); }

footer.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .navbar-inner { flex-direction: column; align-items: flex-start; }
  th, td { padding: 0.6rem 0.7rem; }
  .auth-card { padding: 1.5rem; }
}
