/* static/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --teal:       #0D9488;
  --teal-light: #CCFBF1;
  --teal-dark:  #0F766E;
  --blue:       #0284C7;
  --bg:         #F0FDFA;
  --bg-white:   #FFFFFF;
  --text:       #0F172A;
  --text-muted: #64748B;
  --border:     #E2E8F0;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius:     12px;
  --radius-sm:  8px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--teal);
  text-decoration: none;
}

.navbar-brand .icon {
  width: 36px; height: 36px;
  background: var(--teal);
  color: white;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.navbar-actions { display: flex; gap: .75rem; align-items: center; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: .9rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .15s ease;
}

.btn-primary {
  background: var(--teal); color: white;
}
.btn-primary:hover { background: var(--teal-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent; color: var(--teal);
  border: 1.5px solid var(--teal);
}
.btn-outline:hover { background: var(--teal-light); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: .35rem .9rem; font-size: .82rem; }
.btn-full { width: 100%; }

/* ── Cards ── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }

.form-label {
  font-size: .85rem; font-weight: 500; color: var(--text);
}

.form-input {
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: .95rem; color: var(--text);
  background: var(--bg-white);
  transition: border-color .15s;
  outline: none;
}
.form-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.1); }
.form-input::placeholder { color: #94A3B8; }

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 1rem;
}
.alert-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.badge-active   { background: #D1FAE5; color: #065F46; }
.badge-pending  { background: #FEF3C7; color: #92400E; }
.badge-blocked  { background: #FEE2E2; color: #991B1B; }

/* ── Sidebar layout ── */
.layout { display: flex; min-height: calc(100vh - 64px); }

.sidebar {
  width: 240px; min-width: 240px;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex; flex-direction: column; gap: .35rem;
}

.sidebar-label {
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  padding: .5rem .75rem;
  margin-top: .5rem;
}

.sidebar-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer; border: none; background: transparent;
  width: 100%; font-family: inherit;
  transition: all .12s;
}
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active { background: var(--teal-light); color: var(--teal); }
.sidebar-item .icon { font-size: 1.1rem; }

.main-content { flex: 1; padding: 2rem; overflow-y: auto; }

/* ── Number input stepper ── */
.stepper {
  display: flex; align-items: center; gap: .5rem;
}
.stepper-btn {
  width: 32px; height: 32px;
  border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--bg-white); color: var(--teal);
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.stepper-btn:hover { background: var(--teal-light); border-color: var(--teal); }
.stepper-val {
  min-width: 40px; text-align: center;
  font-size: 1.1rem; font-weight: 600; color: var(--text);
  font-family: 'DM Mono', monospace;
}

/* ── Calendar ── */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.cal-nav { display: flex; align-items: center; gap: .5rem; }
.cal-title { font-size: 1.3rem; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; }
.cal-day-header {
  text-align: center; font-size: .78rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  padding-bottom: .5rem;
}
.cal-day {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  min-height: 140px;
  transition: border-color .15s;
}
.cal-day:hover { border-color: var(--teal); }
.cal-day.today { border-color: var(--teal); background: #F0FDFA; }
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day-num {
  font-size: .85rem; font-weight: 700;
  color: var(--text-muted); margin-bottom: .5rem;
}
.cal-day.today .cal-day-num { color: var(--teal); }
.cal-period { margin-bottom: .5rem; }
.cal-period-label {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: .3rem;
}
.cal-counters { display: flex; gap: .35rem; flex-wrap: wrap; }
.counter-pill {
  display: flex; align-items: center; gap: .25rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  cursor: pointer; border: none; font-family: inherit;
  transition: all .12s;
}
.pill-patients { background: #DBEAFE; color: #1E40AF; }
.pill-patients:hover { background: #BFDBFE; }
.pill-exams    { background: #D1FAE5; color: #065F46; }
.pill-exams:hover    { background: #A7F3D0; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 380px; max-width: 95vw;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; }
.modal-period { margin-bottom: 1rem; }
.modal-period-label {
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: .6rem;
}
.modal-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.modal-row-label { font-size: .9rem; color: var(--text); }
.modal-footer { margin-top: 1.25rem; display: flex; gap: .5rem; justify-content: flex-end; }

/* ── KPI cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.kpi-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; margin-bottom: .4rem; }
.kpi-value { font-size: 2rem; font-weight: 700; color: var(--teal); line-height: 1; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .75rem 1rem; font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .cal-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
