/**
 * GlobPay - Sección Pedidos
 * orders.css
 * 
 * Cumplimiento de diseño:
 * - Acento turquesa oficial #0BB6B5
 * - Estilo Polaris y tarjetas sobrias
 * - Badges para estados financieros (Pendiente neutral, Parcial ámbar, Pagado verde)
 * - Badges de origen (Simulación / Prueba)
 * - Vista rápida (drawer modal lateral)
 * - Responsivo para 360px, 390px, 430px y escritorio
 */

/* 1. ENCABEZADO DE PEDIDOS */
.orders-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.orders-header-main {
  flex: 1;
  min-width: 240px;
}

.orders-title {
  font-size: 24px;
  font-weight: 700;
  color: #202223;
  margin: 0 0 4px 0;
  letter-spacing: -0.3px;
}

.orders-subtitle {
  font-size: 14px;
  color: #6D7175;
  margin: 0;
}

.orders-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-export-csv {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #FFFFFF;
  color: #202223;
  border: 1px solid #BABEC3;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
}

.btn-export-csv:hover:not(:disabled) {
  background-color: #F6F6F7;
  border-color: #8C9196;
}

.btn-export-csv:focus-visible {
  outline: none;
  border-color: #0BB6B5;
  box-shadow: 0 0 0 2px rgba(11, 182, 181, 0.35);
}

.btn-export-csv:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 2. BANNER DE VISTA DE DEMOSTRACIÓN */
.orders-demo-notice-banner {
  background-color: #E8F8F8;
  border: 1px solid #99E7E6;
  border-left: 4px solid #0BB6B5;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-notice-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #004D4D;
  line-height: 1.4;
}

.demo-notice-icon {
  font-size: 16px;
}

/* 3. BARRA DE FILTROS */
.orders-filter-bar {
  background-color: #FFFFFF;
  border: 1px solid #E1E3E5;
  border-radius: 8px 8px 0 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
}

.filter-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #8C9196;
  pointer-events: none;
}

.filter-search-input {
  width: 100%;
  height: 36px;
  padding: 6px 12px 6px 34px;
  border: 1px solid #BABEC3;
  border-radius: 6px;
  font-size: 13px;
  color: #202223;
  background-color: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.filter-search-input:focus {
  outline: none;
  border-color: #0BB6B5;
  box-shadow: 0 0 0 2px rgba(11, 182, 181, 0.35);
}

.filter-select-wrap {
  flex: 0 0 auto;
}

.filter-select {
  height: 36px;
  padding: 6px 28px 6px 12px;
  border: 1px solid #BABEC3;
  border-radius: 6px;
  font-size: 13px;
  color: #202223;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236D7175' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.filter-select:focus {
  outline: none;
  border-color: #0BB6B5;
  box-shadow: 0 0 0 2px rgba(11, 182, 181, 0.35);
}

.filter-custom-dates {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-date-input {
  height: 36px;
  padding: 4px 8px;
  border: 1px solid #BABEC3;
  border-radius: 6px;
  font-size: 12px;
  color: #202223;
}

.filter-date-sep {
  font-size: 12px;
  color: #6D7175;
}

.btn-clear-filters {
  background: none;
  border: none;
  color: #087877;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  text-decoration: underline;
  transition: color 0.15s;
}

.btn-clear-filters:hover {
  color: #055050;
}

/* 4. TARJETA Y TABLA DE PEDIDOS */
.orders-card {
  background-color: #FFFFFF;
  border: 1px solid #E1E3E5;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin-bottom: 24px;
}

.orders-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.orders-table th {
  background-color: #FAFBFB;
  color: #6D7175;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid #E1E3E5;
  white-space: nowrap;
}

.orders-table th.text-right,
.orders-table td.text-right {
  text-align: right;
}

.orders-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F2F3;
  color: #202223;
  vertical-align: middle;
}

.orders-table tr {
  cursor: pointer;
  transition: background-color 0.1s;
}

.orders-table tbody tr:hover {
  background-color: #F8FBFB;
}

.orders-table tbody tr.is-selected {
  background-color: #EDF9F9;
  border-left: 3px solid #0BB6B5;
}

.orders-table tbody tr:focus-visible {
  outline: 2px solid #0BB6B5;
  outline-offset: -2px;
}

/* Pedido Link/Number */
.order-num-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.order-num-text {
  color: #0BB6B5;
  font-weight: 600;
  text-decoration: none;
}

.order-num-text:hover {
  text-decoration: underline;
}

.badge-simulacion {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #E8F8F8;
  color: #087877;
  border: 1px solid #B8ECEC;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-prueba {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #F3E8FF;
  color: #6B21A8;
  border: 1px solid #E9D5FF;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-comercial {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #E3F1DF;
  color: #108043;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Badges de Pago */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.status-badge.badge-neutral {
  background-color: #F1F2F3;
  color: #5C5F62;
}

.status-badge.badge-amber {
  background-color: #FFF5EA;
  color: #8A6100;
  border: 1px solid #FFE4B8;
}

.status-badge.badge-green {
  background-color: #E3F1DF;
  color: #108043;
}

.text-delivery-neutral {
  color: #8C9196;
  font-size: 12px;
}

/* 5. ESTADOS DE CARGA, VACÍO Y ERROR */
.orders-skeleton {
  padding: 20px 16px;
}

.skeleton-line {
  background-color: #E1E3E5;
  border-radius: 4px;
}

.shimmer {
  background: linear-gradient(90deg, #F1F2F3 25%, #E1E3E5 50%, #F1F2F3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.orders-empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon-box {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #202223;
  margin: 0 0 6px 0;
}

.empty-subtitle {
  font-size: 13px;
  color: #6D7175;
  margin: 0 0 16px 0;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.btn-empty-action {
  display: inline-flex;
  align-items: center;
  background-color: #0BB6B5;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
}

.btn-empty-action:hover {
  background-color: #089493;
}

/* 6. PIE DE PAGINACIÓN */
.orders-pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #E1E3E5;
  background-color: #FAFBFB;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}

.orders-count-label {
  color: #6D7175;
}

.orders-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn {
  background-color: #FFFFFF;
  border: 1px solid #BABEC3;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #202223;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  background-color: #F6F6F7;
  border-color: #8C9196;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-page-indicator {
  color: #6D7175;
  font-size: 12px;
  padding: 0 4px;
}

/* 7. TARJETAS INFORMATIVAS INFERIORES */
.orders-info-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.orders-info-card {
  background-color: #FFFFFF;
  border: 1px solid #E1E3E5;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.info-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #202223;
  margin: 0 0 6px 0;
}

.info-card-text {
  font-size: 13px;
  color: #6D7175;
  margin: 0;
  line-height: 1.4;
}

/* 8. BARRA INFERIOR DE ACCIONES */
.orders-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background-color: #FFFFFF;
  border: 1px solid #E1E3E5;
  border-radius: 8px;
  margin-bottom: 30px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
  gap: 14px;
}

.demo-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.demo-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #0BB6B5;
  cursor: pointer;
}

.checkbox-text {
  font-size: 13px;
  font-weight: 600;
  color: #202223;
}

.btn-open-detail {
  display: inline-flex;
  align-items: center;
  background-color: #202223;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-open-detail:hover:not(:disabled) {
  background-color: #313538;
}

.btn-open-detail:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #0BB6B5;
}

.btn-open-detail:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background-color: #BABEC3;
}

/* 9. VISTA RÁPIDA (QUICK VIEW DRAWER) */
.order-quick-view-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}

.order-quick-view-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(1px);
}

.order-quick-view-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100%;
  background-color: #FFFFFF;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow-y: auto;
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.quick-view-header {
  padding: 18px 20px;
  border-bottom: 1px solid #E1E3E5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #FAFBFB;
}

.quick-view-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-order-num {
  font-size: 18px;
  font-weight: 700;
  color: #0BB6B5;
  margin: 0;
}

.btn-close-quick-view {
  background: none;
  border: none;
  font-size: 18px;
  color: #6D7175;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}

.btn-close-quick-view:hover {
  background-color: #F1F2F3;
  color: #202223;
}

.quick-view-body {
  padding: 20px;
  flex: 1;
}

.quick-detail-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #F1F2F3;
}

.quick-detail-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.quick-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #8C9196;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
}

.quick-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.quick-product-item {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #E1E3E5;
}

.quick-product-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.quick-product-item-title {
  font-weight: 600;
  color: #202223;
  margin-bottom: 3px;
  font-size: 13px;
}

.quick-product-item-pricing {
  font-size: 12px;
  color: #5C5F62;
}

.quick-product-item-pricing strong {
  color: #202223;
  font-weight: 600;
}

.quick-detail-label {
  color: #6D7175;
}

.quick-detail-val {
  color: #202223;
  font-weight: 500;
  text-align: right;
}

.quick-detail-val.is-strong {
  font-weight: 700;
  font-size: 15px;
}

.quick-detail-val.is-teal {
  color: #0BB6B5;
  font-weight: 700;
}

.quick-external-ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #F6F6F7;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #202223;
}

.quick-view-footer {
  padding: 14px 20px;
  border-top: 1px solid #E1E3E5;
  background-color: #FAFBFB;
  display: flex;
  justify-content: flex-end;
}

.btn-close-panel {
  background-color: #FFFFFF;
  border: 1px solid #BABEC3;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #202223;
  cursor: pointer;
}

.btn-close-panel:hover {
  background-color: #F6F6F7;
}

/* 10. ADAPTACIÓN MÓVIL (360px, 390px, 430px) */
@media (max-width: 768px) {
  .orders-header {
    flex-direction: column;
    align-items: stretch;
  }

  .orders-header-actions {
    width: 100%;
  }

  .btn-export-csv {
    width: 100%;
    justify-content: center;
  }

  .orders-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-search-wrap,
  .filter-select-wrap,
  .filter-select {
    width: 100%;
  }

  .orders-info-cards-grid {
    grid-template-columns: 1fr;
  }

  .orders-bottom-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-open-detail {
    width: 100%;
    justify-content: center;
  }

  .order-quick-view-panel {
    max-width: 100%;
  }
}
