/* ── Reset & base ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.5;
}

/* ── Top bar ───────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  background: linear-gradient(135deg, #0f4c81 0%, #1a6fb5 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 76, 129, .35);
  position: sticky;
  top: 0;
  z-index: 900;
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar a {
  color: rgba(255,255,255,.88);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}

.topbar a:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(4px);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.user-badge::before {
  content: "\f007";          /* person icon placeholder */
  font-weight: 900;
  font-size: 11px;
}

/* ── Main layout ───────────────────────────────── */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Flash messages ────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid transparent;
}

.flash.success {
  background: #e6f9ed;
  border-color: #34a853;
  color: #1e7e3c;
}

.flash.error {
  background: #fde8e8;
  border-color: #dc3545;
  color: #9b2c2c;
}

/* ── Status bar ────────────────────────────────── */
.status {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #e4ecf5;
  font-size: 13px;
  color: #3b5998;
}

/* ── Calendar card ─────────────────────────────── */
#calendar-own,
#calendar-team {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}

/* ── Tab bar ───────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 2px solid #dce3ec;
  padding-bottom: 0;
}

.tab-btn {
  padding: 10px 22px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #5a6a7e;
  border-radius: 8px 8px 0 0;
  transition: color .15s, background .15s, border-color .15s;
  margin-bottom: -2px;
}

.tab-btn:hover {
  background: #e4ecf5;
  color: #0f4c81;
}

.tab-btn.active {
  color: #0f4c81;
  border-bottom-color: #0f4c81;
  background: rgba(15, 76, 129, .06);
}

.cal-panel { display: none; }
.cal-panel.active { display: block; }

/* ── Tab spacer + iCal buttons ─────────────────── */
.tab-spacer { flex: 1; }

.ical-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #0f4c81;
  background: #e4ecf5;
  border-radius: 6px;
  text-decoration: none;
  margin-bottom: 2px;
  transition: background .15s;
  white-space: nowrap;
  align-self: center;
}

.ical-btn:hover {
  background: #d4dfee;
}

/* ── Admin layout ──────────────────────────────── */
.admin-container {
  max-width: 820px;
}

/* ── Cards / forms ─────────────────────────────── */
.admin-form {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  display: grid;
  gap: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
  margin-bottom: 20px;
}

.admin-form h2 {
  margin: 12px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f4c81;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid #e4ecf5;
  padding-bottom: 6px;
}

.admin-form p {
  margin: 0;
  font-size: 13px;
  color: #555;
}

.admin-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
  padding: 9px 12px;
  border: 1px solid #c8d1db;
  border-radius: 6px;
  font-size: 14px;
  color: #222;
  background: #fafbfc;
  transition: border-color .15s, box-shadow .15s;
}

.admin-form input:focus {
  outline: none;
  border-color: #1a6fb5;
  box-shadow: 0 0 0 3px rgba(26, 111, 181, .15);
}

.admin-form button {
  justify-self: start;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f4c81, #1a6fb5);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}

.admin-form button:hover {
  opacity: .9;
}

.admin-form button:active {
  transform: scale(.98);
}

.btn-secondary {
  background: #e4ecf5 !important;
  color: #0f4c81 !important;
}

.btn-secondary:hover {
  background: #d4dfee !important;
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b, #e74c3c) !important;
}

/* ── Checkbox helpers ──────────────────────────── */
.checkline {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 500 !important;
}

.checkline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0f4c81;
  cursor: pointer;
}

/* ── Absence type grid ─────────────────────────── */
.absence-grid {
  border: 1px solid #dce3ec;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  background: #fafbfc;
}

/* ── Group select fieldset (admin) ─────────────── */
.group-select-fieldset {
  border: 1px solid #dce3ec;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0;
  background: #fafbfc;
}

.group-select-fieldset legend {
  font-size: 13px;
  font-weight: 600;
  color: #0f4c81;
  padding: 0 6px;
}

.group-select-fieldset .absence-grid {
  border: none;
  padding: 4px 0 0;
  background: transparent;
}

/* Selected groups list (add/remove pattern) */
.selected-groups-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.selected-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #dce3ec;
  border-radius: 6px;
  font-size: 13px;
}

.selected-group-row span {
  flex: 1;
}

.btn-remove {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #c53030;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 8px;
  transition: background .15s, color .15s;
}

.btn-remove:hover {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #9b2c2c;
}

.group-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.group-add-row select {
  flex: 1;
}

/* ── Login card (centered) ─────────────────────── */
.login-card {
  max-width: 420px;
  margin: 60px auto 0;
}

/* ── Group rules (admin) ───────────────────────── */

/* Rules overview rows */
#rulesOverview {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
}

.rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fafbfc;
  border: 1px solid #dce3ec;
  border-radius: 6px;
  font-size: 13px;
}

.rule-row strong {
  min-width: 160px;
}

.rule-row .btn-remove {
  margin-left: auto;
  font-size: 12px;
  padding: 3px 10px;
}

/* Group codes panel */
.group-codes-panel {
  border: 1px solid #0f4c81;
  border-radius: 8px;
  padding: 12px;
  background: #f0f5fa;
}

/* Admin select styling */
.admin-form select {
  padding: 9px 12px;
  border: 1px solid #c8d1db;
  border-radius: 6px;
  font-size: 14px;
  color: #222;
  background: #fafbfc;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}

.admin-form select:focus {
  outline: none;
  border-color: #1a6fb5;
  box-shadow: 0 0 0 3px rgba(26, 111, 181, .15);
}

.group-desc {
  color: #888;
  font-size: 12px;
  font-weight: 400;
}

.badge {
  display: inline-block;
  background: #0f4c81;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 700px) {
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: 15px; }
  .topbar nav { gap: 8px; }
  main { padding: 14px; }
  .admin-form { padding: 16px; }
}

/* ── FullCalendar overrides ────────────────────── */
.fc .fc-button-primary {
  background: #0f4c81;
  border-color: #0f4c81;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: #1a6fb5;
  border-color: #1a6fb5;
}

.fc .fc-toolbar-title {
  font-size: 18px;
}

.fc-event {
  border-radius: 4px !important;
  font-size: 12px;
}
