/* ============================================================
   KEY PROS — Global Styles
   main.css — variables, reset, components, utilities
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --color-primary:       #2d6a4f;
  --color-primary-dark:  #1b4332;
  --color-primary-light: #e8f5e9;
  --color-accent:        #e63946;
  --color-accent-light:  #fde8ea;
  --color-warning:       #f4a261;
  --color-warning-light: #fff3e0;
  --color-info:          #4dabf7;
  --color-info-light:    #e3f2fd;
  --color-bg:            #f8f9fa;
  --color-surface:       #ffffff;
  --color-border:        #dee2e6;
  --color-text:          #1a1a2e;
  --color-text-muted:    #6c757d;
  --color-text-secondary:#495057;

  --radius-sm:   6px;
  --radius:      10px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 2px 8px rgba(0,0,0,.10);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);

  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }
ul, ol { list-style: none; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--color-primary);      color: #fff; }
.btn-primary:hover   { background: var(--color-primary-dark); }
.btn-secondary { background: #fff; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-secondary:hover { background: var(--color-primary-light); }
.btn-danger    { background: var(--color-accent);        color: #fff; }
.btn-danger:hover    { background: #c62828; }
.btn-ghost     { background: transparent; color: var(--color-text-secondary); border: 2px solid var(--color-border); }
.btn-ghost:hover     { background: var(--color-bg); }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-error { font-size: 12px; color: var(--color-accent); font-weight: 600; margin-top: 2px; }
.form-hint  { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--color-text); }
.card-body  { padding: 20px; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  border-left: 4px solid;
  margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--color-primary); }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: var(--color-accent); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--color-warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: var(--color-info); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--color-surface); font-size: 14px; }
thead th {
  background: var(--color-primary-dark);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--color-bg); }

/* ── Spinner ─────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0,0,0,.15);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }
.btn-spinner { width: 16px; height: 16px; border-width: 2px; border-top-color: currentColor; }
.loading-screen {
  position: fixed; inset: 0;
  background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 14px;
}
.loading-screen p { font-size: 14px; color: var(--color-text-muted); }

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  min-width: 260px;
  max-width: calc(100vw - 32px);
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-md);
  animation: toastIn .25s ease forwards;
  pointer-events: auto;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast-success { background: var(--color-primary); }
.toast-error   { background: var(--color-accent); }
.toast-warning { background: var(--color-warning); color: var(--color-text); }
.toast-info    { background: var(--color-info);    color: var(--color-text); }

/* ── Utility Classes ─────────────────────────────────────────── */
.hidden          { display: none !important; }
.text-right      { text-align: right; }
.text-center     { text-align: center; }
.text-muted      { color: var(--color-text-muted); }
.fw-bold         { font-weight: 700; }
.fw-800          { font-weight: 800; }
.text-sm         { font-size: 13px; }
.text-xs         { font-size: 11px; }
.text-lg         { font-size: 18px; }
.text-primary    { color: var(--color-primary); }
.text-danger     { color: var(--color-accent); }
.text-warning    { color: var(--color-warning); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0  { padding: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 20px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state-text { font-size: 15px; }

/* ── Section Title ───────────────────────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 13px;
  cursor: pointer;
}
.pagination button.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination button:hover:not(.active) { background: var(--color-bg); }
