#misFacturasTab {
  padding: 20px 0;
}

.main-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.filters-container {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  min-width: 300px;
  flex-shrink: 0;
}

.consulta-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  text-align: left;
}

.btn-buscar {
  background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 10px;
}

.btn-buscar:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
  color: white;
}

.facturas-container {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  flex: 1;
}

.facturas-header {
  background: #006cb6;
  color: white;
  padding: 15px 20px;
  font-size: 18px;
  font-weight: 600;
}

.facturas-table {
  width: 100% !important;
  margin: 0;
}

.facturas-table thead {
  background: #f8f9fa;
}

.facturas-table thead th {
  padding: 15px 8px;
  font-weight: 600;
  color: #333;
  border: none;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #f8f9fa;
}

.dataTables_wrapper .facturas-table {
  width: 100% !important;
}

.dataTables_wrapper .facturas-table th,
.dataTables_wrapper .facturas-table td {
  box-sizing: border-box !important;
}

.dataTables_wrapper .facturas-table th:nth-child(1),
.dataTables_wrapper .facturas-table td:nth-child(1) { 
  width: 80% !important;
  min-width: 200px !important;
  max-width: 40% !important;
}

.dataTables_wrapper .facturas-table th:nth-child(2),
.dataTables_wrapper .facturas-table td:nth-child(2) { 
  width: 20% !important;
  min-width: 100px !important;
  max-width: 20% !important;
  text-align: center !important;
  overflow: visible !important;
  text-overflow: unset !important;
  white-space: nowrap !important;
}

.dataTables_wrapper {
  width: 100% !important;
}

.dataTables_wrapper .dataTable {
  width: 100% !important;
}

.btn-download {
  padding: 8px 15px;
  margin: 0 3px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  text-decoration: none;
  display: inline-block !important; 
  transition: all 0.3s ease;
  white-space: nowrap !important; 
  overflow: visible !important; 
  text-overflow: unset !important; 
  min-width: 60px;
}

.btn-copy-documento {
  background: #28a745;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.btn-copy-documento:hover {
  background: #218838;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-copy-documento:active {
  transform: scale(0.95);
}

.btn-copy-documento i {
  font-size: 10px;
}

/* Estilos específicos para móvil */
.btn-copy-mobile {
  width: 24px;
  height: 24px;
  font-size: 10px;
  margin-left: 6px;
}

.btn-copy-mobile i {
  font-size: 9px;
}

/* Contenedor del número de documento */
.documento-numero {
  display: inline-block;
  vertical-align: middle;
}

.btn-json {
  background: #006cb6;
  color: white;
}

.btn-json:hover {
  background: #0056a3;
  color: white;
  transform: translateY(-1px);
}

.btn-pdf {
  background: #006cb6;
  color: white;
}

.btn-pdf:hover {
  background: #0056a3;
  color: white;
  transform: translateY(-1px);
}

.no-facturas {
  text-align: center;
  padding: 40px;
  color: #6c757d;
  font-style: italic;
}

.form-control, .custom-select {
  border-radius: 8px;
  border: 1px solid #ddd;
  padding: 10px 15px;
  width: 100%;
  box-sizing: border-box;
  max-width: 600px;
}

.form-control:focus, .custom-select:focus {
  border-color: #1e73be;
  box-shadow: 0 0 0 0.2rem rgba(30, 115, 190, 0.25);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
  text-align: left;
}

/* DataTable responsive adjustments */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

.dataTables_wrapper {
  width: 100%;
  overflow: hidden;
}

.dataTables_wrapper .dataTables_scroll {
  overflow: auto;
}

.dataTables_wrapper .dataTables_scrollHead {
  overflow: hidden !important;
  border-bottom: 2px solid #dee2e6;
}

.dataTables_wrapper .dataTables_scrollBody {
  overflow: auto;
  border: 1px solid #dee2e6;
  border-top: none;
}

.dataTables_wrapper table.dataTable {
  width: 100% !important;
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin: 10px 0;
}

.dataTables_wrapper .top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
}

.dataTables_wrapper .left-control {
  flex: 1;
}

.dataTables_wrapper .right-control {
  flex: 0 0 auto;
  margin-left: auto;
}

.dataTables_wrapper .dataTables_length {
  position: absolute;
  top: -45px;
  right: 0;
  z-index: 10;
  background: white;
  padding: 0px 10px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_length label {
  display: flex;
  align-items: center;
  margin: 0;
  white-space: nowrap;
  font-size: 13px;
  color: #666;
}

.dataTables_wrapper .dataTables_length select {
  margin: 0 5px;
  display: inline-block;
  min-width: 82px;
  min-height: 32px;
  padding: 0px !important;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.dataTables_wrapper .dataTables_length select:hover {
  border-color: #007cba;
  box-shadow: 0 2px 4px rgba(0,124,186,0.15);
}

.dataTables_wrapper .dataTables_length select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0,124,186,0.15);
}

.dataTables_wrapper {
  position: relative;
  padding-top: 50px;
}

.dataTables_wrapper .dataTables_info {
  text-align: left !important;
  font-size: 14px;
  margin-top: 10px;
}

.facturas-table {
  position: relative;
}

@media (max-width: 992px) {
  .dataTables_wrapper .dataTables_length {
    position: static;
    margin-bottom: 15px;
    text-align: right;
    background: transparent;
    box-shadow: none;
    padding: 0;
    top: auto;
    right: auto;
  }
  
  .dataTables_wrapper {
    padding-top: 20px;
  }
  
  .dataTables_wrapper .dataTables_filter {
    text-align: center;
    margin-bottom: 15px;
  }
  
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: center;
    margin-top: 15px;
  }
  
  .facturas-table {
    min-width: 600px;
  }
  
  .facturas-table th,
  .facturas-table td {
    padding: 12px 6px;
    font-size: 14px;
  }
}
@media (max-width: 992px) {
  .main-layout {
    flex-direction: column;
  }
  
  .filters-container {
    min-width: 100%;
    margin-bottom: 20px;
  }
  
  .facturas-container {
    width: 100%;
    overflow: hidden;
  }
  
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .facturas-table {
    min-width: 100%;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .filters-container {
    padding: 15px;
  }
  
  .facturas-table {
    font-size: 14px;
    min-width: 600px; 
  }
  
  .facturas-table thead th {
    padding: 12px 8px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .facturas-table thead th:nth-child(5) {
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: nowrap !important;
  }
  
  .facturas-table tbody td {
    padding: 12px 8px;
    font-size: 13px;
  }
  
  .facturas-table th:nth-child(5),
  .facturas-table td:nth-child(5) {
    min-width: 180px !important;
    width: auto;
  }
  
  .btn-download {
    padding: 6px 10px;
    font-size: 11px;
    margin: 1px;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    min-width: 50px;
  }
  
  .facturas-table thead {
    background: #f8f9fa;
  }
  
  .facturas-table th {
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .facturas-table th:nth-child(5) {
    overflow: visible !important;
    text-overflow: unset !important;
  }
}

@media (max-width: 576px) {
  .btn-buscar {
    padding: 15px;
    font-size: 16px;
  }
  
  .consulta-title {
    font-size: 16px;
    text-align: center;
  }
  
  .btn-copy-documento {
    width: 22px;
    height: 22px;
    font-size: 9px;
    margin-left: 4px;
  }
  
  .btn-copy-documento i {
    font-size: 8px;
  }
  
  .facturas-header {
    text-align: center;
    font-size: 16px;
  }
}

.hidden {
  display: none;
}

#btnBuscarFacturas {
  width: 100%;
  box-sizing: border-box;
}

.filters-container .btn-digital-fullwidth {
  width: 100% !important;
  box-sizing: border-box !important;
  max-width: none !important;
  margin-top: 10px;
}
#facturaSvTab .btn-digital-fullwidth {
  width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
}

.badge {
  display: inline-block;
  padding: 0.25em 0.4em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
}

.bg-success {
  background-color: #28a745;
  color: white;
}

.bg-warning {
  background-color: #ffc107;
  color: #212529;
}

/* Estilo para el aviso de notificación */
.facturas-notification {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
  padding: 12px 20px;
  margin-bottom: 0;
  border-radius: 0;
  display: none;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}

.facturas-notification.show {
  display: flex;
}

.facturas-notification .notification-icon {
  margin-right: 10px;
  font-size: 16px;
}

.facturas-notification.success {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.facturas-notification.warning {
  background-color: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.facturas-notification.error {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* Estilos para filtros de DataTable */
#filtros-datatable {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  margin-bottom: 20px;
}

#filtros-datatable .form-control,
#filtros-datatable .btn {
  height: 48px;
}

#filtros-datatable label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 5px;
  font-size: 14px;
}

#filtros-datatable select.form-control {
  color: #495057 !important;
  font-weight: 500;
  background-color: #fff !important;
}

#filtros-datatable select.form-control option {
  color: #212529 !important;
  background-color: #fff !important;
  font-weight: 500;
}

#filtros-datatable input.form-control {
  color: #495057 !important;
  font-weight: 500;
}

#filtros-datatable input.form-control::placeholder {
  color: #6c757d !important;
  opacity: 1;
}

.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
  border-color: #4e555b;
  color: white;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin-top: 10px;
  margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.5rem 0.75rem;
  margin-left: 2px;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  color: #006cb6;
  background: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #006cb6;
  color: white;
  border-color: #006cb6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #006cb6;
  color: white;
  border-color: #006cb6;
}

@media (max-width: 768px) {
  #filtros-datatable .row > div {
    margin-bottom: 15px;
  }
  
  #filtros-datatable .col-md-3 {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  #filtros-datatable .d-flex {
    flex-direction: column;
  }
}

.dataTables_wrapper {
  overflow-x: auto;
}

#facturas-wrapper:not(.mobile-view) .mobile-cards {
  display: none !important;
}

#facturas-wrapper {
  width: 100%;
  overflow: hidden;
}

#facturas-wrapper .table-view {
  width: 100%;
  overflow-x: auto;
}

@media (max-width: 990px) {

  .mobile-view .table-view {
    display: none !important;
  }
  
  .mobile-view .dataTables_wrapper {
    display: none !important;
  }
  
  .mobile-cards {
    display: none;
  }
  
  .mobile-view .mobile-cards {
    display: block;
  }
  
  .factura-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .factura-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
  }
  
  .factura-card-date {
    font-weight: 600;
    color: #006cb6;
    font-size: 14px;
  }
  
  .factura-card-body {
    margin-bottom: 15px;
  }
  
  .factura-card-field {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 13px;
  }
  
  .factura-card-label {
    font-weight: 600;
    color: #333;
    width: 35%;
  }
  
  .factura-card-value {
    color: #666;
    width: 65%;
    text-align: right;
    word-break: break-all;
  }
  
  .factura-card-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
  }
  
  .factura-card-actions .btn-download {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    border-radius: 6px;
  }
  
  .mobile-view .dataTables_wrapper .dataTables_length,
  .mobile-view .dataTables_wrapper .dataTables_info,
  .mobile-view .dataTables_wrapper .dataTables_paginate {
    display: block;
    text-align: center;
    margin: 15px 0;
  }
  
  .mobile-view .dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-block;
    margin: 2px;
    padding: 8px 12px;
    font-size: 14px;
  }
}

@media (max-width: 576px) {
  .factura-card {
    padding: 12px;
  }
  
  .factura-card-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .factura-card-actions .btn-download {
    width: 100%;
    margin: 0;
  }
  
  .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 6px 8px !important;
    font-size: 12px !important;
    margin: 1px !important;
  }
}

.facturas-table .actions-column,
.facturas-table .never-hide {
  display: table-cell !important;
  visibility: visible !important;
}

.facturas-table .actions-column .btn-download,
.facturas-table .btn-download {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.facturas-table .dtr-hidden {
  display: table-cell !important;
}

.facturas-table .actions-column {
  min-width: 140px !important;
  width: 140px !important;
  max-width: 140px !important;
}

@media (max-width: 480px) {
  .facturas-table .desktop-only {
    display: none !important;
  }
  
  .facturas-table .btn-download {
    font-size: 10px !important;
    padding: 4px 6px !important;
    margin: 1px !important;
    display: inline-block !important;
  }
  
  .facturas-table .actions-column {
    min-width: 120px !important;
    white-space: nowrap !important;
    display: table-cell !important;
  }
}

@media (max-width: 768px) {
  .facturas-table .tablet-up {
    display: none !important;
  }
  
  .facturas-table .actions-column,
  .facturas-table .actions-column .btn-download {
    display: table-cell !important;
    visibility: visible !important;
  }
}

.facturas-table .never-hide,
.facturas-table .actions-column {
  display: table-cell !important;
  visibility: visible !important;
}

.facturas-table .actions-column .btn-download {
  white-space: nowrap;
  display: inline-block !important;
  visibility: visible !important;
}

.dataTables_wrapper .dtr-inline.collapsed::before,
.dataTables_wrapper .dtr-inline.collapsed::after {
  display: none !important;
}

.dataTables_wrapper .dtr-inline.collapsed {
  cursor: default !important;
}

.dataTables_wrapper .dtr-details {
  display: none !important;
}

.dtr-control,
.dtr-data,
.dtr-details,
.dtr-inline,
.dtr-modal {
  display: none !important;
}

table.dataTable.dtr-inline.collapsed tbody td.never-hide,
table.dataTable.dtr-inline.collapsed tbody th.never-hide,
table.dataTable.dtr-inline.collapsed tbody td.actions-column,
table.dataTable.dtr-inline.collapsed tbody th.actions-column {
  display: table-cell !important;
}

.dataTables_wrapper .ellipsis,
.dataTables_wrapper .dtr-control::before,
.dataTables_wrapper td.control::before,
.dataTables_wrapper th.control::before {
  content: '' !important;
  display: none !important;
}

.facturas-table {
  width: 100% !important;
}