/* ShiftSync — Staff Scheduling App */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:        #0F1117;
  --bg2:       #181B24;
  --bg3:       #1E2230;
  --border:    #2A2F42;
  --text:      #E8EAF0;
  --muted:     #7C8299;
  --accent:    #4F86C6;
  --accent2:   #6BA3DC;
  --success:   #2ECC71;
  --warning:   #F39C12;
  --danger:    #E74C3C;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --mono:      'JetBrains Mono', monospace;
}

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

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

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

/* ── LAYOUT ─────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-brand .logo span {
  color: var(--accent);
}
.sidebar-brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-link:hover svg { opacity: 1; }
.nav-link.active { background: rgba(79,134,198,0.15); color: var(--accent2); }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: var(--radius);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.user-pill-info { flex: 1; min-width: 0; }
.user-pill-name { font-size: 13px; font-weight: 600; truncate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill-role { font-size: 11px; color: var(--muted); }

.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.page-body { padding: 28px; }

/* ── CARDS ───────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-ghost     { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:hover { opacity: 0.9; text-decoration: none; }

/* ── FORMS ───────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,134,198,0.15); }
.form-control::placeholder { color: var(--muted); }
select.form-control option { background: var(--bg2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── ALERTS ──────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: rgba(46,204,113,0.12); border: 1px solid rgba(46,204,113,0.3); color: #2ECC71; }
.alert-danger  { background: rgba(231,76,60,0.12);  border: 1px solid rgba(231,76,60,0.3);  color: #E74C3C; }
.alert-info    { background: rgba(79,134,198,0.12); border: 1px solid rgba(79,134,198,0.3); color: var(--accent2); }

/* ── CALENDAR ────────────────────────────────── */
.cal-controls {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.cal-month-label {
  font-size: 18px; font-weight: 700;
  min-width: 200px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 4px;
}
.cal-day {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 90px;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.other-month { opacity: 0.35; }
.cal-day.today { border-color: var(--accent); }
.cal-day.today .cal-day-num { color: var(--accent); font-weight: 700; }
.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
  color: var(--muted);
}
.shift-chip {
  display: block;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

/* ── TABLE ───────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-admin  { background: rgba(231,76,60,0.15);  color: #E74C3C; }
.badge-staff  { background: rgba(79,134,198,0.15); color: var(--accent2); }

/* ── LOGIN PAGE ──────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(79,134,198,0.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(107,163,220,0.06) 0%, transparent 60%);
}
.login-box {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .mark {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.login-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 20px; }

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px; padding: 4px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── STATS GRID ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-value { font-size: 28px; font-weight: 700; font-family: var(--mono); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── SCHEDULE LIST ───────────────────────────── */
.shift-list { display: flex; flex-direction: column; gap: 8px; }
.shift-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.shift-item-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.shift-item-date { font-size: 12px; color: var(--muted); min-width: 90px; }
.shift-item-time { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.shift-item-name { flex: 1; font-size: 13px; }
.shift-item-notes { font-size: 12px; color: var(--muted); }

/* ── VIEW TOGGLE ─────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.view-toggle button {
  padding: 5px 12px;
  border: none;
  background: none;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.view-toggle button.active { background: var(--bg2); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

/* ── COLOUR DOT ──────────────────────────────── */
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ── SEARCH BOX ──────────────────────────────── */
.search-box {
  position: relative;
}
.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.search-box input {
  padding-left: 32px;
  width: 220px;
}

/* ── MOBILE ──────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: block; }
  .cal-grid { gap: 2px; }
  .cal-day { min-height: 60px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .search-box input { width: 140px; }
}

/* ── UTILITIES ───────────────────────────────── */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.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; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
