/* =========================================================
 * Attendance – Consolidated & Deduplicated CSS
 * Notes:
 * - Inline <style> blocks in PHP can be removed; this file covers them.
 * - Duplicates merged (e.g., gold outline button, spinners, First Timers UI).
 * - Keyframes unified to `ap-spin` (was `apSpin`/`apspin`).
 * - Fixed WebKit date selector typos (extra spaces).
 * - Kept backward compatibility for existing markup (e.g., #es-loading-spinner.loader).
 * =======================================================*/

/* ========== 1) Utilities / Base ========== */
[aria-busy="true"] {
  cursor: progress !important;
  opacity: .7;
}

.es-message {
  font-size: 14px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 4px;
  text-align: center;
  font-weight: 500;
}

.es-message[style*="orange"] {
  background-color: #fd7e14 !important;
}

.submit-hint {
  margin-top: 8px;
  font-size: 14px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 8px 12px;
  border-radius: 4px;
  text-align: center;
  display: none;
}

/* Spinner (unified) */
.ap-spinner,
/* preferred class */
#es-loading-spinner.loader,
/* compatibility with existing markup */
.ap-first-timers-v2 .ap-ft-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #ddd;
  border-top-color: #666;
  border-radius: 50%;
  animation: ap-spin 1s linear infinite;
}

@keyframes ap-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== 2) Frontend attendance forms (three-in-one) ========== */
.es-attendance-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

.es-attendance-container .es-attendance-form {
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  animation: fadeInUp .3s ease;
  position: relative;
}

.es-attendance-container .es-attendance-form .form-logo {
  margin: 0;
  position: absolute;
  left: 5px;
  top: 5px;
  width: 30px;
}

.es-attendance-container .es-attendance-form .form-title {
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #FFD700;
  color: #333;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.es-attendance-container .es-attendance-form .form-body {
  padding-left: 10px;
  padding-right: 10px;
  width: 100%;
  box-sizing: border-box;
}

.es-attendance-container .es-attendance-form input[type="text"],
.es-attendance-container .es-attendance-form input[type="date"],
.es-attendance-container .es-attendance-form input[type="email"],
.es-attendance-container .es-attendance-form select {
  margin-bottom: 12px;
  padding: 8px;
  border: 2px solid #ddd;
  border-radius: 6px;
  color: #333;
  font-size: 16px;
  transition: border-color .3s ease;

  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.es-attendance-container .es-attendance-form input[type="text"]:focus,
.es-attendance-container .es-attendance-form input[type="date"]:focus,
.es-attendance-container .es-attendance-form input[type="email"]:focus,
.es-attendance-container .es-attendance-form select:focus {
  border-color: #FFD700;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 166, 191, .1);
}

/* Disabled fields */
.es-attendance-container .es-attendance-form input:disabled,
.es-attendance-container .es-attendance-form select:disabled {
  background: #f5f5f5 !important;
  color: #999 !important;
  cursor: not-allowed !important;
  border-color: #e0e0e0 !important;
}

/* Submit buttons */
.es-attendance-container .es-attendance-form input[type="submit"] {
  padding: 8px 10px;
  background: #FFD700 !important;
  color: #333;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 600;
  transition: background-color .3s ease, transform .1s ease;
  width: 100%;
}

.es-attendance-container .es-attendance-form input[type="submit"]:hover:not(:disabled) {
  background: #18642a;
  transform: translateY(-1px);
}

.es-attendance-container .es-attendance-form input[type="submit"]:active:not(:disabled) {
  transform: none;
}

.es-attendance-container .es-attendance-form input[disabled],
.es-attendance-container .es-attendance-form input[disabled]:hover {
  background: #ccc !important;
  cursor: default !important;
  transform: none !important;
}

/* Info bars (dates) */
.es-attendance-container .es-attendance-form #date-message,
.es-attendance-container .es-attendance-form #date-message-first {
  color: #333;
  font-weight: 500;
  text-align: center;
  padding: 10px;
  margin-bottom: 15px;
  background: #e8f4f8;
  border-radius: 6px;
  border-left: 4px solid #FFD700;
}

/* Phone row */
.es-attendance-container .es-attendance-form .phone-box,
#es_profile_form .phone-box {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  width: 100%;
  box-sizing: border-box;
}

.es-attendance-container .es-attendance-form .phone-box select,
#es_profile_form .phone-box select {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  margin-bottom: 0;
  flex: 0 0 80px;
  box-sizing: border-box;
}

.es-attendance-container .es-attendance-form .phone-box input,
#es_profile_form .phone-box input {
  margin-bottom: 0;
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Switch between forms */
.form-switch-buttons {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

@media (max-width: 768px) {
  .form-switch-buttons {
    justify-content: center;
  }
}

.form-switch-buttons .switch-btn {

  transition: all .3s ease;
  border: none;
}

.form-switch-buttons .switch-btn.switch-btn-right {
  font-size: 16px;
  padding: 5px 16px;
  border-radius: 4px;
  background-color:
    color-mix(in oklab, #84d303 10%, transparent);
  color: #4a7502;
}

.es-attendance-container .es-attendance-form .form-switch-buttons .switch-btn.switch-btn-right:hover {
  background-color:
    color-mix(in oklab, #84d303 30%, transparent);
}

.form-switch-buttons .switch-btn.switch-btn-full {
  font-size: 16px;
  padding: 5px 16px;
  border-radius: 4px;
  width: 100%;
  background-color:
    color-mix(in oklab, #84d303 10%, transparent);
  color: #4a7502;
}

.es-attendance-container .es-attendance-form .form-switch-buttons .switch-btn.switch-btn-full:hover {
  background-color:
    color-mix(in oklab, #84d303 30%, transparent);
}

.es-attendance-container .es-attendance-form .form-switch-buttons .switch-btn.switch-btn-left {
  font-size: 14px;
  background: #ffffff;
  color: #475569;
  padding: 2px;
  width: fit-content;
  border-radius: 0px;

  border-bottom: 1px dashed #475569;
}

.es-attendance-container .es-attendance-form .form-switch-buttons .switch-btn.switch-btn-left:hover {
  background: #f3f4f6;
  color: #1f2937;
  color: #333;
}


.es-attendance-container .es-attendance-form .form-switch-buttons .switch-btn:active {
  transform: translateY(1px);
}

/* Errors */
.es-attendance-container .es-attendance-form input.error,
.es-attendance-container .es-attendance-form select.error {
  border-color: #dc3545;
  background: #fff5f5;
}

.es-attendance-container .es-attendance-form input.error:focus,
.es-attendance-container .es-attendance-form select.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, .1);
}

/* Profile check + actions */
.es-attendance-container .es-attendance-form #profile-check-section {
  margin-bottom: 20px;
}

.es-attendance-container .es-attendance-form .profile-check-btn {
  width: 100%;
  padding: 8px 10px;
  background: #FFD700;
  color: #333;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all .3s ease;
}

.es-attendance-container .es-attendance-form .profile-check-btn:hover:not(:disabled) {
  background: #c9b43b;
  transform: translateY(-1px);
}

.es-attendance-container .es-attendance-form .profile-check-btn:disabled {
  background: #6c757d !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.es-attendance-container .es-attendance-form #profile-user-info {
  animation: fadeIn .3s ease;
}

.profile-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: nowrap;
  width: 100%;
}

#profile-user-info .profile-action-row input[type="submit"],
#profile-user-info .profile-action-row button {
  /* flex: 1; */
  min-width: 0;
  white-space: nowrap;
  border: none;
  border-radius: 4px;
}

/* Theme overrides for submit buttons inside plugin container */
.es-attendance-container input[type="submit"],
.es-attendance-container button[type="submit"],
.es-attendance-container .profile-check-btn {
  line-height: 1.2 !important;
  height: auto !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  font-size: 16px;
  margin: 0;
}

/* Profile form – full width fields */
#es_profile_form input[type="text"],
#es_profile_form input[type="email"],
#es_profile_form input[type="date"],
#es_profile_form select {
  width: 100%;
  box-sizing: border-box;
}

#es_profile_form button {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 16px;
}

#es_profile_form #profile-cancel-edit {
  background: rgb(243 177 130);

}

#es_profile_form .profile-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
}

#es_profile_form .profile-action-row>* {
  width: auto;
  white-space: nowrap;
}

#es_profile_form .profile-action-row+.submit-hint {
  margin-top: 8px;
}

#es_first_time_form .es-checkbox {
  color: #333;
  margin-bottom: 10px;
}

/* ========== 3) Frontend Dashboard (filters + table) ========== */
.wrap.ap-frontend-dashboard {
  font-size: 14px;
  padding: 10px
}

.ap-frontend-dashboard .filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 10px 0 16px;
}

.ap-frontend-dashboard .filter-form input[type="text"],
.ap-frontend-dashboard .filter-form input[type="date"],
.ap-frontend-dashboard .filter-form select {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d7d7d7;
  background: #fff;
  min-height: 36px;
  color: #111;
}

.ap-frontend-dashboard .filter-form select {
  width: auto;
}

.ap-frontend-dashboard .filter-form .checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  min-height: 36px;
  border-radius: 6px;
}

.ap-frontend-dashboard .filter-form .submit-btn {
  width: auto;
  min-width: 110px;
  height: 40px;
  border-radius: 6px;
  background: #ffd400;
  border: 1px solid #ffd400;
  font-size: 14px;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
}

.ap-frontend-dashboard .filter-form .submit-btn:hover {
  background: #d6b40c;
}

.ap-frontend-dashboard .filter-form .export-csv {
  width: auto;
  min-width: 140px;
  height: 40px;
  border-radius: 6px;
  background: #0073aa;
  border: 1px solid #0073aa;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

.ap-frontend-dashboard .filter-form .export-csv:hover {
  background: #06567b;
}

.ap-frontend-dashboard .bulk-action-bar {
  margin: 8px 0 15px;
}

/* Table & loader */
#filter-table-response {
  position: relative;
  overflow-x: auto;
}

#loader-box {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .6);
  z-index: 10;
}

.ap-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
}

.ap-table thead th {
  background: #f6f7f7;
  text-align: left;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid #e6e6e6;
  white-space: nowrap;
}

.ap-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  white-space: nowrap;
}

/* Phone / Email wrap */
.ap-table td:nth-child(6),
.ap-table td:nth-child(7) {
  min-width: 120px;
  white-space: normal;
  word-break: break-word;
}

/* Date columns */
.ap-table th:nth-child(10),
.ap-table th:nth-child(11),
.ap-table td:nth-child(10),
.ap-table td:nth-child(11) {
  min-width: 120px;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}

.ap-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.ap-table tbody tr:hover {
  background: #f5fbff;
}

/* View button */
.ap-table .view-attendance-button {
  padding: 6px 10px;
  border-radius: 6px;
  background: #FFD700;
  color: #333;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.ap-table .view-attendance-button:hover {
  background: #165e27;
}

/* Pager */
.ap-pager a {
  display: inline-block;
  margin: 0 3px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
}

.ap-pager a.active {
  background: #ccc;
  color: #fff;
  pointer-events: none;
  cursor: default;
}

.ap-pager a.disabled {
  background: #eee;
  color: #aaa;
  pointer-events: none;
  cursor: not-allowed;
}

/* Modal */
#attendance-info-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: rgba(0, 0, 0, .5);
}

#attendance-info-modal .popup-content {
  position: relative;
  background: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

#attendance-info-modal .close {
  background: none;
  color: #000;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  border: none;
}

#attendance-info-modal .close::before,
#attendance-info-modal .close::after {
  display: none;
}

#attendance-info-modal .close:hover,
#attendance-info-modal .close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.ap-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.ap-modal-error {
  padding: 12px;
  color: #b00020;
}

/* ========== 4) First Timers / Newcomers (scoped) ========== */
.ap-first-timers-v2 .ap-ft-toolbar {
  margin-bottom: 12px;
}

.ap-first-timers-v2 .ap-ft-time-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ap-first-timers-v2 .ap-ft-row {
  margin-top: 12px;
  margin-bottom: 12px;
}

.ap-first-timers-v2 .ap-ft-row button {
  font-size: 16px;
  padding-bottom: 10px;
  padding-top: 10px;
}

.ap-first-timers-v2 .ap-ft-row button.button-right {
  padding-bottom: 9px;
  padding-top: 9px;
  background-color:
    color-mix(in oklab, #84d303 10%, transparent);
  color: #4a7502;
  border: 1px solid #4a7502;
}

/* 默认：小屏 1 列 */
.ap-first-timers-v2 .ap-ft-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
}

/* 大屏（例如 ≥1024px）：3 列 */
@media (min-width: 1024px) {
  .ap-first-timers-v2 .ap-ft-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


.ap-first-timers-v2 .ap-ft-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  padding: 10px 12px;
}

.ap-first-timers-v2 .ap-ft-card .ap-ft-actions {
  display: flex;
  justify-content: flex-end;
}

/* 作用于组件内的删除按钮，覆盖主题黄色 */
.ap-first-timers-v2 .ap-ft-actions .ap-ft-delete {
  appearance: none;
  border: 1px solid #e5e7eb;
  /* 灰色描边 */
  background: #ffffff;
  /* 白底 */
  color: #b91c1c;
  /* 深红字，危险操作感 */
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}

/* hover / focus / disabled 状态 */
.ap-first-timers-v2 .ap-ft-actions .ap-ft-delete:hover {
  background: #fee2e2;
  /* 淡红底 */
  border-color: #fecaca;
}

.ap-first-timers-v2 .ap-ft-actions .ap-ft-delete:focus {
  outline: 2px solid #fecaca;
  outline-offset: 2px;
}

.ap-first-timers-v2 .ap-ft-actions .ap-ft-delete:disabled {
  opacity: .6;
  cursor: not-allowed;
}




.ap-first-timers-v2 .ap-ft-name {
  font-weight: 600;
}

.ap-first-timers-v2 .ap-ft-meta {
  font-size: 14px;
  color: #666;
  margin-top: 6px;
}

.ap-first-timers-v2 .ap-ft-empty {
  padding: 12px;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
}

/* Date inputs (IDs scoped) */
#ap-ft-start,
#ap-ft-end {
  color: #006400;
  caret-color: #006400;
}

#ap-ft-start::-webkit-datetime-edit,
#ap-ft-end::-webkit-datetime-edit,
#ap-ft-start::-webkit-datetime-edit-text,
#ap-ft-end::-webkit-datetime-edit-text,
#ap-ft-start::-webkit-datetime-edit-month-field,
#ap-ft-end::-webkit-datetime-edit-month-field,
#ap-ft-start::-webkit-datetime-edit-day-field,
#ap-ft-end::-webkit-datetime-edit-day-field,
#ap-ft-start::-webkit-datetime-edit-year-field,
#ap-ft-end::-webkit-datetime-edit-year-field {
  color: #006400;
}

#ap-ft-start::-webkit-calendar-picker-indicator,
#ap-ft-end::-webkit-calendar-picker-indicator {
  opacity: .85;
  filter: hue-rotate(75deg) saturate(160%) brightness(.95);
}

#ap-ft-start:focus,
#ap-ft-end:focus {
  outline: none;
  border-color: #006400;
  box-shadow: 0 0 0 2px rgba(0, 100, 0, .15);
}

/* Outline gold button (shared component) */
button.ap-btn-outline-gold {
  --gold: #DAA520;
  --gold-hover: #B8860B;
  --gold-active: #8B6B00;
  --gold-ring: rgba(255, 215, 0, .35);
  background: transparent;
  color: var(--gold);
  border: 1px solid currentColor;
  border-radius: 8px;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s;
}

button.ap-btn-outline-gold:hover {
  color: var(--gold-hover);
  background-color: rgba(255, 215, 0, .08);
}

button.ap-btn-outline-gold:active {
  color: var(--gold-active);
  background-color: rgba(255, 215, 0, .15);
}

button.ap-btn-outline-gold:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--gold-ring);
}

button.ap-btn-outline-gold[disabled],
button.ap-btn-outline-gold[aria-busy="true"] {
  opacity: .5;
  cursor: not-allowed;
  background: transparent;
}

/* ========== 5) Animations ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ========== 6) Responsive ========== */
@media (max-width: 768px) {
  .es-attendance-container {
    margin: 10px;
    padding: 15px;
  }

  .es-attendance-container .es-attendance-form {
    padding: 20px;
  }

  /* 只影响表单标题里的 logo，不动其它图片的“居中”行为 */


  .es-attendance-container .es-attendance-form input[type="submit"] {
    padding: 12px 20px;
    font-size: 16px;
  }

  .form-switch-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .switch-btn {
    width: 100%;
    padding: 10px 16px;
  }

  .ap-frontend-dashboard .filter-form {
    gap: 10px;
  }

  .ap-frontend-dashboard .filter-form input[type="text"],
  .ap-frontend-dashboard .filter-form input[type="date"],
  .ap-frontend-dashboard .filter-form select {
    width: 100%;
  }

  .ap-frontend-dashboard .filter-form .checkbox-container {
    width: 100%;
    padding: 4px 0 8px;
  }

  .ap-frontend-dashboard .filter-form .submit-btn,
  .ap-frontend-dashboard .filter-form .export-csv {
    width: 100%;
  }

  .ap-table thead th,
  .ap-table tbody td {
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* ========== 7) Print ========== */
@media print {
  .ap-first-timers-v2 .ap-ft-card {
    box-shadow: none;
    border: 0;
  }

  .ap-first-timers-v2 .ap-ft-field {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .ap-first-timers-v2 .ap-ft-label {
    user-select: none;
  }
}