/* ===== ESTILOS PARA PEDIDOS ===== */

/* Header de pedidos */
.orders-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 0;
}

.orders-header h1 {
  color: var(--dark);
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
  font-weight: 700;
}

.orders-header p {
  color: #666;
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Grid de pedidos */
.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* Tarjeta de pedido */
.order-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
  position: relative;
  overflow: hidden;
}

.order-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #6b7cff);
}

.order-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

/* Header del pedido */
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #f8f9fa;
}

.order-info h3 {
  color: var(--dark);
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.order-date {
  color: #666;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Estados del pedido */
.order-status {
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  min-width: 120px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  color: #856404;
  border: 2px solid #ffeaa7;
}

.status-paid {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  color: #155724;
  border: 2px solid #c3e6cb;
}

.status-shipped {
  background: linear-gradient(135deg, #cce5ff, #b3d7ff);
  color: #004085;
  border: 2px solid #b3d7ff;
}

.status-delivered {
  background: linear-gradient(135deg, #d1ecf1, #bee5eb);
  color: #0c5460;
  border: 2px solid #bee5eb;
}

.status-cancelled {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  color: #721c24;
  border: 2px solid #f5c6cb;
}

/* Detalles del pedido */
.order-details {
  margin-bottom: 2rem;
}

.order-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.order-item .label {
  color: #666;
  font-weight: 600;
  font-size: 0.95rem;
}

.order-item .value {
  color: var(--dark);
  font-weight: 700;
  font-size: 1rem;
}

/* Acciones del pedido */
.order-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #5a6268);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #5a6268, #495057);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

/* Estado vacío */
.empty-orders {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.empty-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  opacity: 0.3;
}

.empty-orders h3 {
  color: var(--dark);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.empty-orders p {
  color: #666;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Modal de detalles del pedido */
.order-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 2rem;
  backdrop-filter: blur(5px);
}

.order-details-modal {
  background: white;
  border-radius: 20px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2rem 1.5rem 2rem;
  border-bottom: 2px solid #f8f9fa;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 20px 20px 0 0;
}

.modal-header h2 {
  color: var(--dark);
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.close-btn {
  background: white;
  border: 2px solid #e9ecef;
  font-size: 1.2rem;
  color: #666;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.1);
}

/* Secciones del modal */
.modal-body {
  padding: 2rem;
}

.order-info-section,
.shipping-info-section,
.products-section {
  margin-bottom: 2.5rem;
}

.order-info-section h3,
.shipping-info-section h3,
.products-section h3 {
  color: var(--dark);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--primary);
  font-size: 1.4rem;
  font-weight: 700;
  position: relative;
}

.order-info-section h3::after,
.shipping-info-section h3::after,
.products-section h3::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #6b7cff);
}

/* Grid de información */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  border: 1px solid #dee2e6;
}

.info-item .label {
  color: #666;
  font-weight: 600;
  font-size: 0.95rem;
}

.info-item .value {
  color: var(--dark);
  font-weight: 700;
  font-size: 1rem;
}

/* Información de envío */
.shipping-details {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  padding: 1.5rem;
  border-radius: 12px;
  line-height: 1.8;
  border: 1px solid #dee2e6;
}

.shipping-details p {
  margin: 0.5rem 0;
  color: var(--dark);
  font-size: 1rem;
}

.shipping-details p:first-child {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

/* Lista de productos */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.product-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.product-image img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.product-info h4 {
  color: var(--dark);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.product-info .category {
  color: var(--primary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-info .quantity,
.product-info .price {
  color: #666;
  font-size: 0.95rem;
  margin: 0.25rem 0;
  font-weight: 500;
}

.product-total .total {
  color: var(--dark);
  font-weight: 800;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--primary), #6b7cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Loading y estados de error */
.loading {
  text-align: center;
  padding: 4rem 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-required,
.error-message {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.auth-required h2,
.error-message h2 {
  color: var(--dark);
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  font-weight: 700;
}

.auth-required p,
.error-message p {
  color: #666;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

/* Responsive para pedidos */
@media (max-width: 1024px) {
  .orders-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
  }
  
  .order-details-modal {
    max-width: 95%;
    margin: 1rem;
  }
}

@media (max-width: 768px) {
  .orders-header {
    padding: 1.5rem 0;
  }
  
  .orders-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
  }
  
  .orders-header p {
    font-size: 1rem;
    max-width: 100%;
  }
  
  .orders-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
  }
  
  .order-card {
    padding: 1.25rem;
    border-radius: 12px;
  }
  
  .order-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
  }
  
  .order-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
  }
  
  .order-date {
    font-size: 0.9rem;
  }
  
  .order-status {
    align-self: flex-start;
    min-width: 90px;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    border-radius: 20px;
  }
  
  .order-details {
    margin-bottom: 1.5rem;
  }
  
  .order-summary {
    gap: 0.75rem;
  }
  
  .order-item {
    padding: 0.875rem;
    border-radius: 10px;
  }
  
  .order-item .label {
    font-size: 0.9rem;
  }
  
  .order-item .value {
    font-size: 0.95rem;
  }
  
  .order-actions {
    gap: 0.75rem;
  }
  
  .btn-secondary {
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 10px;
  }
  
  /* Modal mejorado para móvil */
  .order-modal-overlay {
    padding: 1rem;
  }
  
  .order-details-modal {
    max-width: 100%;
    border-radius: 16px;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    border-radius: 16px 16px 0 0;
  }
  
  .modal-header h2 {
    font-size: 1.4rem;
  }
  
  .close-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    padding: 0.6rem;
  }
  
  .modal-body {
    padding: 1.25rem;
  }
  
  .order-info-section,
  .shipping-info-section,
  .products-section {
    margin-bottom: 1.75rem;
  }
  
  .order-info-section h3,
  .shipping-info-section h3,
  .products-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
    gap: 0.875rem;
  }
  
  .info-item {
    padding: 1rem;
    border-radius: 10px;
  }
  
  .info-item .label {
    font-size: 0.9rem;
  }
  
  .info-item .value {
    font-size: 0.95rem;
  }
  
  .shipping-details {
    padding: 1.25rem;
    border-radius: 10px;
    line-height: 1.6;
  }
  
  .shipping-details p {
    font-size: 0.95rem;
    margin: 0.4rem 0;
  }
  
  .shipping-details p:first-child {
    font-size: 1rem;
  }
  
  .products-list {
    gap: 1.25rem;
  }
  
  .product-item {
    grid-template-columns: 70px 1fr;
    gap: 0.875rem;
    padding: 1.25rem;
    border-radius: 10px;
  }
  
  .product-image img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
  }
  
  .product-info h4 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }
  
  .product-info .category {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }
  
  .product-info .quantity,
  .product-info .price {
    font-size: 0.85rem;
    margin: 0.2rem 0;
  }
  
  .product-total {
    grid-column: 1 / -1;
    text-align: right;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
  }
  
  .product-total .total {
    font-size: 1.1rem;
  }
  
  /* Estados vacío y error mejorados */
  .empty-orders {
    padding: 3rem 1.5rem;
    border-radius: 12px;
  }
  
  .empty-icon {
    font-size: 4rem;
    margin-bottom: 1.25rem;
  }
  
  .empty-orders h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
  }
  
  .empty-orders p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .loading {
    padding: 3rem 1.5rem;
  }
  
  .spinner {
    width: 45px;
    height: 45px;
    margin-bottom: 1.25rem;
  }
  
  .auth-required,
  .error-message {
    padding: 3rem 1.5rem;
    border-radius: 12px;
  }
  
  .auth-required h2,
  .error-message h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }
  
  .auth-required p,
  .error-message p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .orders-header {
    padding: 1.25rem 0;
  }
  
  .orders-header h1 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
  }
  
  .orders-header p {
    font-size: 0.95rem;
  }
  
  .orders-grid {
    gap: 1rem;
    margin-top: 1.25rem;
  }
  
  .order-card {
    padding: 1rem;
    border-radius: 10px;
  }
  
  .order-header {
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }
  
  .order-info h3 {
    font-size: 1.2rem;
  }
  
  .order-date {
    font-size: 0.85rem;
  }
  
  .order-status {
    min-width: 80px;
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
    border-radius: 18px;
  }
  
  .order-summary {
    gap: 0.6rem;
  }
  
  .order-item {
    padding: 0.75rem;
    border-radius: 8px;
  }
  
  .order-item .label {
    font-size: 0.85rem;
  }
  
  .order-item .value {
    font-size: 0.9rem;
  }
  
  .btn-secondary {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    gap: 0.5rem;
  }
  
  /* Modal ultra compacto */
  .order-modal-overlay {
    padding: 0.5rem;
  }
  
  .order-details-modal {
    border-radius: 12px;
    max-height: 98vh;
  }
  
  .modal-header {
    padding: 1rem 1rem 0.75rem 1rem;
    border-radius: 12px 12px 0 0;
  }
  
  .modal-header h2 {
    font-size: 1.3rem;
  }
  
  .close-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    padding: 0.5rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .order-info-section,
  .shipping-info-section,
  .products-section {
    margin-bottom: 1.5rem;
  }
  
  .order-info-section h3,
  .shipping-info-section h3,
  .products-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
  }
  
  .info-grid {
    gap: 0.75rem;
  }
  
  .info-item {
    padding: 0.875rem;
    border-radius: 8px;
  }
  
  .info-item .label {
    font-size: 0.85rem;
  }
  
  .info-item .value {
    font-size: 0.9rem;
  }
  
  .shipping-details {
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.5;
  }
  
  .shipping-details p {
    font-size: 0.9rem;
    margin: 0.3rem 0;
  }
  
  .shipping-details p:first-child {
    font-size: 0.95rem;
  }
  
  .products-list {
    gap: 1rem;
  }
  
  .product-item {
    grid-template-columns: 60px 1fr;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
  }
  
  .product-image img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
  }
  
  .product-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
  }
  
  .product-info .category {
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
  }
  
  .product-info .quantity,
  .product-info .price {
    font-size: 0.8rem;
    margin: 0.15rem 0;
  }
  
  .product-total {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
  }
  
  .product-total .total {
    font-size: 1rem;
  }
  
  /* Estados vacío y error ultra compactos */
  .empty-orders {
    padding: 2.5rem 1rem;
    border-radius: 10px;
  }
  
  .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
  }
  
  .empty-orders h3 {
    font-size: 1.2rem;
    margin-bottom: 0.6rem;
  }
  
  .empty-orders p {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
  }
  
  .loading {
    padding: 2.5rem 1rem;
  }
  
  .spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
  }
  
  .auth-required,
  .error-message {
    padding: 2.5rem 1rem;
    border-radius: 10px;
  }
  
  .auth-required h2,
  .error-message h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }
  
  .auth-required p,
  .error-message p {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
  }
}

/* Optimizaciones para pantallas muy pequeñas */
@media (max-width: 360px) {
  .orders-header h1 {
    font-size: 1.5rem;
  }
  
  .orders-header p {
    font-size: 0.9rem;
  }
  
  .order-card {
    padding: 0.875rem;
  }
  
  .order-info h3 {
    font-size: 1.1rem;
  }
  
  .order-status {
    min-width: 70px;
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
  }
  
  .order-item {
    padding: 0.6rem;
  }
  
  .order-item .label {
    font-size: 0.8rem;
  }
  
  .order-item .value {
    font-size: 0.85rem;
  }
  
  .btn-secondary {
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
  
  .close-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  .product-item {
    grid-template-columns: 55px 1fr;
    gap: 0.6rem;
    padding: 0.875rem;
  }
  
  .product-image img {
    width: 55px;
    height: 55px;
  }
  
  .product-info h4 {
    font-size: 0.9rem;
  }
  
  .product-info .category {
    font-size: 0.7rem;
  }
  
  .product-info .quantity,
  .product-info .price {
    font-size: 0.75rem;
  }
  
  .product-total .total {
    font-size: 0.95rem;
  }
}
