/* main.css — base styles cho admin/editor/login.
   Templates CV co CSS rieng trong public/templates/. */

:root {
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-bg: #f8fafc;
  --color-card: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-danger: #dc2626;
  --color-success: #16a34a;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: #0f172a;
  color: white;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.18s ease-out;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  user-select: none;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: white; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Form */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-bottom: 0; }

/* Card */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

/* Header */
.app-header {
  background: white;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}
.app-header .brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}
.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* List item (admin dashboard) */
.cv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: white;
  margin-bottom: 10px;
}
.cv-item .meta { display: flex; flex-direction: column; gap: 2px; }
.cv-item .meta .name { font-weight: 600; }
.cv-item .meta .sub  { font-size: 13px; color: var(--color-muted); }
.cv-item .actions { display: flex; gap: 8px; }

/* Section divider in editor */
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-muted);
}

/* Helper */
.text-muted { color: var(--color-muted); }
.text-danger { color: var(--color-danger); }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-3 { margin-top: 12px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
