/* ===========================
   Global / Base
   =========================== */

:root {
  --bg-main: #ffffff;
  --bg-card: #ffffff;
  --border-subtle: #e5e7eb;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #007aff;
}

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

body {
  margin: 0;
  background: var(--bg-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--text-main);
}

.app-wrapper {
  max-width: 1200px;
  margin: 24px auto 40px;
}


/* ===========================
   Top Navigation
   =========================== */

.app-nav {
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding: 8px 16px;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.app-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kmp-nav-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.kmp-logo {
  height: 32px;
  width: auto;
  display: block;
}


/* ===========================
   Calendar header
   =========================== */

.kmp-calendar-subtitle {
  font-size: 1rem;
  color: #111827;
  font-weight: 500;
  margin-top: 2px;
}


/* ===========================
   Typography
   =========================== */

h2, h3, h5 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

h2 {
  font-size: 1.3rem;
}

h5 {
  font-size: 0.95rem;
  color: #4b5563;
}


/* ===========================
   Buttons
   =========================== */

.btn,
button,
input[type="submit"] {
  border-radius: 999px !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  padding: 4px 12px !important;
}

/* User menu button in header */
.app-user-menu-btn {
  font-size: 0.85rem !important;             /* slightly smaller than normal buttons */
  text-align: right;                        /* right-align label within the button */
  padding-inline: 0.5rem 0.75rem !important;
}

/* Smaller, right-aligned items in the header user dropdown */
.app-nav .dropdown-menu {
  font-size: 0.8rem;      /* smaller text inside the menu */
  padding: 0.25rem 0.5rem;
}

.app-nav .dropdown-menu .dropdown-item {
  font-size: 0.75rem;      /* ensure items inherit the smaller size */
  text-align: right;       /* right-align the text like "Logout" */
  padding-right: 1rem;
}

.btn-primary,
.btn-outline-primary {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background-color: transparent !important;
}

.btn-primary:hover,
.btn-outline-primary:hover {
  background-color: rgba(0, 122, 255, 0.06) !important;
  color: var(--accent) !important;
}

.btn-outline-danger {
  border-color: #ff3b30 !important;
  color: #ff3b30 !important;
}

.btn-outline-danger:hover {
  background-color: rgba(255, 59, 48, 0.06) !important;
}


/* ===========================
   Cards & Tables (generic)
   =========================== */

.card {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  background: #ffffff;
}

.table {
  margin-bottom: 0;
  border-color: var(--border-subtle);
}

.table > :not(caption) > * > * {
  border-color: var(--border-subtle);
}

.table-sm th,
.table-sm td {
  padding: 4px 8px;
}


/* ===========================
   Summary table (calendar)
   =========================== */

.summary-table {
  background: #ffffff;
}

.summary-table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Summary alignment */
.summary-table th,
.summary-table td {
  vertical-align: middle;
}

/* Employee column left-aligned */
.summary-table th:first-child,
.summary-table td:first-child {
  text-align: left;
}

/* Calendar summary only: Leave Days / Taken / Remaining centered + equal width */
.summary-wrapper .summary-table th:nth-child(2),
.summary-wrapper .summary-table th:nth-child(3),
.summary-wrapper .summary-table th:nth-child(4),
.summary-wrapper .summary-table td:nth-child(2),
.summary-wrapper .summary-table td:nth-child(3),
.summary-wrapper .summary-table td:nth-child(4) {
  text-align: center;
  width: 90px;
  max-width: 90px;
}


/* ===========================
   Manage Employees table
   =========================== */

.manage-table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 0.8rem;
}

.manage-table td {
  vertical-align: middle;
}


/* ===========================
   Month Blocks / Calendar
   =========================== */

.month-block {
  margin-bottom: 24px;
}

/* Calendar table container */
.leave-table {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  table-layout: fixed; /* consistent column widths */
}

/* Employee name column wider */
.leave-table th:first-child,
.leave-table td:first-child {
  width: 160px;
}

/* All day columns same width */
.leave-table th.day-col,
.leave-table td.leave-cell {
  width: 28px;
  max-width: 28px;
}

/* Calendar head */
.leave-table thead.table-light {
  background: #f9fafb;
}

/* Weekday header row */
.weekday-header th {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Month name in top-left cell */
.weekday-header .month-name-cell {
  color: #009BFE !important;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  white-space: nowrap;
}

/* Day number row */
.day-number-header th {
  font-weight: 500;
  font-size: 0.75rem;
}

/* Weekend column headers */
.weekend-col {
  color: #d97757;
}

/* Employee name column cells */
.leave-table tbody td:first-child {
  white-space: nowrap;
  font-weight: 500;
  background: #f9fafb;
}


/* ===========================
   Leave Cells
   =========================== */

.leave-cell {
  min-width: 26px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
}

.leave-cell.readonly {
  cursor: default;
}

/* Weekend base tint */
.leave-cell.weekend-cell {
  background-color: #fff7f0;
}

/* Weekend cells with F/H */
.leave-cell.weekend-occupied {
  background-color: #ffb38a !important;
}

/* Public holiday cells: darker orange */
.leave-cell.holiday-cell {
  background-color: #ff9248 !important;
  color: #2c1600;
}

/* Birthday cells: green highlight */
.leave-cell.birthday-cell {
  background-color: #e9f3d3 !important;
}


/* ===========================
   Forms & Inputs
   =========================== */

.form-control {
  border-radius: 999px;
  border-color: #d1d5db;
  font-size: 0.85rem;
  padding: 4px 10px;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.form-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Checkboxes */
.form-check-input {
  border-radius: 6px;
  border-color: #d1d5db;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}


/* ===========================
   Year dropdown (Bootstrap)
   =========================== */

.year-dropdown-toggle {
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 4px 16px;
  margin-top: 2px; /* slight vertical alignment tweak */
}

.year-dropdown-menu {
  border-radius: 12px;
  min-width: 120px;
  font-size: 0.85rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  border: 1px solid #e5e7eb;
}

.year-dropdown-menu .dropdown-item {
  padding: 6px 12px;
  text-align: center;
}

.year-dropdown-menu .dropdown-item.active {
  background-color: var(--accent);
  color: #ffffff;
}


/* ===========================
   Calendar legend
   =========================== */

.calendar-legend .card-body {
  padding: 8px 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Match existing colours used in the calendar cells */
.legend-swatch-weekend {
  background-color: #fff7f0;  /* weekend-cell */
}

.legend-swatch-holiday {
  background-color: #ff9248;  /* holiday-cell */
}

.legend-swatch-birthday {
  background-color: #e9f3d3;  /* birthday-cell */
}

.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #d1d5db;
  background-color: #f9fafb;
}

.legend-badge-f {
  color: #111827;
}

.legend-badge-h {
  color: #4b5563;
}

/* Highlight current employee row in calendar (employee view only) */
.lt-emp-name-current {
  color: #000000 !important;
  font-weight: 600;
}

.lt-emp-name-other {
  color: #9ca3af !important;
}

/* ===========================
   Leave days chips (Manage Employees)
   =========================== */

.leave-days-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.leave-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: #f3f4f6;
  font-size: 0.75rem;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.leave-chip-year {
  font-weight: 600;
}

.leave-chip-days {
  opacity: 0.8;
}


/* ===========================
   Misc
   =========================== */

a.btn-link {
  color: var(--accent);
  font-size: 0.8rem;
}

a.btn-link:hover {
  text-decoration: underline;
}

.table-responsive {
  border-radius: 10px;
}

@media (max-width: 768px) {
  .app-wrapper {
    padding: 0 8px;
    margin-top: 16px;
  }
}

/* ===========================
   Footer
   =========================== */

.lt-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  height: 72px;            /* match header height / feel */
  display: flex;
  align-items: center;
}

.lt-footer .container {
  height: 100%;
}

.lt-footer-link {
  color: var(--accent);
  text-decoration: none;
}

.lt-footer-link:hover {
  text-decoration: underline;
}

/* Stack nicely on mobile */
@media (max-width: 768px) {
  .lt-footer {
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .lt-footer .container {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }
}

/* ===========================
   Employee summary cards on calendar page
   =========================== */

.lt-summary-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.lt-summary-card {
  flex: 1 1 220px;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.lt-summary-card-leave {
  background-color: #7A2C87; /* Leave Days */
}

/* Softer modern colours */
.lt-summary-card-taken {
  background-color: #FF3B30;
}
.lt-summary-card-remaining {
  background-color: #34C759;
}

.lt-summary-card-taken .lt-summary-number,
.lt-summary-card-taken .lt-summary-label-small {
  color: #FF3B30;
}

.lt-summary-card-remaining .lt-summary-number,
.lt-summary-card-remaining .lt-summary-label-small {
  color: #34C759;
}

.lt-summary-card-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lt-summary-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.lt-summary-number {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.lt-summary-label-small {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.lt-summary-card-leave .lt-summary-number,
.lt-summary-card-leave .lt-summary-label-small {
  color: #7A2C87;
}

.lt-summary-card-taken .lt-summary-number,
.lt-summary-card-taken .lt-summary-label-small {
  color: #ff0000;
}

.lt-summary-card-remaining .lt-summary-number,
.lt-summary-card-remaining .lt-summary-label-small {
  color: #1fc600;
}

.lt-summary-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.lt-summary-actions .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.9rem;
}

/* On very small screens, let cards stack nicely */
@media (max-width: 576px) {
  .lt-summary-card {
    flex: 1 1 100%;
  }
}
