/* Salary Cards */
.salary-card {
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 20px;
  margin: auto;
}

.salary-card-title {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 20px;
  text-align: center;
  background-color: #e6f0fa; /* Xanh dương nhạt */
  color: #2f6de3; /* Xanh dương đậm */
  padding: 10px;
  border-radius: 8px;
}

.salary-section {
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding: 8px 8px 1px 8px;
  border-radius: 8px;
}

.section-title {
  font-size: 1.2em;
  font-weight: bold;
}

.blue-bg {
  background-color: #e6f0fa; /* Xanh dương nhạt */
}

.blue-text {
  color: #003087; /* Xanh dương đậm */
}

.red-bg {
  background-color: #fce4e4; /* Đỏ nhạt */
}

.red-text {
  color: #a10000; /* Đỏ đậm */
}

.green-bg {
  background-color: #e6f3e6; /* Xanh lá nhạt */
}

.green-text {
  color: #006400; /* Xanh lá đậm */
}

.gray-bg {
  background-color: #f5f5f5; /* Xám nhạt */
}

.section-total {
  font-size: 16px;
  font-weight: bold;
}

.formula-note {
  font-size: 0.9em;
  font-style: italic;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
}

.card-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 0.95em;
  gap: 5px;
  flex-direction: row;
}

.label {
  font-weight: bold;
}

.value {
  text-align: right;
}

.highlight {
  font-weight: bold;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.payment-image-container {
  margin-top: 20px;
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .card-field .label,
  .card-field .value {
    text-align: left;
    flex: none;
  }

  .card-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .salary-card {
    padding: 5px;
    width: 95%;
  }

  .salary-card-title {
    font-size: 1.1em;
  }
}

/* Đảm bảo Font Awesome được tải */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

h2 {
  font-size: 20px !important;
  text-align: center !important;
  font-weight: bold !important;
}

.salary-section h4 {
  font-size: 12px;
}

/* Container cho các nút - Modern Layout */
.card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

/* CSS chung cho tất cả nút - Modern Design */
.card-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.card-actions button::before {
  margin-right: 6px;
  font-size: 16px;
}

.card-actions button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.card-actions button:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

/* Ripple effect */
.card-actions button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.card-actions button:active:not(:disabled)::after {
  width: 300px;
  height: 300px;
}

/* CSS cho nút checkin-history-btn - Modern */
.checkin-history-btn {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: white;
}

.checkin-history-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
}

.checkin-history-btn::before {
  content: '\f1da'; /* Icon history */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* CSS cho modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  background: white;
  top: 50px;
  margin: 10px auto;
  max-height: 700px;
  overflow-y: auto;
  max-width: 90%;
  width: 600px;
  border-radius: 12px;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal.show .modal-content {
  transform: scale(1);
}

/* Modern Modal Header */
.modal-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px;
}

/* Nội dung trong modal */
.checkin-history-cards {
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px;
}

.checkin-history-cards .salary-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 15px;
  padding: 10px;
  width: 100%;
}

.salary-card-title {
  font-size: 18px;
  margin-bottom: 10px;
  color: #2f62c3;
}

.salary-section {
  margin-bottom: 15px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
}

.gray-bg {
  background-color: #f8f9fa;
}

.section-title {
  font-size: 18px;
  font-weight: bold;
  margin: 0;
}

.section-total.highlight {
  font-weight: bold;
  color: #2f6de3;
  font-size: 20px;
}

.section-service.highlight {
  font-weight: bold;
  color: #e32f2f;
}

.card-field {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.card-field .label {
  font-weight: 500;
  color: #555;
  font-size: 14px;
}

.card-field .value {
  color: #333;
}

/* Nút đóng modal - Modern Design */
.close-modal-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  margin-left: auto;
}

.close-modal-btn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px) rotate(90deg);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.close-modal-btn:active {
  transform: translateY(0) rotate(90deg);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* Loading spinner */
.checkin-history-cards.loading::before {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  margin: 20px auto;
  border: 4px solid #2f6de3;
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Nút Đồng ý - Modern */
.confirm-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.confirm-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.confirm-btn::before {
  content: '\f00c'; /* Icon check từ Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Xin xét lại - Modern */
.review-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.review-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.review-btn::before {
  content: '\f06a'; /* Icon exclamation-circle */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Làm mới - Modern */
.refresh-salary-btn {
  background: linear-gradient(135deg, #f63b3b 0%, #2563eb 100%);
  color: white;
}

.refresh-salary-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #f63b3b 0%, #1d4ed8 100%);
}

.refresh-salary-btn::before {
  content: '\f021'; /* Icon sync */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Đã nhận đủ - Modern */
.payment-confirmed-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.payment-confirmed-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.payment-confirmed-btn::before {
  content: '\f058'; /* Icon check-circle từ Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Đã thanh toán (disabled) - Modern */
.paid-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  cursor: not-allowed;
  opacity: 0.7;
}

.paid-btn::before {
  content: '\f00c'; /* Icon check từ Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Chờ xác nhận (disabled) - Modern */
.waiting-confirmation-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  cursor: not-allowed;
  opacity: 0.7;
}

.waiting-confirmation-btn::before {
  content: '\f017'; /* Icon clock từ Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Thanh toán xong (disabled) - Modern */
.payment-completed-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  cursor: not-allowed;
  opacity: 0.7;
}

.payment-completed-btn::before {
  content: '\f058'; /* Icon check-circle từ Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Nút Thanh toán lương - Modern */
.upload-payment-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.upload-payment-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.upload-payment-btn::before {
  content: '\f093'; /* Icon upload từ Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Input file ẩn */
.upload-payment-input {
  display: none;
}

/* Responsive cho thiết bị nhỏ - Optimized */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
  }

  .card-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .card-actions button {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
  }

  .close-modal-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .salary-card-title {
    font-size: 16px;
  }

  .card-actions button {
    padding: 12px 14px;
    font-size: 14px;
  }
}

/* Hiệu ứng disabled chung - Enhanced */
.card-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  filter: grayscale(20%);
  transform: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

/* Container cho hình ảnh thanh toán */
.payment-image-container {
  margin-top: 15px;
  text-align: center;
}

.payment-image-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #ddd;
}

/* CSS cho hiệu ứng loading */
.refresh-salary-btn.loading {
  position: relative;
  color: white;
  pointer-events: none;
}

/* Tạo spinner loading */
.refresh-salary-btn.loading::after {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  border: 4px solid #2f6de3;
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Bảng lương nhân viên */
.salary-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: 'Arial', sans-serif;
}

.salary-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: #f0f0f0;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.tab-btn.active {
  background: #007bff;
  color: white;
}

.salary-table-container {
  max-height: 600px;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.salary-table {
  width: 100%;
  border-collapse: collapse;
}

.salary-table th,
.salary-table td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid #ddd;
}

.salary-table th {
  background: #ffffffe6;
  position: sticky;
  top: 0;
  z-index: 10;
  font-weight: bold;
  min-width: 80px;
}

.salary-table .fixed-column {
  position: sticky;
  left: 0;
  background: #ffffffe6;
  color: black;
  z-index: 5;
  text-align: left;
  min-width: 70px;
}

.salary-table .total-row {
  background: #e9ecef;
  font-weight: bold;
}

.salary-table tr:hover {
  background: #f1f3f5;
  cursor: pointer;
}

.salary-table td.no-data {
  text-align: center;
  padding: 20px;
  color: #666;
}

@media (max-width: 768px) {
  .salary-table-container {
    max-height: 400px;
  }

  .salary-table th,
  .salary-table td {
    padding: 5px;
    font-size: x-small;
  }
}

.evaluate-kpi-btn {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 4px;
}
.evaluate-kpi-btn.loading {
  background-color: #6c757d;
  cursor: not-allowed;
}
.evaluate-kpi-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  font-size: x-small;
  font-weight: bold;
  border-radius: 4px;
  min-width: 90px;
  text-align: center;
}

.status-pending {
  background-color: #e9ecef; /* Xám nhạt */
  color: #6c757d; /* Xám đậm */
}

.status-confirmed {
  background-color: #d1ecf1; /* Xanh dương nhạt */
  color: #0c5460; /* Xanh dương đậm */
}

.status-payment-pending {
  background-color: #fff3cd; /* Vàng nhạt */
  color: #856404; /* Vàng đậm */
}

.status-received {
  background-color: #d4edda; /* Xanh lá nhạt */
  color: #155724; /* Xanh lá đậm */
}

/* ============================================
   MODERN SALARY MODAL - FINAL TOUCHES
   ============================================ */

/* Modal Header Sticky - Glassmorphism Effect */
.modal-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  z-index: 10;
  padding: 10px;
  margin-bottom: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced glassmorphism when scrolled */
.modal-content.scrolled .modal-header {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

/* Smooth scroll for modal content */
.modal-content {
  scroll-behavior: smooth;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* Card Actions - Special layouts for different button counts */
.card-actions:has(button:nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
}

.card-actions:has(button:nth-child(3):last-child) {
  grid-template-columns: repeat(3, 1fr);
}

.card-actions:has(button:nth-child(4):last-child) {
  grid-template-columns: repeat(2, 1fr);
}

/* Button loading state */
.card-actions button.loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}

.card-actions button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid white;
  border-radius: 50%;
  border-top-color: transparent;
  animation: button-spin 0.6s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Tablet optimization */
@media (max-width: 1024px) and (min-width: 769px) {
  .card-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Print styles */
@media print {
  .close-modal-btn,
  .card-actions {
    display: none !important;
  }

  .modal-content {
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
}
