/* ========================================
   MR Repuestos - Customers Module Styles
   Identidad Visual Corporativa
   ======================================== */

/* CSS Variables */
:root {
  --crushed-berry: #880d1eff;
  --raspberry: #dd2d4aff;
  --bubblegum-pink: #f26a8dff;
  --pink-mist: #f49cbbff;
  --light-cyan: #cbeef3ff;
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --border-color: #dee2e6;
  --medium-gray: #6c757d;
  --dark-gray: #212529;
}

/* Customers Container */
.customers-container {
  animation: fadeInUp 0.6s ease-out;
}

/* Customers Header */
.customers-header {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(136, 13, 30, 0.2);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--white);
}

.header-title i {
  font-size: 2rem;
}

.header-title h3 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'Ubuntu', sans-serif;
}

/* Add Customer Button */
.btn-add-customer {
  background: linear-gradient(135deg, var(--white), var(--light-gray));
  color: var(--raspberry);
  border: 2px solid var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Ubuntu', sans-serif;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.btn-add-customer:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
  background: var(--white);
}

.btn-add-customer i {
  font-size: 1.1rem;
}

/* Customers Table Container */
.customers-table-container {
  background: var(--white);
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Corporate Table */
.table-corporate {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

/* DataTable Header Styles - High Specificity */
#customersTable thead,
.table-corporate thead {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  border-bottom: none !important;
  position: relative;
}

#customersTable thead tr,
.table-corporate thead tr {
  background: transparent !important;
}

#customersTable thead th,
.table-corporate thead th {
  padding: 1rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  background: transparent !important;
  border: none !important;
  text-align: left;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Ubuntu', sans-serif;
}

/* DataTable sorting icons color */
#customersTable thead th.sorting::before,
#customersTable thead th.sorting::after,
#customersTable thead th.sorting_asc::before,
#customersTable thead th.sorting_asc::after,
#customersTable thead th.sorting_desc::before,
#customersTable thead th.sorting_desc::after {
  color: rgba(255, 255, 255, 0.7) !important;
  opacity: 0.7;
}

.table-corporate tbody tr {
  transition: all 0.3s ease;
  border-bottom: 1px solid var(--border-color);
}

.table-corporate tbody tr:hover {
  background: linear-gradient(90deg, rgba(136, 13, 30, 0.03), rgba(221, 45, 74, 0.03));
  transform: scale(1.01);
}

.table-corporate tbody td {
  padding: 1rem;
  vertical-align: middle;
  color: var(--dark-gray);
}

/* Document Type Badge */
.badge-document {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  font-family: 'Ubuntu', sans-serif;
}

.badge-document.doc-rut {
  background: linear-gradient(135deg, rgba(136, 13, 30, 0.1), rgba(221, 45, 74, 0.1));
  color: var(--raspberry);
  border: 1px solid rgba(221, 45, 74, 0.2);
}

.badge-document.doc-dni {
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 86, 179, 0.1));
  color: #007bff;
  border: 1px solid rgba(0, 123, 255, 0.2);
}

.badge-document.doc-passport {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.1), rgba(73, 80, 87, 0.1));
  color: #6c757d;
  border: 1px solid rgba(108, 117, 125, 0.2);
}

/* Customer Name */
.customer-name {
  font-weight: 600;
  color: var(--dark-gray);
  font-size: 0.95rem;
}

/* Status Badge */
.badge-status {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.85rem;
}

.badge-status.status-active {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.2), rgba(32, 201, 151, 0.2));
  color: #155724;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.badge-status.status-inactive {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.2), rgba(73, 80, 87, 0.2));
  color: #383d41;
  border: 1px solid rgba(108, 117, 125, 0.3);
}

/* Table Actions */
.table-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.btn-action-edit,
.btn-action-delete {
  width: 36px;
  height: 36px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  padding: 0;
}

.btn-action-edit {
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 86, 179, 0.1));
  color: #007bff;
  border: 1px solid rgba(0, 123, 255, 0.2);
  border-radius: 8px 0 0 8px;
}

.btn-action-edit:hover {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
  z-index: 1;
}

.btn-action-delete {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(200, 35, 51, 0.1));
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 0 8px 8px 0;
}

.btn-action-delete:hover {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
  z-index: 1;
}

/* Bootstrap button group adjustments */
.btn-group-sm > .btn {
  border-radius: 0;
}

.btn-group-sm > .btn:first-child {
  border-radius: 8px 0 0 8px;
}

.btn-group-sm > .btn:last-child {
  border-radius: 0 8px 8px 0;
}

/* Modal Corporate */
.modal-corporate .modal-header {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff);
  color: var(--white);
  border-radius: 12px 12px 0 0;
  padding: 1.5rem 2rem;
  border: none;
}

.modal-corporate .modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-family: 'Ubuntu', sans-serif;
  font-size: 1.25rem;
}

.modal-corporate .modal-title i {
  font-size: 1.5rem;
}

.modal-corporate .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.modal-corporate .btn-close:hover {
  opacity: 1;
}

.modal-corporate .modal-body {
  padding: 2rem;
  background: var(--light-gray);
}

.modal-corporate .modal-footer {
  background: var(--white);
  border-top: 2px solid var(--border-color);
  padding: 1.25rem 2rem;
}

/* Form Styles */
.form-label {
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: 0.5rem;
  font-family: 'Ubuntu', sans-serif;
  font-size: 0.9rem;
}

.form-label-required::after {
  content: ' *';
  color: var(--raspberry);
}

/* Input Group Corporate */
.input-group-corporate {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group-corporate .input-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(136, 13, 30, 0.05), rgba(221, 45, 74, 0.05));
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 0 1rem;
  color: var(--raspberry);
  min-width: 45px;
  flex-shrink: 0;
}

.input-group-corporate .form-control-corporate {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

/* Form Control Corporate */
.form-control-corporate,
.form-select-corporate {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: 'Ubuntu', sans-serif;
  color: var(--dark-gray);
  background: var(--white);
  min-height: 42px;
  width: 100%;
}

.form-control-corporate:focus,
.form-select-corporate:focus {
  border-color: var(--raspberry);
  box-shadow: 0 0 0 3px rgba(221, 45, 74, 0.1);
  outline: none;
}

.form-control-corporate.is-invalid,
.form-select-corporate.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Custom Select Styling */
select.form-select-corporate {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23880d1e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Invalid Feedback */
.invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #dc3545;
  font-family: 'Ubuntu', sans-serif;
}

/* Buttons Corporate */
.btn-corporate-primary {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-family: 'Ubuntu', sans-serif;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.btn-corporate-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(136, 13, 30, 0.3);
  color: var(--white);
}

.btn-corporate-secondary {
  background: var(--white);
  color: var(--medium-gray);
  border: 2px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-family: 'Ubuntu', sans-serif;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-corporate-secondary:hover {
  background: var(--light-gray);
  border-color: var(--medium-gray);
  color: var(--dark-gray);
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  color: var(--dark-gray);
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin-left: 0.5rem;
  color: var(--dark-gray);
}

.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--raspberry);
  box-shadow: 0 0 0 3px rgba(221, 45, 74, 0.1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px !important;
  margin: 0 2px;
  border: 1px solid var(--border-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  color: var(--white) !important;
  border-color: transparent !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--light-gray) !important;
  color: var(--raspberry) !important;
  border-color: var(--raspberry) !important;
}

/* DataTables Info and Empty State */
.dataTables_wrapper .dataTables_info {
  color: var(--medium-gray);
  font-size: 0.875rem;
  padding-top: 1rem;
}

.dataTables_wrapper .dataTables_empty {
  color: var(--medium-gray);
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

/* Force thead solid color - Override DataTables defaults */
#customersTable_wrapper table.table-corporate thead,
#customersTable_wrapper #customersTable thead,
table.dataTable.table-corporate thead {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  border-bottom: none !important;
}

#customersTable_wrapper table.table-corporate thead th,
#customersTable_wrapper #customersTable thead th,
table.dataTable.table-corporate thead th {
  color: #ffffff !important;
  background-color: transparent !important;
  background-image: none !important;
}

/* Override any Bootstrap or DataTables default thead styles */
table.dataTable thead > tr > th,
table.dataTable thead > tr > td {
  color: #ffffff !important;
  background: transparent !important;
}

/* Responsive */
@media (max-width: 1200px) {
  .customers-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table-corporate {
    min-width: 900px;
  }
}

@media (max-width: 991px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-add-customer {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
  }

  .customers-header {
    padding: 1.25rem 1.5rem;
  }

  .header-title h3 {
    font-size: 1.5rem;
  }

  .header-title i {
    font-size: 1.75rem;
  }
  
  .customers-filters .filters-row {
    flex-direction: column;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-group {
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  .customers-header {
    padding: 1rem;
  }
  
  .header-title h3 {
    font-size: 1.25rem;
  }
  
  .header-title i {
    font-size: 1.5rem;
  }
  
  .customers-table-container {
    padding: 1rem;
  }

  .table-actions {
    flex-direction: column;
    gap: 0.25rem;
  }

  .btn-action-edit,
  .btn-action-delete {
    width: 100%;
    border-radius: 8px !important;
  }

  .modal-corporate .modal-body {
    padding: 1.5rem;
  }
}

@media (max-width: 576px) {
  .customers-header {
    padding: 0.75rem;
  }
  
  .header-title h3 {
    font-size: 1.1rem;
  }
  
  .header-title i {
    font-size: 1.25rem;
  }
  
  .btn-add-customer {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .table-corporate {
    font-size: 0.75rem;
  }
  
  .table-corporate th,
  .table-corporate td {
    padding: 0.5rem 0.25rem;
  }
  
  .customers-filters {
    padding: 0.75rem;
  }
  
  .modal-header h5 {
    font-size: 1rem;
  }
  
  .form-label {
    font-size: 0.875rem;
  }
  
  .form-control,
  .form-select {
    font-size: 0.875rem;
  }
}


/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
