
/* =================++++++++++++=============
List and Dashboards pages
===================++++++++++++=============*/
/* General Container */
.container {
  max-width:flex;
  margin: 0 auto;
  padding: 20px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 24px;
  color: var(--text-primary);
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.3s;
  display: inline-block;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-search {
  background-color: var(--success-color);
  color: #fff;
  padding: 10px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-search:hover {
  filter: brightness(0.95);
}

/* Search Filter Card */
.search-filter-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  padding: 15px;
  margin-bottom: 20px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 260px; /* gives the field more breathing room */
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 44px; /* extra left padding for icon */
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12); /* subtle focus ring */
}

/* Icon span kept empty in HTML; we draw it here */
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 16px;
}


/* Filters */
.filter-select {
  padding: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  padding-right: .875rem;
}

/* Table Card */
.table-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  overflow-x: auto;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.data-table tr:hover {
  background: var(--bg-tertiary);
}

/* Avatars & Links */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--border-color);
  transition: transform 0.2s;
}

.avatar:hover {
  transform: scale(1.1);
}

.item-link {
  color: var(--primary-color);
  text-decoration: none;
}

.item-link:hover {
  text-decoration: underline;
}

/* Status Badge */
.status-badge {
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 14px;
  color: #fff;
  display: inline-block;
}

.status-badge.status-active {
  background: var(--success-color);
}

.status-badge.status-inactive {
  background: var(--danger-color);
}

/* Row Actions */
.action-link {
  color: var(--primary-color);
  text-decoration: none;
  margin-right: 10px;
}

.action-link.delete {
  color: var(--danger-color);
}

.action-link:hover {
  text-decoration: underline;
}

/* Empty State */
.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-select,
  .btn-search {
    margin-top: 10px;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .btn-primary {
    margin-top: 10px;
  }
}

/* =================++++++++++++=============
print buttongs
===================++++++++++++=============*/
.print-btn {
  background: white;
  color: #333;
  border: 2px solid #4CAF50;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.25s ease;
}

.print-btn:hover {
  background: #4CAF50;
  color: white;
}
/* =================++++++++++++=============
pagination
===================++++++++++++=============*/
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
  font-size: 14px;
  gap: 8px;
}

.pagination-link {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--pagination-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--pagination-text);
  background: var(--pagination-bg);
  transition: all 0.2s ease;
}

.pagination-link:hover {
  background: var(--pagination-hover-bg);
  color: var(--pagination-hover-text);
  border-color: var(--primary-color);
}

.pagination-current {
  padding: 6px 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* =================++++++++++++=============
Badges on status
===================++++++++++++=============*/
/* Attendance badges using ONLY existing variables */
.data-table .status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  border: 1px solid var(--border-color);
  color: var(--text-primary); /* default */
}

/* Map each badge to a single color variable */
.data-table .status-present { --badge-color: var(--success-color); }
.data-table .status-late    { --badge-color: var(--warning-color); }
.data-table .status-absent  { --badge-color: var(--danger-color); }
.data-table .status-neutral { --badge-color: var(--text-muted); }

/* Use the color as text; tint background + border from the same color */
.data-table .status-present,
.data-table .status-late,
.data-table .status-absent {
  color: var(--badge-color) !important;
  /* visible in both themes using only the vars */
  background: color-mix(in srgb, var(--badge-color) 22%, var(--bg-secondary)) !important;
  border-color: color-mix(in srgb, var(--badge-color) 55%, var(--bg-secondary)) !important;
}

.data-table .status-neutral {
  color: var(--text-muted) !important;
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.data-table td { color: var(--text-primary); }

.status-badge.status-info {
  color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 22%, var(--bg-secondary));
  border: 1px solid color-mix(in srgb, var(--primary-color) 55%, var(--bg-secondary));
}

/* =================++++++++++++=============
Form Layout (shared for add/edit pages)
===================++++++++++++=============*/

.form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  padding: 24px;
  max-width: 900px;
  margin: 0 auto 32px;
}

.form-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Grid form layout */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-span-2 {
  grid-column: span 2;
}

/* Labels & inputs */
label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Error styling */
.error {
  color: var(--danger-color);
  font-size: 13px;
  margin-top: 4px;
}

/* Buttons */
button.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
  text-align: center;
}

button.btn-primary:hover {
  background-color: var(--primary-hover);
}

.text-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
}

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

/* Responsive */
@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid-span-2 {
    grid-column: span 1;
  }
}
/* =================++++++++++++=============
 Users details pages
===================++++++++++++=============*/

  .details-page {
    display:grid;
    gap: 20px;
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
  }
  .details-card {
    background: var(--bg-card, #ffffff); /* Fallback to white */
    border: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
    border-radius: 16px;
    box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.1)); /* Fallback shadow */
    backdrop-filter: blur(20px);
    overflow: hidden;
  }
  .details-header {
    padding: 20px;
    background: var(--primary-gradient, linear-gradient(90deg, #007bff, #00c4cc)); /* Fallback gradient */
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .details-avatar, .details-avatar-fallback {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
  }
  .details-avatar {
    object-fit: cover;
    cursor: pointer;
  }
  .details-avatar-fallback {
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 24px;
    color: #fff;
    background: var(--primary-gradient, linear-gradient(90deg, #007bff, #00c4cc)); /* Fallback gradient */
  }
  .details-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: #fff; /* Explicitly set for header contrast */
  }
  .details-sub {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
    color: #fff; /* Ensure contrast in header */
  }
  .details-body {
    padding: 20px;
  }
  .details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
  }
  .details-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
  }
  .details-item strong {
    color: var(--text-primary, #333333); /* Fallback to dark gray */
    font-weight: 600;
    font-size: 13px;
    display: block;
    margin-bottom: 4px;
  }
  .details-item span {
    color: var(--text-secondary, #666666); /* Fallback to medium gray */
    font-size: 14px;
  }
  .details-full {
    grid-column: 1 / -1;
  }
  .details-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
  }
  .details-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
    background: var(--bg-glass, rgba(255, 255, 255, 0.1)); /* Fallback to light glass */
    color: var(--text-secondary, #666666); /* Fallback to medium gray */
    transition: var(--transition, all 0.2s ease); /* Fallback transition */
  }
  .details-btn:hover {
    background: var(--bg-glass-hover, rgba(255, 255, 255, 0.2)); /* Fallback to light hover */
    color: var(--text-primary, #333333); /* Fallback to dark gray */
    transform: translateY(-1px);
  }
  .details-btn--green {
    border-color: #34d399;
    color: #34d399;
  }
  .details-btn--green:hover {
    background: #34d399;
    color: #fff;
  }
  .details-btn--red {
    border-color: #ef4444;
    color: #ef4444;
  }
  .details-btn--red:hover {
    background: #ef4444;
    color: #fff;
  }
  .details-btn--blue {
    border-color: #3b82f6;
    color: #3b82f6;
  }
  .details-btn--blue:hover {
    background: #3b82f6;
    color: #fff;
  }

  /* Modal (scoped) */
  .details-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
  }
  .details-modal-content {
    background: var(--bg-card, #ffffff); /* Fallback to white */
    border-radius: 5px;
    max-width: 90%;
    max-height: 90vh;
    position: relative;
    overflow: hidden;
  }
  .details-modal img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border-radius: 12px;
  }
  .details-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-glass, rgba(255, 255, 255, 0.1)); /* Fallback to light glass */
    border: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--text-secondary, #666666); /* Fallback to medium gray */
    font-size: 16px;
    cursor: pointer;
  }
  .details-modal-close:hover {
    background: var(--bg-glass-hover, rgba(255, 255, 255, 0.2)); /* Fallback to light hover */
    color: var(--text-primary, #333333); /* Fallback to dark gray */
  }

  @media (max-width: 600px) {
    .details-header {
      flex-direction: column;
      text-align: center;
    }
    .details-avatar, .details-avatar-fallback {
      width: 60px;
      height: 60px;
    }
    .details-title {
      font-size: 1.4rem;
    }
  }
/*
more focus on staff user page only
*/
.details-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-glass, #e0e0e0);
  cursor: pointer;
}
.details-avatar-fallback {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  background: var(--primary-gradient, #007bff);
  border: 2px solid var(--border-glass, #e0e0e0);
  cursor: pointer;
}
.chip {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-left: 0.5rem;
  line-height: 1.2;
}
.chip.present { background: #28a745; color: #fff; }
.chip.absent { background: #dc3545; color: #fff; }
.chip.late { background: #ffc107; color: #fff; }
.chip.sick { background: #17a2b8; color: #fff; }
.chip.leave { background: #6c757d; color: #fff; }
.chip.excused { background: #007bff; color: #fff; }
.details-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.dark-mode .details-list li {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-glass, #f9f9f9);
  border: 1px solid var(--border-glass, #e0e0e0);
  border-radius: 8px;
  color: var(--text-primary, #333333);
  line-height: 1.6;
}
.details-list li small {
  color: var(--text-muted, #666666);
  display: block;
  margin-top: 0.5rem;
}
.details-section .details-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-glass, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.dark-mode .details-section .section-title {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-primary, #333333);
  font-size: 1.5rem;
  font-weight: 600;
}
.staff-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}
.staff-sections .details-section {
  flex: 1 1 calc(50% - 1rem); /* Approx 50% width with gap */
}
.details-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.details-modal-content {
  background: var(--bg-card, #ffffff);
  padding: 20px;
  border-radius: 8px;
  position: relative;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
}
.details-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary, #333333);
}
.details-modal-close:hover { color: var(--text-danger, #c0392b); }
em {
  color: var(--text-muted, #666666);
  font-style: italic;
}


/* =================++++++++++++=============
 delete confirmation screen
===================++++++++++++=============*/

.delete-card {
  background: var(--bg-card, #ffffff); /* Fallback to white */
  border: 1px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
  border-radius: 16px;
  box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.1)); /* Fallback shadow */
  padding: 16px;
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.delete-title {
  color: var(--text-danger, #c0392b); /* Fallback to red */
  font-size: 1.8rem;
  margin-bottom: 1.25rem;
}

.delete-warning {
  margin-bottom: 1.25rem;
  color: var(--text-primary, #333333); /* Fallback to dark gray */
}

.delete-warning strong {
  color: var(--text-danger, #c0392b); /* Fallback to red for emphasis */
}

.entity-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-glass, #e0e0e0); /* Fallback to light gray */
  margin-bottom: 1.25rem;
}

.delete-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.grid-span-2 {
  grid-column: span 2;
}

.delete-btn {
  background: var(--btn-danger-bg, #c0392b); /* Fallback to red */
  color: #ffffff;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.delete-btn:hover {
  background: var(--btn-danger-hover, #a93226); /* Darker red fallback */
}

.cancel-link {
  display: block;
  text-align: center;
  color: var(--text-link, #007bff); /* Fallback to blue */
  text-decoration: none;
  font-weight: 600;
}

.cancel-link:hover {
  text-decoration: underline;
  color: var(--text-link-hover, #0056b3); /* Darker blue fallback */
}

@media (max-width: 600px) {
  .delete-grid {
    grid-template-columns: 1fr;
  }
}


/* =================++++++++++++=============
compact filter on list pages
===================++++++++++++=============*/
  /* compact filter layout */
  .filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem 1rem; /* vertical and horizontal spacing */
  }

  .filter-grid select {
    width: 100%;
    min-width: 0; /* avoids overflow */
  }

  @media (max-width: 640px) {
    .filter-grid {
      grid-template-columns: 1fr; /* stack on small screens */
    }
  }

/* =================++++++++++++=============
KPI Dashboard Grid
===================++++++++++++=============*/

.kpi-overview-title{
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: .75rem;
}

.kpi-row{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .75rem;
}
@media (max-width: 900px){ .kpi-row{ grid-template-columns: 1fr; } }

.kpi-card{
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: .9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.kpi-label{
  font-size: .9rem;
  color: var(--text-secondary);
  font-weight: 700;
  margin-right: .75rem;
  white-space: nowrap;
}

.kpi-value{
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--text-primary);
  line-height: 1;
}

/* Text-style KPIs (for lists like "female: 10 • male: 8") */
.kpi-text{
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  margin-left: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =================++++++++++++=============
Quick modal for chart slice details
===================++++++++++++=============*/

#chartQuickModal{
  position: fixed; inset: 0; display: none; z-index: 9999;
}
#chartQuickModal.show{ display: block; }
#chartQuickModal .cqm-backdrop{
  position:absolute; inset:0; background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(2px);
}
#chartQuickModal .cqm-card{
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-width: 260px; max-width: 90vw;
  background: var(--bg-secondary); color: var(--text-primary);
  border: 1px solid var(--border-glass); border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 1rem 1.25rem 1rem 1rem;
}
#chartQuickModal .cqm-title{
  font-weight: 800; margin-bottom: .5rem;
}
#chartQuickModal .cqm-close{
  position:absolute; right:.5rem; top:.4rem;
  background:transparent; border:0; font-size:20px; cursor:pointer;
  color: var(--text-secondary);
}
#chartQuickModal .cqm-close:hover{ color: var(--text-primary); }

.chart-slice-popover{
  position:absolute;
  transform: translate(-50%, -110%); /* center above the point */
  padding:.6rem .8rem;
  border-radius:12px;
  background:var(--bg-secondary,#fff);
  color:var(--text-primary,#0f172a);
  border:1px solid var(--border-glass,rgba(0,0,0,.08));
  box-shadow:0 10px 30px rgba(0,0,0,.15);
  pointer-events:none;
  z-index:3;
  font-size:0.9rem;
  line-height:1.2;
}
.chart-slice-popover .csp-title{ font-weight:800; margin-bottom:.25rem; }
.chart-slice-popover .csp-row{ white-space:nowrap; }

/* =================++++++++++++=============
checkbox grid 
===================++++++++++++=============*/
 .checkbox-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .35rem 1rem;
    margin-top: .25rem;
  }
  .checkitem{
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 400;
    line-height: 1.3;
  }
  .checkitem input{ margin: 0; }