/* ============================================================
   components.css — Buttons, Cards, Modals, Tables, Forms (Light Mode)
   ============================================================ */

/* ===================
   BUTTONS
   =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.55rem var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
  background: #F1F5F9;
  color: var(--text-primary);
  border-color: #E2E8F0;
}
.btn-secondary:hover {
  background: #E2E8F0;
  border-color: #CBD5E1;
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-outline {
  background: #FFFFFF;
  color: var(--primary);
  border-color: var(--border);
}
.btn-outline:hover {
  background: #ECFDF5;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12);
}

.btn-outline-secondary {
  background: #FFFFFF;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline-secondary:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-success {
  background: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: #F1F5F9;
  color: var(--text-primary);
}

/* Sizes */
.btn-sm {
  padding: 0.35rem var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 0.75rem var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* Icon button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon.btn-sm { width: 28px; height: 28px; font-size: 0.85rem; }
.btn-icon.btn-lg { width: 44px; height: 44px; font-size: 1.25rem; }

/* ===================
   CARDS (LIGHT MODE)
   =================== */
.card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
  overflow: hidden;
}
.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: #CBD5E1;
}
.card-body {
  padding: var(--space-5) var(--space-6);
}
.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: #FFFFFF;
}
.card-header h3, .card-header h4 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: #F8FAFC;
}

/* Stat Card */
.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.08);
  border-color: #CBD5E1;
}
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }
.stat-card.gold::before    { background: var(--gold-primary); }

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: var(--space-3);
  background: #ECFDF5;
  color: var(--primary);
}
.stat-card.success .stat-card__icon { background: #DCFCE7; color: #16A34A; }
.stat-card.warning .stat-card__icon { background: #FEF3C7; color: #D97706; }
.stat-card.danger  .stat-card__icon { background: #FEE2E2; color: #DC2626; }
.stat-card.gold    .stat-card__icon { background: #FEF9C3; color: #CA8A04; }

.stat-card__label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card__value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-2);
}
.stat-card__trend {
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-card__trend.up   { color: #16A34A; }
.stat-card__trend.down { color: #DC2626; }

/* ===================
/* ===================
   TABLES (LIGHT MODE & RESPONSIVE)
   =================== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  background: #FFFFFF;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 #F1F5F9;
  position: relative;
}
.table-container::-webkit-scrollbar {
  height: 6px;
}
.table-container::-webkit-scrollbar-track {
  background: #F1F5F9;
}
.table-container::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.table th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}
.table tbody tr {
  transition: background 0.15s ease;
}
.table tbody tr:hover {
  background: #F8FAFC;
}
.table tbody tr:last-child td {
  border-bottom: none;
}

/* Sticky First Column Utility for Wide Data Tables */
.table-sticky-first th:first-child,
.table-sticky-first td:first-child {
  position: sticky;
  left: 0;
  background: #FFFFFF;
  z-index: 11;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.04);
}
.table-sticky-first th:first-child {
  background: #F8FAFC;
  z-index: 12;
}

/* ===================
   BADGES (LIGHT PASTEL)
   =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.badge-green, .badge-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.badge-amber, .badge-warning { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.badge-red,   .badge-danger  { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }
.badge-blue,  .badge-info    { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.badge-gold   { background: #FEF9C3; color: #A16207; border: 1px solid #FEF08A; }
.badge-secondary { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }

/* ===================
   FORMS & INPUTS
   =================== */
.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  font-family: inherit;
  transition: var(--transition-fast);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }

/* ===================
   ALERTS / FLASH
   =================== */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.alert-info    { background: #E0F2FE; color: #075985; border: 1px solid #7DD3FC; }

/* ===================
   DROPDOWNS & NOTIFICATIONS
   =================== */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.04);
  padding: 6px 0;
  z-index: var(--z-dropdown);
  display: none;
  overflow: hidden;
}
.dropdown.open .dropdown-menu {
  display: block;
  animation: dropdownSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
}
.dropdown-item:hover {
  background: #F8FAFC;
  color: var(--primary);
}
.dropdown-item.danger {
  color: #DC2626;
}
.dropdown-item.danger:hover {
  background: #FEE2E2;
  color: #DC2626;
}
.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

/* Notification Dropdown Custom */
.notif-dropdown {
  width: 360px !important;
  max-width: 92vw;
  padding: 0 !important;
}
.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}
.notif-header h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.notif-list {
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  transition: all 0.15s ease;
}
.notif-item:hover {
  background: #F8FAFC;
}
.notif-item.unread {
  background: #F0FDF4;
}
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.notif-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.35;
  margin-bottom: 2px;
}
.notif-desc {
  font-size: 0.72rem;
  color: #64748B;
  line-height: 1.35;
  margin-bottom: 4px;
}
.notif-time {
  font-size: 0.65rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #059669;
  flex-shrink: 0;
  margin-top: 6px;
}
.notif-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  background: #F8FAFC;
}
.notif-footer a {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.notif-footer a:hover {
  color: var(--primary-hover);
}

/* Badge pulse on topbar bell */
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.topbar__badge {
  animation: badgePulse 2s infinite;
}

/* ============================================================
   MODALS & DIALOGS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal-backdrop.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.modal {
  background: #FFFFFF;
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border, #E2E8F0);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 100000;
}
.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1040px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0F172A;
}
.modal-body {
  padding: 20px;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

/* ============================================================
   RESPONSIVE TABLE TO CARD SYSTEM (MOBILE VIEW <= 768px)
   ============================================================ */
@media (max-width: 768px) {
  .table-container {
    overflow-x: visible !important;
    background: transparent !important;
  }
  
  .table {
    display: block !important;
    width: 100% !important;
  }
  
  .table thead {
    display: none !important;
  }
  
  .table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }
  
  .table tbody tr {
    display: flex !important;
    flex-direction: column !important;
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 14px !important;
    padding: 14px 16px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    gap: 6px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  }
  
  .table tbody tr:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07) !important;
    border-color: #CBD5E1 !important;
  }
  
  .table tbody tr td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 6px 0 !important;
    border-bottom: 1px dashed #F1F5F9 !important;
    font-size: 0.8rem !important;
    text-align: left !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  
  .table tbody tr td:first-child {
    display: none !important;
  }
  
  .table tbody tr td:last-child {
    border-bottom: none !important;
    padding-top: 10px !important;
    margin-top: 4px !important;
    border-top: 1px solid #F1F5F9 !important;
    justify-content: flex-end !important;
  }
  
  .table-actions {
    width: 100% !important;
    justify-content: flex-end !important;
    display: flex !important;
    gap: 8px !important;
  }
  
  .table-actions .btn {
    flex: 1 !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 8px 12px !important;
  }
}

/* ============================================================
   ULTRA-PROFESSIONAL & MODERN PAGINATION COMPONENT
   ============================================================ */
.dt-pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
}

.dt-pagination-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.82rem;
  color: #64748B;
  font-weight: 500;
}

.dt-entries-summary {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dt-entries-summary .dt-highlight {
  font-weight: 700;
  color: #0F172A;
  background: #F1F5F9;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.dt-page-size-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #64748B;
}

.dt-page-size-select {
  padding: 4px 28px 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0F172A;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.dt-page-size-select:hover {
  border-color: #059669;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.08);
}

.dt-page-size-select:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Pagination container */
.pagination {
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  padding: 0;
  margin: 0;
  user-select: none;
}

.page-item {
  display: inline-flex;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  font-family: inherit;
  outline: none;
}

.page-link i {
  font-size: 1.15rem;
  line-height: 1;
}

.page-link .nav-text {
  font-size: 0.8rem;
  font-weight: 600;
}

.page-link-prev,
.page-link-next {
  gap: 4px;
  padding: 0 12px;
}

.page-link:hover:not(:disabled) {
  background: #F8FAFC;
  border-color: #059669;
  color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.12);
}

.page-link:active:not(:disabled) {
  transform: translateY(0);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  border-color: #059669;
  color: #FFFFFF !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  cursor: default;
  transform: none;
}

.page-item.disabled .page-link,
.page-link:disabled {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #CBD5E1 !important;
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
  transform: none !important;
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 36px;
  color: #94A3B8;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
}

@media (max-width: 640px) {
  .dt-pagination-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .dt-pagination-info {
    justify-content: space-between;
    width: 100%;
  }

  .pagination {
    justify-content: center;
    width: 100%;
    gap: 4px;
  }

  .page-link {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .page-link-prev .nav-text,
  .page-link-next .nav-text {
    display: none;
  }
}


