/* ==========================================================================
   Rougier et Fils / Le Coeur des Champs - Luxury DataTables Theme
   Ultra-Modern, Executive Card-Style Table System & Smooth Interactions
   ========================================================================== */

/* Remove default Bootstrap harsh table borders */
table.dataTable,
table.dataTable.table-bordered,
.table-responsive table.table-bordered,
table.table-bordered {
  border: none !important;
  border-collapse: separate !important;
  border-spacing: 0 8px !important;
  margin: 1.25rem 0 !important;
  width: 100% !important;
  background: transparent !important;
}

/* Override inline border overrides */
table.dataTable th,
table.dataTable td,
.table-bordered th,
.table-bordered td {
  border-color: transparent !important;
  border-radius: 0 !important;
}

/* DataTables Main Card Wrapper */
.dataTables_wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.07), 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 1.75rem 2rem;
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #334155;
  position: relative;
  overflow: hidden;
}

.dataTables_wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981 0%, #3b82f6 100%);
}

/* Header Controls Bar (Length & Filter) */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 1.5rem;
  color: #64748b;
  font-weight: 700;
  font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_length {
  float: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dataTables_wrapper .dataTables_filter {
  float: right;
  text-align: right;
}

/* Length Select Input */
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.45rem 1rem 0.45rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  background-color: #f8fafc;
  outline: none;
  margin: 0 0.35rem;
  transition: all 0.25s ease;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.dataTables_wrapper .dataTables_length select:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  background-color: #ffffff;
}

/* Search Filter Input */
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: #475569;
  font-size: 0.9rem;
  margin: 0;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid #cbd5e1;
  border-radius: 30px;
  padding: 0.55rem 1.25rem 0.55rem 2.4rem;
  font-size: 0.925rem;
  font-weight: 600;
  color: #1e293b;
  background-color: #f8fafc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem center;
  background-size: 1rem;
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 250px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

.dataTables_wrapper .dataTables_filter input::placeholder {
  color: #94a3b8;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #10b981;
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18), 0 4px 12px rgba(16, 185, 129, 0.08);
}

/* Table Header (Luxury Dark Slate Header) */
table.dataTable thead,
table.dataTable thead tr,
.table thead {
  background: transparent !important;
}

table.dataTable thead th,
table.dataTable thead td,
.table thead th {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 0.825rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.75px !important;
  padding: 1.1rem 1.25rem !important;
  border: none !important;
  box-shadow: none !important;
}

/* Rounded Header Corners */
table.dataTable thead tr th:first-child,
.table thead tr th:first-child {
  border-top-left-radius: 12px !important;
  border-bottom-left-radius: 12px !important;
}

table.dataTable thead tr th:last-child,
.table thead tr th:last-child {
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
}

/* Sorting Icons in Header */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

table.dataTable thead .sorting:hover,
table.dataTable thead .sorting_asc:hover,
table.dataTable thead .sorting_desc:hover {
  color: #34d399 !important;
}

/* Floating Card Rows for Table Body */
table.dataTable tbody tr,
.table tbody tr {
  background-color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

table.dataTable tbody tr:nth-of-type(even),
.table-striped tbody tr:nth-of-type(even) {
  background-color: #fcfdfe !important;
}

/* Hover Effect on Table Rows */
table.dataTable tbody tr:hover,
.table tbody tr:hover {
  background-color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.12) !important;
}

/* Table Cells */
table.dataTable tbody td,
table.dataTable tbody th,
.table tbody td {
  padding: 1.05rem 1.25rem !important;
  vertical-align: middle !important;
  font-size: 0.935rem;
  font-weight: 500;
  color: #334155;
  border-top: 1px solid #f1f5f9 !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-left: none !important;
  border-right: none !important;
}

/* Rounded Card Cell Outer Edges */
table.dataTable tbody tr td:first-child,
.table tbody tr td:first-child {
  border-top-left-radius: 12px !important;
  border-bottom-left-radius: 12px !important;
  border-left: 1px solid #f1f5f9 !important;
}

table.dataTable tbody tr td:last-child,
.table tbody tr td:last-child {
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
  border-right: 1px solid #f1f5f9 !important;
}

/* Selected Row Style */
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected td {
  background-color: rgba(16, 185, 129, 0.08) !important;
  color: #065f46 !important;
  font-weight: 700;
  border-color: rgba(16, 185, 129, 0.2) !important;
}

/* Action Buttons inside Tables */
.btn-ellipsis-edit,
.btn-ellipsis-delete,
table td .btn-sm,
table td .btn-edit,
table td .btn-delete,
table td .btn-view {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  margin: 0 2px;
  outline: none;
}

/* Edit / Primary Action Button */
.btn-ellipsis-edit,
table td .btn-primary,
table td .btn-edit {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #2563eb !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}

.btn-ellipsis-edit:hover,
table td .btn-primary:hover,
table td .btn-edit:hover {
  background: #2563eb !important;
  color: #ffffff !important;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

/* Delete / Danger Action Button */
.btn-ellipsis-delete,
table td .btn-danger,
table td .btn-delete {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
}

.btn-ellipsis-delete:hover,
table td .btn-danger:hover,
table td .btn-delete:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35) !important;
}

/* PDF / Success / Check Action Button */
table td .btn-success,
table td .far.fa-file-pdf,
table td .fa-check-square {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.2);
}

table td .btn-success:hover {
  background: #059669 !important;
  color: #ffffff !important;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35) !important;
}

/* Badges inside Table Cells */
table td .badge {
  padding: 0.45rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

table td .badge-success {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #047857 !important;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

table td .badge-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #b45309 !important;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

table td .badge-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

table td .badge-info {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* DataTables Footer Info & Pagination Bar */
.dataTables_wrapper .dataTables_info {
  float: left;
  padding-top: 1rem;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 700;
}

.dataTables_wrapper .dataTables_paginate {
  float: right;
  padding-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Pagination Pill Buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 10px !important;
  border: 1.5px solid #e2e8f0 !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  padding: 0.45rem 0.9rem !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  margin: 0 2px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
  text-decoration: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  background: #f8fafc !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Export Buttons (.dt-buttons) */
.dt-buttons,
div.dt-buttons {
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dt-button,
.dt-buttons .btn {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 30px !important;
  padding: 0.5rem 1.25rem !important;
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  color: #334155 !important;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer !important;
}

.dt-button:hover,
.dt-buttons .btn:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35) !important;
  transform: translateY(-2px);
}

/* Responsive Fixes */
@media (max-width: 768px) {
  .dataTables_wrapper {
    padding: 1.25rem 1rem;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: left;
    margin-bottom: 1rem;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    min-width: unset;
  }

  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none;
    justify-content: center;
    text-align: center;
    margin-top: 1rem;
  }
}
