/* Custom styles cho ứng dụng Quản Lý Cá Nhân */

:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #0dcaf0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
}

/* Navigation */
.navbar-brand {
  font-weight: bold;
}

/* Cards */
.card {
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: box-shadow 0.15s ease-in-out;
}

/* Vô hiệu hóa hover effects cho card trong calendar */
.bang_lich .card:hover,
.bang_lich .card-body:hover {
  box-shadow: none !important;
  transform: none !important;
  background-color: inherit !important;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Buttons - chỉ giữ hover cho buttons có thể click */
.btn:not(:disabled):not(.disabled):hover:not(.btn-close) {
  filter: brightness(1.1);
}

/* Tables */
.table {
  border-radius: 0.5rem;
  overflow: hidden;
}

.table thead th {
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
}

/* Forms */
.form-control {
  border-radius: 0.375rem;
  border: 1px solid #ced4da;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Stats cards */
.stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 1rem;
}

/* Vô hiệu hóa hover effects cho stats-card trong calendar */
.bang_lich .stats-card:hover {
  transform: none !important;
  box-shadow: none !important;
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.stats-card .card-body {
  padding: 2rem;
}

.stats-number {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.stats-label {
  font-size: 1rem;
  opacity: 0.9;
}

/* Chart containers */
.chart-container {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Filter sections */
.filter-section {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Work stats table */
.work-stats-table {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden;
}

.work-stats-table .table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  font-weight: 600;
  padding: 1rem;
}

.work-stats-table .table tbody td {
  padding: 1rem;
  border-color: #f8f9fa;
}

/* Data table */
.data-table {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden;
}

.data-table .table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  font-weight: 600;
  padding: 1rem 0.75rem;
  font-size: 0.9rem;
}

.data-table .table tbody td {
  padding: 0.75rem;
  border-color: #f8f9fa;
  vertical-align: middle;
}

/* Month selector */
.month-selector {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Export section */
.export-section {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Stats summary */
.stats-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Buttons */
.btn-month {
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
}

.btn-export {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  border: none;
  color: white;
  border-radius: 10px;
  padding: 0.75rem 2rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-export:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(17, 153, 142, 0.3);
  color: white;
}

.btn-filter {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  border-radius: 10px;
  padding: 0.75rem 2rem;
  font-weight: 600;
}

.btn-export-detail {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  border: none;
  color: white;
  border-radius: 10px;
  padding: 0.75rem 2rem;
  font-weight: 600;
}

/* Special elements */
.work-badge {
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.salary-highlight {
  background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
  color: #2d3436;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font-weight: bold;
}

.time-range {
  background: #f8f9fa;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9rem;
}

.break-time {
  color: #e17055;
  font-weight: 500;
}

/* PWA Install Banner */
#pwa-install-banner {
  z-index: 1050;
}

/* Loading spinner */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .btn {
    font-size: 0.875rem;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
}

/* Mobile responsive for financial report buttons */
@media (max-width: 767px) {
  .btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .btn-group .btn {
    flex: 1;
    min-width: calc(33.333% - 0.25rem);
    font-size: 0.75rem;
    padding: 0.375rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 0.375rem !important;
  }
  
  .btn-group .btn i {
    font-size: 0.7rem;
    margin-right: 0.1rem;
  }
  
  .btn-group .btn span {
    display: none;
  }
}

@media (max-width: 480px) {
  .btn-group .btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.125rem;
    min-width: calc(33.333% - 0.125rem);
  }
  
  .btn-group .btn i {
    font-size: 0.65rem;
    margin-right: 0.05rem;
  }
}

/* Mobile responsive for financial report buttons */
@media (max-width: 767px) {
  .btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .btn-group .btn {
    flex: 1;
    min-width: calc(33.333% - 0.25rem);
    font-size: 0.75rem;
    padding: 0.375rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 0.375rem !important;
  }
  
  .btn-group .btn i {
    font-size: 0.7rem;
    margin-right: 0.1rem;
  }
  
  .btn-group .btn span {
    display: none;
  }
}

@media (max-width: 480px) {
  .btn-group .btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.125rem;
    min-width: calc(33.333% - 0.125rem);
  }
  
  .btn-group .btn i {
    font-size: 0.65rem;
    margin-right: 0.05rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #212529;
    color: #fff;
  }
  
  .card {
    background-color: #343a40;
    color: #fff;
  }
  
  .table {
    --bs-table-bg: #343a40;
    --bs-table-color: #fff;
  }
}

/* Animation cho page transitions */
.page-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s, transform 0.3s;
}

/* Custom badge styles */
.badge {
  font-size: 0.75rem;
  padding: 0.35em 0.65em;
}

/* Custom alert styles */
.alert {
  border: none;
  border-radius: 0.5rem;
}

/* Progress bars */
.progress {
  height: 0.5rem;
  border-radius: 0.25rem;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Enhanced animations and interactions */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Chỉ hover cho các button có action thực tế */
.btn[onclick]:hover,
.btn[type="submit"]:hover,
.btn[data-bs-toggle]:hover,
.btn[href]:hover {
  opacity: 0.85;
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Chỉ hover cho tables có thể thao tác, không phải calendar */
.table:not(.bang_lich):not(.table-borderless) tbody tr:hover {
  background-color: var(--bs-table-hover-bg, rgba(0, 0, 0, 0.075));
}

/* Đảm bảo calendar không có hover effect từ Bootstrap */
.bang_lich tbody tr:hover,
.table.bang_lich tbody tr:hover,
.table.bang_lich tbody tr:hover td,
.bang_lich tbody tr:hover td,
#workCalendarBody tr:hover,
#workCalendarBody tr:hover td {
  background-color: inherit !important;
  background: inherit !important;
  transform: none !important;
  transition: none !important;
}

/* Calendar styles - tuân thủ naming convention tiếng Việt không dấu */
.bang_lich {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
}

.bang_lich td {
  width: 14.28%;
  height: 120px;
  position: relative;
  border: 1px solid #dee2e6;
  vertical-align: top;
  padding: 8px;
  background-color: white;
}

/* Chỉ cursor pointer cho các ô có thể thao tác */
.bang_lich td:not(.ngay_trong) {
  cursor: pointer;
}

.so_ngay {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  display: inline-block;
  min-width: 32px;
  text-align: center;
  margin-bottom: 4px;
}

.so_ngay.hom_nay {
  background-color: #dc3545;
  color: #ffffff !important;
  box-shadow: 0 3px 6px rgba(220, 53, 69, 0.4);
  font-weight: bold;
}

.so_ngay.hom_nay:hover {
  color: #000 !important;
}

.ngay_trong {
  background-color: #f8f9fa !important;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Giữ nguyên style mặc định cho calendar cells - không hover */

.su_kien_item {
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  max-height: 22px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
}

.su_kien_item:hover {
  opacity: 0.85;
  transform: translateX(2px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.nut_them_su_kien {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 4px 8px;
  font-size: 10px;
  background: var(--primary-color);
  border: none;
  color: white;
  border-radius: 12px;
  opacity: 0.85;
  transition: all 0.2s ease;
  z-index: 10;
}

/* Chỉ hover cho button thêm sự kiện khi có thể click */
.nut_them_su_kien:hover {
  opacity: 1;
  background: #dc3545 !important;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

.container_su_kien {
  max-height: 85px;
  overflow: hidden;
  margin-top: 4px;
}

/* Weekend styling - cuối tuần */
.bang_lich th:first-child,
.bang_lich th:last-child {
  background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
  color: #c62828;
  font-weight: 600;
}

.bang_lich td:first-child:not(.ngay_trong),
.bang_lich td:last-child:not(.ngay_trong) {
  background-color: #fafafa;
}

.bang_lich td:first-child .so_ngay,
.bang_lich td:last-child .so_ngay {
  color: #dc3545;
  font-weight: 600;
}

/* Work calendar styles - lịch làm việc */
.bang_lich_lam_viec {
  font-size: 14px;
  border-collapse: separate;
  border-spacing: 1px;
  width: 100%;
}

.bang_lich_lam_viec td {
  width: 14.28%;
  height: 45px;
  vertical-align: middle;
  text-align: center;
  position: relative;
  border: 1px solid #dee2e6;
  background-color: white;
}

/* Chỉ hover cho các ngày có thể select */
.bang_lich_lam_viec td:hover:not(.ngay_da_qua):not(.thang_khac) {
  background-color: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.1));
  cursor: pointer;
}

.ngay_lam_viec {
  background-color: #d4edda !important;
  color: #155724 !important;
  font-weight: bold;
  border: 2px solid #28a745 !important;
}

.ngay_lam_viec:hover {
  background-color: #c3e6cb !important;
}

.ngay_da_qua {
  background-color: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
}

.ngay_da_qua:hover {
  background-color: #f8f9fa;
}

.ngay_hien_tai {
  background-color: #fff3cd;
  border: 2px solid #ffc107;
  font-weight: bold;
}

.cuoi_tuan {
  color: #dc3545;
}

.thang_khac {
  color: #adb5bd;
  background-color: #f8f9fa;
}

.badge_ngay_chon {
  display: inline-block;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  margin: 2px;
  box-shadow: 0 2px 4px rgba(17, 153, 142, 0.3);
  transition: all 0.2s ease;
}

.badge_ngay_chon:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(17, 153, 142, 0.4);
}

.dieu_khien_lich_lam_viec {
  background: white;
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #f1f3f4;
}

/* Chỉ sử dụng focus states mặc định của Bootstrap */

/* Tooltip enhancements */
.tooltip {
  font-size: 0.875rem;
}

.tooltip-inner {
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* Modal enhancements */
.modal-content {
  border: none;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 15px 15px 0 0;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0 0 15px 15px;
}

/* Alert enhancements */
.alert {
  border-left: 4px solid;
  animation: slideUp 0.3s ease-out;
}

.alert-success {
  border-left-color: var(--success-color);
}

.alert-danger {
  border-left-color: var(--danger-color);
}

.alert-warning {
  border-left-color: var(--warning-color);
}

.alert-info {
  border-left-color: var(--info-color);
}

/* Responsive enhancements */
@media (max-width: 576px) {
  .stats-card .card-body {
    padding: 1.5rem;
  }
  
  .stats-number {
    font-size: 2rem;
  }
  
  .chart-container,
  .filter-section,
  .export-section {
    padding: 1rem;
  }
  
  .btn-export,
  .btn-filter,
  .btn-export-detail {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

/* Print styles */
@media print {
  .btn,
  .navbar,
  .sidebar {
    display: none !important;
  }
  
  .stats-card,
  .chart-container,
  .filter-section {
    box-shadow: none !important;
    border: 1px solid #dee2e6 !important;
  }
}

/* Focus accessibility */
button:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
}

.skip-link:focus {
  top: 6px;
}

/* Sửa màu sắc Google Calendar events không nhìn thấy */
.su_kien_item.bg-white,
.su_kien_item.bg-light {
  background-color: #e9ecef !important;
  border: 1px solid #dee2e6 !important;
  color: #495057 !important;
}

/* Override các màu sáng trong các element khác */
.bg-white.rounded-circle,
.bg-light.rounded-circle {
  background-color: #e9ecef !important;
  border: 1px solid #dee2e6 !important;
}

/* Đảm bảo text contrast tốt cho tất cả màu events */
.su_kien_item.bg-warning,
.su_kien_item.bg-light {
  color: #212529 !important; /* Chữ tối cho nền sáng */
}

.su_kien_item.bg-info,
.su_kien_item.bg-success,
.su_kien_item.bg-primary,
.su_kien_item.bg-danger,
.su_kien_item.bg-dark,
.su_kien_item.bg-secondary {
  color: #fff !important; /* Chữ trắng cho nền tối */
}

/* Đảm bảo các color indicators cũng có contrast tốt */
.bg-warning.rounded-circle,
.bg-light.rounded-circle {
  color: #212529 !important;
}

.bg-info.rounded-circle,
.bg-success.rounded-circle,
.bg-primary.rounded-circle,
.bg-danger.rounded-circle,
.bg-dark.rounded-circle,
.bg-secondary.rounded-circle {
  border: 1px solid rgba(255,255,255,0.2);
}

/* Logo Styles */
.navbar-brand img {
  transition: transform 0.3s ease;
}

.navbar-brand:hover img {
  transform: scale(1.05);
}

.logo-section img {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
  transition: transform 0.3s ease;
}

.logo-section:hover img {
  transform: scale(1.05);
}

/* Responsive logo sizing */
@media (max-width: 768px) {
  .navbar-brand img {
    height: 28px;
  }
  
  .logo-section img {
    height: 60px;
  }
}


/* Desktop layout width: make content 90% of screen on desktop */
@media (min-width: 992px) {
  .container {
    max-width: 90vw !important;
  }
}
