/* ============================================================================
   MCB CPD Tracker — Styles
   Matches The Monday Clinical Brief brand: navy (#1B365D), clean, clinical
   ============================================================================ */

:root {
  --mcb-navy: #1B365D;
  --mcb-navy-light: #2A4A7F;
  --mcb-navy-dark: #0F1F3D;
  --mcb-blue: #4A90D9;
  --mcb-blue-light: #E8F0FE;
  --mcb-green: #28A745;
  --mcb-green-light: #D4EDDA;
  --mcb-amber: #FFC107;
  --mcb-amber-light: #FFF3CD;
  --mcb-red: #DC3545;
  --mcb-red-light: #F8D7DA;
  --mcb-grey-50: #F8F9FA;
  --mcb-grey-100: #E9ECEF;
  --mcb-grey-200: #DEE2E6;
  --mcb-grey-300: #CED4DA;
  --mcb-grey-500: #6C757D;
  --mcb-grey-700: #495057;
  --mcb-grey-900: #212529;
  --mcb-white: #FFFFFF;
  --mcb-shadow: 0 2px 8px rgba(27, 54, 93, 0.08);
  --mcb-shadow-lg: 0 4px 16px rgba(27, 54, 93, 0.12);
  --mcb-radius: 8px;
  --mcb-radius-sm: 4px;
  --mcb-transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--mcb-grey-900);
  background: var(--mcb-grey-50);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Navigation ── */
.nav {
  background: var(--mcb-navy);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
  color: var(--mcb-white);
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand span {
  opacity: 0.7;
  font-weight: 400;
  font-size: 0.9rem;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--mcb-radius-sm);
  font-size: 0.9rem;
  transition: all var(--mcb-transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--mcb-white);
  background: rgba(255,255,255,0.1);
}

.nav-user {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

/* ── Layout ── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

.container-wide {
  max-width: 1200px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--mcb-navy);
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--mcb-grey-500);
  font-size: 0.95rem;
}

/* ── Cards ── */
.card {
  background: var(--mcb-white);
  border-radius: var(--mcb-radius);
  box-shadow: var(--mcb-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--mcb-grey-100);
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--mcb-navy);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--mcb-white);
  border-radius: var(--mcb-radius);
  box-shadow: var(--mcb-shadow);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--mcb-navy);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--mcb-grey-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.stat-card.stat-success .stat-value { color: var(--mcb-green); }
.stat-card.stat-warning .stat-value { color: var(--mcb-amber); }

/* ── Progress Bar ── */
.progress-bar-container {
  background: var(--mcb-grey-100);
  border-radius: 20px;
  height: 24px;
  overflow: hidden;
  position: relative;
  margin: 1rem 0;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--mcb-blue), var(--mcb-navy));
  transition: width 0.8s ease;
  min-width: 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.75rem;
}

.progress-bar-fill span {
  color: var(--mcb-white);
  font-size: 0.75rem;
  font-weight: 600;
}

.progress-bar-fill.complete {
  background: linear-gradient(90deg, var(--mcb-green), #1E7E34);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mcb-grey-700);
  margin-bottom: 0.35rem;
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--mcb-grey-500);
  margin-bottom: 0.35rem;
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--mcb-grey-300);
  border-radius: var(--mcb-radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--mcb-grey-900);
  background: var(--mcb-white);
  transition: border-color var(--mcb-transition), box-shadow var(--mcb-transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--mcb-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--mcb-radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--mcb-transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--mcb-navy);
  color: var(--mcb-white);
}
.btn-primary:hover { background: var(--mcb-navy-light); }

.btn-secondary {
  background: var(--mcb-grey-100);
  color: var(--mcb-grey-700);
}
.btn-secondary:hover { background: var(--mcb-grey-200); }

.btn-success {
  background: var(--mcb-green);
  color: var(--mcb-white);
}
.btn-success:hover { background: #218838; }

.btn-outline {
  background: transparent;
  color: var(--mcb-navy);
  border: 1px solid var(--mcb-navy);
}
.btn-outline:hover { background: var(--mcb-blue-light); }

.btn-ai {
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: var(--mcb-white);
}
.btn-ai:hover { opacity: 0.9; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Entries List ── */
.entry-list {
  list-style: none;
}

.entry-item {
  padding: 1rem;
  border-bottom: 1px solid var(--mcb-grey-100);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  transition: background var(--mcb-transition);
}

.entry-item:hover {
  background: var(--mcb-grey-50);
}

.entry-item:last-child {
  border-bottom: none;
}

.entry-title {
  font-weight: 600;
  color: var(--mcb-navy);
  margin-bottom: 0.2rem;
}

.entry-meta {
  font-size: 0.8rem;
  color: var(--mcb-grey-500);
}

.entry-credits {
  font-weight: 700;
  color: var(--mcb-green);
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-draft { background: var(--mcb-amber-light); color: #856404; }
.status-completed { background: var(--mcb-green-light); color: #155724; }

/* ── AI Draft Banner ── */
.ai-banner {
  background: linear-gradient(135deg, #EDE9FE, #E0E7FF);
  border: 1px solid #C4B5FD;
  border-radius: var(--mcb-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.ai-banner .ai-icon {
  font-size: 1.3rem;
}

/* ── Login Page ── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 2rem;
}

.login-card {
  background: var(--mcb-white);
  border-radius: var(--mcb-radius);
  box-shadow: var(--mcb-shadow-lg);
  padding: 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.login-card h1 {
  color: var(--mcb-navy);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-card .subtitle {
  color: var(--mcb-grey-500);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

/* ── Toast / Alerts ── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--mcb-radius);
  color: var(--mcb-white);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { background: var(--mcb-green); }
.toast-error { background: var(--mcb-red); }
.toast-info { background: var(--mcb-blue); }

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--mcb-grey-200);
  border-top-color: var(--mcb-navy);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--mcb-grey-500);
  gap: 0.75rem;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--mcb-grey-500);
}

.empty-state h3 {
  color: var(--mcb-grey-700);
  margin-bottom: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .container { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-item { flex-direction: column; }
  .btn-group { flex-direction: column; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
