/* ===================================
   MAIN APPLICATION STYLES
   Consolidates: app.css, home.css, census.css, maintenance.css
   Modern enhancements added while preserving all existing functionality
   =================================== */

/* ===================================
   BASE & TYPOGRAPHY
   =================================== */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 20px;
  padding-top: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-color);
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h3.section-title,
h3.note-header,
h4.note-header {
  color: var(--modal-text-color);
}

p {
  margin-top: 0;
}

/* ===================================
   CONTAINERS & LAYOUTS
   =================================== */

.container {
  max-width: 1200px;
  margin: auto;
  background: var(--card-background);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.user-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--spacing-lg);
}

.user-info {
  flex: 1;
  min-width: 300px;
  margin-right: var(--spacing-lg);
}

/* Home Navigation Grid */
.home-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-xl);
}

.home-nav-grid .button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  min-height: 80px;
  font-size: 1.1em;
  text-align: center;
  transition: all var(--transition-base);
}

.home-nav-grid .button i {
  font-size: 1.5em;
}

/* ===================================
   FORM ELEMENTS
   =================================== */

input[type='text'],
input[type='number'],
input[type='date'],
input[type='password'],
input[type='email'],
input[type='tel'],
select,
textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition-fast);
  background: white;
  color: #333;
}

input[type='text']:focus,
input[type='number']:focus,
input[type='date']:focus,
input[type='password']:focus,
input[type='email']:focus,
input[type='tel']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(221, 114, 0, 0.1);
}

input[type='text']#editBarcodeId {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 1px;
}

input[readonly] {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  cursor: pointer;
  padding: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  color: var(--modal-text-color);
  font-weight: 500;
  font-size: 14px;
}

/* User Edit Modal Form Grid */
#editUserForm label {
  color: var(--modal-text-color);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: var(--spacing-xs);
  display: block;
}

/* Form field wrapper for 2-column layout */
.form-field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

/* Form field wrapper for 3-column layout (ID fields) */
.form-field-group-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field label {
  margin-bottom: var(--spacing-xs);
}

/* Full-width field */
.form-field-full {
  grid-column: 1 / -1;
}

/* Section headers */
#editUserForm h3 {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  grid-column: 1 / -1;
}

/* Full-width sections */
#editUserForm .form-group,
#editUserForm #staffFields,
#editUserForm #nonStaffFields,
#editUserForm #emergencyContactsField,
#editUserForm #staffApprovedSubjectsFields,
#editUserForm textarea {
  width: 100%;
}

#editUserForm > button[type="submit"],
#editUserForm > button[type="button"] {
  margin-top: var(--spacing-md);
}

@media (max-width: 768px) {
  .form-field-group,
  .form-field-group-3 {
    grid-template-columns: 1fr;
  }
}

/* File upload wrapper */
.file-upload-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.selected-file-name {
  color: var(--text-color);
  font-size: 14px;
  font-style: italic;
  opacity: 0.8;
}

/* Full width button */
.btn-full-width {
  width: 100% !important;
  margin-top: var(--spacing-lg);
}

/* ===================================
   BUTTONS
   =================================== */

button,
.button {
  background-color: var(--primary-color);
  color: var(--text-color);
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-right: 10px;
  transition: all var(--transition-base);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

button:hover,
.button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

button:active,
.button:active {
  transform: translateY(0);
}

button i,
.button i {
  margin-right: 0;
}

/* Button Variants */
.btn-icon {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  background-color: var(--primary-color);
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-base);
  font-weight: 500;
}

.btn-icon:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
}

.btn-icon i {
  margin-right: 0;
}

.edit-btn {
  background-color: #ffc107;
  color: #000;
}

.edit-btn:hover {
  background-color: #b0870e;
}

.delete-btn {
  background-color: #dc3545;
  color: #fff;
}

.delete-btn:hover {
  background-color: #b30e1f;
}

.add-btn {
  background-color: #28a745;
  color: #fff;
}

.add-btn:hover {
  background-color: #1c7731;
}

.primary-btn {
  background-color: #4caf50;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.secondary-btn {
  background-color: #607d8b;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.danger-btn {
  background-color: #dc3545;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-base);
}

.danger-btn:hover {
  background-color: #bd2130;
}

.submit-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 600;
}

.submit-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.home-button,
.history-button {
  position: absolute;
  top: 20px;
  padding: 10px 15px;
  background-color: var(--primary-color);
  color: var(--text-color);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-weight: 500;
}

.home-button {
  left: 20px;
}

.history-button {
  right: 20px;
}

.home-button:hover,
.history-button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.profile-button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 14px;
  transition: all var(--transition-base);
}

.modal-buttons,
.user-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--spacing-lg);
}

.user-action-buttons {
  justify-content: space-between;
}

.user-action-buttons button {
  flex: 0 1 auto;
}

/* ===================================
   USER CARDS & PROFILES
   =================================== */

.user-card {
  background-color: #f9f9f9;
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  width: 100%;
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

.user-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: var(--spacing-lg);
  width: 100%;
  margin-bottom: var(--spacing-lg);
}

.user-header-left {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 120px;
}

.user-header-info {
  flex: 1;
  min-width: 0;
  overflow: visible;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.user-header-info h2 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--modal-text-color);
}

.user-header-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 120px;
}

.user-header-buttons button {
  width: 100%;
  padding: 8px;
  white-space: nowrap;
  margin: 0;
}

.user-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.user-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.placeholder-image {
  width: 100%;
  height: 100%;
  background-color: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-weight: 600;
}

.user-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  color: var(--modal-text-color);
}

.user-detail {
  padding: var(--spacing-sm);
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.user-detail strong {
  color: var(--primary-color);
}

.user-detail .barcode-id {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 1px;
  background-color: #f8f9fa;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.user-details {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-lg);
  background-color: #ffffff;
  color: var(--modal-text-color);
  padding: 8px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.detail-column {
  flex: 1;
  min-width: 250px;
}

.user-info-columns {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

.user-notes {
  width: 100%;
  color: var(--modal-text-color);
  background-color: #ffffff;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.note-content {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  margin-bottom: 10px;
  line-height: 1.5;
}

.staff-education {
  flex: 1;
}

.staff-edu-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  color: var(--modal-text-color);
}

.staff-edu-table th,
.staff-edu-table td {
  border: 1px solid var(--table-border-color);
  padding: 8px;
  text-align: left;
}

.staff-edu-table th {
  background-color: var(--card-background);
  font-weight: bold;
  color: var(--text-color);
}

.staff-edu-table tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.05);
}

.user-status {
  margin-top: var(--spacing-lg);
  font-weight: bold;
}

/* ===================================
   SEARCH COMPONENTS
   =================================== */

#searchResults,
#hostSearchResults {
  margin-top: 10px;
}

#searchResults p {
  padding: 8px;
  margin: 0 0 5px 0;
  color: var(--text-color);
}

.search-results-scrollable {
  max-height: 150px;
  overflow-y: auto;
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.search-result-item {
  padding: 10px;
  background-color: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: rgb(173, 170, 170);
}

.search-container {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-bottom: var(--spacing-lg);
}

.search-container #hostSearchInput,
.search-container input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

/* Custom scrollbar */
.search-results-scrollable::-webkit-scrollbar {
  width: 8px;
}

.search-results-scrollable::-webkit-scrollbar-track {
  background: var(--background-color);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.search-results-scrollable::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: var(--radius-md);
}

.search-results-scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* Host Selection Modal Specific Styles */
.host-selection-modal .modal-content {
  background-color: var(--card-background);
  color: var(--text-color);
}

.host-selection-modal #hostSearchInput {
  background-color: var(--background-color);
  color: var(--text-color);
  border: 1px solid #555;
}

.host-selection-modal #hostSearchResults {
  color: var(--text-color);
}

.host-selection-modal .search-results-scrollable {
  background-color: var(--background-color);
  border-color: #555;
}

.host-selection-modal .search-result-item {
  background-color: var(--card-background);
  border-bottom: 1px solid #555;
  color: var(--text-color);
}

.host-selection-modal .search-result-item:hover {
  background-color: var(--secondary-color);
}

.host-selection-modal h2 {
  color: var(--text-color);
}

/* ===================================
   MODALS
   =================================== */

.modal {
  display: none;
  position: fixed;
  z-index: var(--z-modal);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: var(--spacing-xl);
  border: none;
  width: 90%;
  max-width: 1000px;
  border-radius: var(--radius-xl);
  color: var(--modal-text-color);
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.3s ease-out;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4,
.modal-content h5,
.modal-content h6 {
  color: var(--modal-text-color);
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}

/* Lounge Update Form */
#loungeUpdateForm .form-group {
  margin-bottom: 15px;
}

#loungeUpdateForm input[readonly] {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

#loungeUpdateForm textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  resize: vertical;
}

#addLoungeUpdateBtn {
  background-color: var(--primary-color);
  color: var(--text-color);
}

#addLoungeUpdateBtn:hover {
  background-color: var(--secondary-color);
}

/* ===================================
   MESSAGES & NOTIFICATIONS
   =================================== */

#message {
  margin-top: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
}

.success,
.success-message {
  background-color: var(--success-bg);
  color: var(--secondary-color);
  padding: 15px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--success-color);
}

.error,
.error-message {
  background-color: var(--error-bg);
  color: #721c24;
  padding: 15px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--error-color);
}

.status-message {
  margin: var(--spacing-lg) 0;
  padding: 15px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: bold;
}

.status-message.success {
  background-color: var(--success-color);
  color: white;
}

.status-message.warning {
  background-color: var(--warning-bg);
  color: var(--modal-text-color);
  border: 1px solid var(--warning-color);
}

.status-message.error {
  background-color: var(--error-color);
  color: white;
}

.status-message.info {
  background-color: var(--info-bg);
  color: var(--modal-text-color);
  border: 1px solid var(--info-color);
}

/* ===================================
   TOOLTIPS
   =================================== */

.info-tooltip {
  cursor: help;
  margin-left: 5px;
  position: relative;
}

.info-tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  right: 0;
  transform: translateY(5px);
  background-color: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  white-space: normal;
  max-width: 450px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  z-index: 1000;
  line-height: 1.4;
  font-size: 14px;
}

.info-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

.icon-tooltip {
  position: relative;
  display: inline-block;
  margin-left: 5px;
}

.icon-tooltip .tooltiptext {
  visibility: hidden;
  width: auto;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  position: absolute;  /* Changed from fixed to absolute */
  bottom: 125%;  /* Position above the icon */
  left: 50%;
  transform: translateX(-50%);  /* Center horizontally */
  z-index: 99999;
  opacity: 0;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  white-space: nowrap;
  font-size: 14px;
  pointer-events: none;
}

.icon-tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Add a small arrow pointing down */
.icon-tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

/* Emergency Contacts Tooltip */
.emergency-contacts-tooltip {
  min-width: 400px !important;
  max-width: 500px !important;
  width: max-content !important;
  padding: 12px !important;
  text-align: left !important;
  white-space: normal !important;
  position: absolute !important;
  bottom: 125% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 99999 !important;
}

/* When tooltip would overflow left, align to left edge of icon */
.emergency-contacts-tooltip.align-left {
  left: 0 !important;
  transform: translateX(0) !important;
}

/* When tooltip would overflow right, align to right edge of icon */
.emergency-contacts-tooltip.align-right {
  left: auto !important;
  right: 0 !important;
  transform: translateX(0) !important;
}

.emergency-contacts-tooltip .tooltip-header {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 4px;
}

.emergency-contacts-tooltip .tooltip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.emergency-contacts-tooltip .tooltip-table th {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 6px 8px;
  text-align: left;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.emergency-contacts-tooltip .tooltip-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.emergency-contacts-tooltip .tooltip-table tr:last-child td {
  border-bottom: none;
}

.emergency-contacts-tooltip .tooltip-table tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ===================================
   ICONS & BADGES
   =================================== */

.delete-x {
  color: red;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: inline-block;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  border-radius: 50%;
  transition: background-color var(--transition-base);
}

.delete-x:hover {
  background-color: rgba(255, 0, 0, 0.1);
}

.restricted-icons {
  background-color: red;
  color: white;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin-bottom: 10px;
  font-weight: 600;
}

.restricted-icons i {
  margin-right: 5px;
}

.restricted-warning {
  background-color: #ff0000;
  color: white;
  border: 3px solid #cc0000;
  padding: 15px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin: var(--spacing-lg) 0;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
}

.birthday-icons {
  font-size: 1.5em;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  margin-left: 10px;
}

.birthday-icons i {
  margin-right: 5px;
  color: var(--modal-text-color);
}

.fa-cake-candles {
  color: #ffd700;
}

.birthday-today {
  color: #ff4500;
}

.birthday-soon {
  color: #32cd32;
}

.birthday-recent {
  color: #1e90ff;
}

.pending-badge {
  background-color: var(--warning-color);
  color: var(--modal-text-color);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.8em;
  margin-left: 10px;
  font-weight: 600;
}

.notes-icon {
  cursor: pointer;
  position: relative;
}

.notes-content {
  position: absolute;
  background-color: #f9f9f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  z-index: 10001;
  top: 100%;
  left: 0;
  width: 300px;
  max-height: 200px;
  overflow-y: auto;
  padding: 15px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: normal;
  font-family: Arial, Helvetica, sans-serif;
  box-shadow: var(--shadow-lg);
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.notes-content p {
  margin-bottom: 10px;
}

.notes-content strong {
  font-weight: bold;
  display: inline-block;
  margin-right: 5px;
}

.notes-content .note-content {
  font-weight: normal;
  display: inline;
}

.notes-content.visible {
  visibility: visible;
  opacity: 1;
}

.notes-content.left {
  right: 100%;
  top: 0;
  margin-right: 10px;
  left: auto;
}

.notes-content.right {
  left: 100%;
  top: 0;
  margin-left: 10px;
}

/* ===================================
   TABLES
   =================================== */

.table-container {
  width: 100%;
  margin: 15px 0;
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  box-sizing: border-box;
}

.notes-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  table-layout: fixed;
}

.notes-table th,
.notes-table td {
  border: 1px solid var(--border-color);
  padding: 12px;
  font-size: 14px;
  text-align: left;
  position: relative;
  width: 33.33%;
  min-width: 200px;
}

.truncate-cell {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}

.truncate-cell:hover::after {
  content: attr(data-full-text);
  position: absolute;
  left: 0;
  top: 100%;
  background-color: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  z-index: 1000;
  white-space: normal;
  min-width: 200px;
  max-width: 500px;
  word-wrap: break-word;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  line-height: 1.4;
}

.emergency-contacts {
  width: 100%;
  background-color: #ffffff;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.emergency-contacts h3 {
  color: var(--modal-text-color);
  margin-bottom: var(--spacing-md);
  font-size: 1.1rem;
  font-weight: 600;
}

.emergency-contacts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--modal-text-color);
}

.emergency-contacts-table th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.emergency-contacts-table th:first-child {
  border-top-left-radius: var(--radius-md);
}

.emergency-contacts-table th:last-child {
  border-top-right-radius: var(--radius-md);
}

.emergency-contacts-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  color: var(--modal-text-color);
}

.emergency-contacts-table tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-md);
}

.emergency-contacts-table tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-md);
}

.emergency-contacts-table tr:last-child td {
  border-bottom: none;
}

.emergency-contacts-table tbody tr {
  transition: background-color 0.2s ease;
}

.emergency-contacts-table tbody tr:hover {
  background-color: #f9fafb;
}

/* ===================================
   CHECK IN / OUT & CENSUS PAGES
   =================================== */

#checkInOut {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-xl);
  background-color: var(--background-color);
  border-radius: var(--radius-lg);
}

#checkInOut button {
  margin-top: 10px;
}

#userInfo {
  margin-top: var(--spacing-lg);
}

/* Census Summary Section */
#checkedInSummary {
  margin-bottom: var(--spacing-lg);
}

/* Stats Overview - Compact Cards */
.stats-overview {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-md);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--card-background);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 140px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.stat-card-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  box-shadow: 0 4px 12px rgba(221, 114, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card-primary:hover {
  box-shadow: 0 6px 20px rgba(221, 114, 0, 0.5);
}

.stat-icon {
  font-size: 1.8em;
  color: rgba(255, 255, 255, 0.9);
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toggle-details-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--card-background);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9em;
  font-weight: 500;
  margin-left: auto;
}

.toggle-details-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary-color);
}

.toggle-details-btn i {
  transition: transform 0.2s ease;
}

/* Location Breakdown Mini Cards */
.location-breakdown-cards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.location-mini-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: var(--card-background);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border-left: 4px solid var(--primary-color);
  flex: 0 1 auto;
  min-width: 120px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--primary-color);
}

.location-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  border-left-color: var(--secondary-color);
}

.location-mini-icon {
  font-size: 1.2em;
  color: var(--primary-color);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(221, 114, 0, 0.1);
  border-radius: var(--radius-sm);
}

.location-mini-content {
  flex: 1;
  min-width: 0;
}

.location-mini-value {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1;
  margin-bottom: 2px;
}

.location-mini-label {
  font-size: 0.75em;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detailed-breakdown {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
}

#checkedInSummary table {
  font-size: 0.9em;
  margin: 10px 0;
}

#checkedInSummary td,
#checkedInSummary th {
  padding: 5px;
}

.summary-table {
  background: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  width: 100%;
}

.summary-table caption {
  font-size: 1.1em;
  font-weight: 600;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  text-align: left;
}

.summary-table tbody {
  display: table-row-group;
  width: 100%;
}

.summary-table tr:not(.breakdown-container) {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color var(--transition-fast);
}

.summary-table tr.breakdown-container {
  display: table-row;
  padding: 0;
  width: 100%;
}

.summary-table tr.breakdown-container.collapsed {
  display: none;
}

.summary-table tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.summary-table tr:last-child {
  border-bottom: none;
}

.summary-table td {
  color: var(--text-color);
  padding: 0;
}

.summary-table td:first-child {
  font-weight: 500;
}

.summary-table td:last-child {
  font-weight: 700;
  color: var(--primary-color);
  min-width: 50px;
  text-align: right;
}

/* Location breakdown styles */
.location-row {
  cursor: pointer;
}

.location-row:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.breakdown-icon {
  margin-right: 8px;
  font-size: 0.8em;
  transition: transform 0.2s ease;
}

.breakdown-container {
  background-color: rgba(0, 0, 0, 0.2);
}

.breakdown-container td {
  padding: 0 !important;
  width: 100%;
}

.breakdown-table {
  width: 100% !important;
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.breakdown-row td {
  color: var(--text-color);
  opacity: 0.9;
  font-size: 0.95em;
  padding: var(--spacing-xs) var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breakdown-row td:first-child {
  width: 70%;
}

.breakdown-row td:last-child {
  width: 30%;
  text-align: right;
}

.breakdown-row:last-child td {
  border-bottom: none;
}

/* User Grid Layout */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--spacing-lg);
}

#checkedInUsersList {
  margin-top: var(--spacing-lg);
  overflow: visible;
}

/* User Entry Cards */
.user-entry {
  position: relative;
  background-color: #f9f9f9;
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  color: #333;
  overflow: visible; /* Always allow tooltips to show */
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 300px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  z-index: 1;
}

.user-entry:hover {
  background-color: #e9e9e9;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.user-entry .user-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 15px;
  box-shadow: var(--shadow-md);
}

.user-entry .user-info {
  width: 100%;
  text-align: left;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  align-self: flex-start;
}

.user-entry h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #222;
  font-size: 1.1em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.user-entry .user-icons {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.user-entry p {
  margin: 5px 0;
  color: #444;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.user-entry p strong {
  color: #222;
}

.user-entry .check-in-time {
  font-size: 0.9em;
  color: #666;
  margin-top: 5px;
}

/* Filter Styles */
.filter-icon {
  cursor: pointer;
  padding: 10px;
  font-size: 1.2em;
  transition: color var(--transition-fast);
}

.filter-icon:hover {
  color: var(--primary-color);
}

.filter-popup {
  display: none;
  position: absolute;
  right: 0;
  background-color: #f9f9f9;
  min-width: 200px;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  padding: 15px;
  border-radius: var(--radius-md);
  color: #333;
  max-height: 200px;
  overflow-y: auto;
}

.filter-popup h2,
.filter-popup h3,
.filter-popup span,
.filter-popup label {
  color: #333 !important;
}

.filter-popup.show {
  display: block;
}

.filter-content {
  max-height: 80vh;
}

.filter-group {
  margin-bottom: 15px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
}

.checkbox-group label {
  margin-bottom: 5px;
  cursor: pointer;
}

#statusFilter {
  height: auto;
  min-height: 100px;
}

.header-container {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===================================
   MAINTENANCE CHECKLIST PAGES
   =================================== */

.location-selector {
  margin: var(--spacing-lg) 0;
  text-align: center;
}

.location-selector select {
  padding: 10px;
  width: 300px;
  border-radius: var(--radius-md);
  font-size: 16px;
}

.checklist-type {
  margin: var(--spacing-2xl) 0;
}

.checklist-buttons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-top: 15px;
}

.checklist-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-xl);
  background-color: var(--primary-color);
  color: var(--text-color);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  width: 200px;
  font-size: 16px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
  font-weight: 600;
}

.checklist-btn i {
  font-size: 36px;
  margin-bottom: 10px;
}

.checklist-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.previous-checklist {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-xl);
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.checklist-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--divider-color);
  padding-bottom: 15px;
}

.checklist-info p {
  margin: 5px 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}

.checklist-item label {
  color: var(--modal-text-color);
  cursor: pointer;
}

.checklist-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.checklist-item input[type='checkbox'] {
  margin-right: 10px;
  transform: scale(1.2);
  cursor: pointer;
}

.checklist-item.completed {
  background-color: var(--success-bg);
}

.checklist-item.completed label {
  color: var(--modal-text-color);
}

.checklist-item.incomplete {
  background-color: var(--error-bg);
}

.checklist-item.incomplete label {
  color: var(--modal-text-color);
}

#previous-checklist .checklist-item {
  pointer-events: none;
}

.read-only-checklist .checklist-item {
  padding: 15px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
}

.read-only-checklist .completed-task {
  background-color: var(--success-bg);
  color: #2e7d32;
}

.read-only-checklist .incomplete-task {
  background-color: var(--error-bg);
  color: #c62828;
}

.completed-task {
  color: #2e7d32;
}

.incomplete-task {
  color: #757575;
}

.notes-section {
  margin-top: var(--spacing-2xl);
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: var(--radius-md);
  color: #1a1a1a;
}

.notes-section h4 {
  color: #1a1a1a;
  margin-top: 0;
  margin-bottom: 10px;
}

.completion-info {
  text-align: right;
  font-style: italic;
  margin-top: var(--spacing-lg);
  color: #666;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--spacing-lg);
}

.completed-checklist {
  background-color: var(--card-background);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 15px;
  border-left: 4px solid var(--success-color);
  color: var(--text-color);
}

.completed-checklist[data-status='pending'] {
  border-left: 4px solid var(--warning-color);
}

.checklist-header {
  margin-bottom: 10px;
}

#LocationPrompt {
  color: var(--text-color);
}

/* Staff Search */
.staff-search-container {
  position: relative;
  width: 100%;
}

.staff-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  display: none;
}

.staff-search-results.active {
  display: block;
}

.staff-result-item {
  padding: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
  transition: background-color var(--transition-fast);
}

.staff-result-item:hover {
  background-color: #f5f5f5;
}

.staff-result-item:last-child {
  border-bottom: none;
}

.staff-name {
  font-weight: bold;
}

.staff-id {
  color: #666;
  font-size: 0.9em;
  font-family: 'Courier New', Courier, monospace;
}

.numeric-match {
  font-weight: bold;
  color: #337ab7;
}

.no-results {
  padding: 10px;
  text-align: center;
  color: #666;
}

.input-error {
  border-color: var(--error-color) !important;
  background-color: #fff8f8;
}

.valid-staff {
  border-color: var(--success-color) !important;
  background-color: #f8fff8;
}

.help-text {
  color: #666;
  font-size: 0.8rem;
  margin-top: 5px;
  display: block;
}

/* Confirmation Dialog */
.confirmation-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1100;
  width: 90%;
  max-width: 400px;
  text-align: center;
}

.confirmation-dialog h3 {
  margin-top: 0;
  color: var(--error-color);
}

.confirmation-dialog p {
  margin: 15px 0;
  color: #1a1a1a;
}

.confirmation-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: var(--spacing-lg);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1050;
}

.maintenance-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-color: var(--primary-color);
  color: var(--text-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  text-decoration: none;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-base);
  z-index: 999;
}

.maintenance-button:hover {
  background-color: var(--secondary-color);
  transform: scale(1.1);
}

.maintenance-button i {
  pointer-events: none;
}

/* ===================================
   HOME PAGE SPECIFIC
   =================================== */

.logo {
  height: 100px;
  width: 150px;
  display: block;
  margin: 0 auto var(--spacing-lg);
  transition: transform var(--transition-base);
}

.logo:hover {
  transform: scale(1.05);
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.hidden {
  display: none;
}

.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: var(--spacing-sm);
}

.mt-2 {
  margin-top: var(--spacing-md);
}

.mt-3 {
  margin-top: var(--spacing-lg);
}

.mb-1 {
  margin-bottom: var(--spacing-sm);
}

.mb-2 {
  margin-bottom: var(--spacing-md);
}

.mb-3 {
  margin-bottom: var(--spacing-lg);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {
  body {
    padding: 10px;
    padding-top: 70px;
  }

  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.5em;
  }

  h2 {
    font-size: 1.3em;
  }

  .user-container {
    flex-direction: column;
  }

  .user-info,
  .user-image {
    width: 100%;
    margin-right: 0;
  }

  .user-info-columns {
    flex-direction: column;
  }

  .user-notes,
  .staff-education {
    width: 100%;
  }

  .user-header {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
  }

  .user-image {
    margin-right: 0;
    margin-bottom: 15px;
  }

  .user-details-grid {
    grid-template-columns: 1fr;
  }

  button,
  .button {
    width: 100%;
    margin: 5px 0;
    justify-content: center;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 15px;
  }

  input[type='text'],
  input[type='number'],
  input[type='date'],
  input[type='password'],
  input[type='email'],
  select,
  textarea {
    font-size: 16px;
  }

  .search-container {
    width: 100%;
  }

  #searchInput {
    font-size: 16px;
  }

  .logo {
    height: 80px;
    width: 120px;
  }

  .emergency-contacts-table th,
  .emergency-contacts-table td,
  .notes-table th,
  .notes-table td {
    padding: 8px;
    font-size: 13px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer button {
    width: 100%;
  }

  /* Stats cards responsive */
  .stats-overview {
    flex-direction: column;
    align-items: stretch;
  }

  .stat-card {
    min-width: unset;
    width: 100%;
  }

  .toggle-details-btn {
    margin-left: 0;
    justify-content: center;
  }

  .location-breakdown-cards {
    flex-direction: column;
  }

  .location-mini-card {
    width: 100%;
    min-width: unset;
  }

  .detailed-breakdown {
    grid-template-columns: 1fr;
  }

  #checkedInSummary table {
    width: 100%;
  }

  .checklist-buttons {
    flex-direction: column;
    align-items: center;
  }

  .checklist-btn {
    width: 90%;
    max-width: 300px;
  }
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
  .container {
    max-width: 90%;
  }

  .user-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
