/* Custom Orders Table Styling - Tailwind Inspired */

:root {
  --primary: #ffcf60;
  --primary-dark: #f5c44e;
  --secondary: #f66212;
  --secondary-dark: #e45000;
  --text-dark: #333333;
  --text-light: #ffffff;
  --text-muted: #6b7280;
  --bg-light: #f9fafb;
  --border-light: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* Orders Header with Search - Improved */
.custom-orders-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #eaeaea;
}

.custom-orders-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: #333333;
  letter-spacing: -0.01em;
  position: relative;
}

.custom-orders-header h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background-color: var(--primary);
}

.custom-orders-search {
  flex: 1;
  max-width: 450px;
  margin-left: 1.5rem;
  position: relative;
}

.custom-orders-search form {
  display: flex;
  align-items: stretch;
  height: 38px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  border-radius: 6px;
  overflow: hidden;
}

.custom-orders-search input[type="text"] {
  flex: 1;
  padding: 0 1rem;
  border: 1px solid #e4e4e4;
  border-right: none;
  border-radius: 6px 0 0 6px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  height: 100%;
}

.custom-orders-search input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 207, 96, 0.2);
}

.custom-orders-search .search-button {
  padding: 0 1rem;
  background-color: var(--primary);
  color: #333;
  border: 1px solid var(--primary);
  border-radius: 0 6px 6px 0;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  height: 100%;
  display: flex;
  align-items: center;
}

.custom-orders-search .search-button:hover {
  background-color: var(--secondary);
  border-color: var(--secondary);
  color: white;
}

/* Container styles */
.custom-orders-container {
  width: 100%;
}

/* Card Design - Flexible height based on content */
.custom-order-card {
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: #ffffff;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box; /* Include padding in width calculation */
}

/* Status-based card backgrounds - more vibrant */
.custom-order-card.status-green {
  border-left: 3px solid var(--success);
  background-color: rgba(16, 185, 129, 0.08);
}

.custom-order-card.status-red {
  border-left: 3px solid var(--danger);
  background-color: rgba(239, 68, 68, 0.08);
}

.custom-order-card.status-yellow {
  border-left: 3px solid var(--warning);
  background-color: rgba(245, 158, 11, 0.08);
}

.custom-order-card.status-blue {
  border-left: 3px solid #3b82f6;
  background-color: rgba(59, 130, 246, 0.08);
}

.custom-order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.08);
}

/* Card Header and Title Styling */
.custom-order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Align to top to avoid stretching */
  margin-bottom: 0.4rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 0.3rem;
  width: 100%;
  position: relative; /* Added for absolute positioning context */
}

.custom-order-title-group {
  flex: 1;
  min-width: 0; /* Allow the flex item to shrink below content size */
  margin-right: 0.5rem; /* Add some space between title and buttons */
}

.custom-order-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  display: inline-block; /* Changed from flex to inline-block */
  white-space: nowrap; /* Prevent line breaks within the title */
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Container for buttons on the right side */
.custom-header-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  position: absolute;
  top: 0;
  right: 0;
}

/* Support Button - Improved */
.support-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #25D366; /* WhatsApp green */
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  letter-spacing: 0.01em;
  position: relative;
  margin-left: 0; /* Remove left margin since it's no longer inside the title */
  white-space: nowrap; /* Prevent breaking to multiple lines */
  max-width: 100%; /* Ensure it fits container */
}

.support-button::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19.44,13.04c0.14-0.42,0.14-0.85,0.14-1.28c0-0.42-0.14-0.85-0.14-1.28l1.28-1c0.28-0.28,0.28-0.57,0.14-0.85 l-1.28-2.13c-0.14-0.28-0.42-0.42-0.7-0.28l-1.56,0.57c-0.42-0.28-0.85-0.57-1.28-0.71L16.04,4c0-0.28-0.28-0.57-0.57-0.57h-2.55 c-0.28,0-0.57,0.28-0.57,0.57l-0.14,1.57c-0.42,0.14-0.85,0.42-1.28,0.71L9.4,5.71C9.12,5.57,8.84,5.71,8.7,6l-1.28,2.13 c-0.14,0.28-0.14,0.57,0.14,0.85l1.28,1c0,0.42-0.14,0.85-0.14,1.28c0,0.42,0.14,0.85,0.14,1.28l-1.28,1 c-0.28,0.28-0.28,0.57-0.14,0.85l1.28,2.13c0.14,0.28,0.42,0.42,0.7,0.28l1.56-0.57c0.42,0.28,0.85,0.57,1.28,0.71L12.36,20 c0,0.28,0.28,0.57,0.57,0.57h2.55c0.28,0,0.57-0.28,0.57-0.57l0.14-1.57c0.42-0.14,0.85-0.42,1.28-0.71l1.56,0.57 c0.28,0.14,0.57,0,0.7-0.28l1.28-2.13c0.14-0.28,0.14-0.57-0.14-0.85L19.44,13.04z M13.92,14.75c-1.71,0-3.13-1.42-3.13-3.13 s1.42-3.13,3.13-3.13s3.13,1.42,3.13,3.13S15.63,14.75,13.92,14.75z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: 4px;
}

.support-button:hover {
  background-color: #128C7E; /* Darker WhatsApp green */
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Copy Button Styling */
.copy-button {
  background-color: transparent;
  border: 1px solid var(--border-light);
  border-radius: 0.25rem;
  padding: 0.25rem 0.375rem;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.copy-button:hover {
  background-color: var(--bg-light);
  border-color: var(--primary);
}

.copy-button svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.copy-success {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background-color: var(--success);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-1rem);
  transition: all 0.3s ease;
  z-index: 1000;
}

.copy-success.show {
  opacity: 1;
  transform: translateY(0);
}

/* Loading animation */
.loading-animation {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--secondary);
  animation: spin 1s linear infinite;
  flex-shrink: 0; /* Prevent animation from shrinking */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Status Styles */
.custom-order-status-under-title {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0.25rem;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  letter-spacing: 0.01em;
}

.custom-order-status-under-title.status-green {
  background-color: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.custom-order-status-under-title.status-processing {
  background-color: rgba(5, 150, 105, 0.12);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.custom-order-status-under-title.status-red {
  background-color: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.custom-order-status-under-title.status-yellow {
  background-color: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.custom-order-status-under-title.status-blue {
  background-color: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Custom icons */
.payment-method-icon {
  vertical-align: middle;
  margin-right: 5px;
  object-fit: contain;
}

.status-gif-icon {
  vertical-align: middle;
  margin-right: 6px;
  object-fit: contain;
}

/* Order Row and Column Layout */
.custom-order-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem; /* Reduced vertical spacing */
  gap: 0.375rem;
  width: 100%;
}

.custom-order-column {
  width: 48%;
  min-width: 0; /* Allow column to shrink below content size */
}

.custom-order-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.1rem; /* Reduced vertical spacing */
  font-weight: 500;
}

.custom-order-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.2;
}

.custom-order-price {
  color: var(--secondary);
  font-size: 0.975rem;
}

/* Player & Payment Details */
.custom-player-details, 
.custom-payment-details {
  background-color: rgba(249, 250, 251, 0.5);
  padding: 0.3rem 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.25rem; /* Reduced vertical spacing */
  border-left: 2px solid var(--primary);
  width: 100%;
  box-sizing: border-box;
}

.custom-payment-details {
  background-color: rgba(255, 247, 237, 0.5);
  border-left-color: var(--secondary);
}

/* Order Description */
.custom-order-description {
  background-color: #f0f7ff !important;
  padding: 0.6rem 0.8rem !important;
  border-radius: 0.375rem !important;
  border-left: 5px solid var(--secondary) !important;
  margin: 0.5rem 0 !important;
  font-size: 25px !important;
  color: #000000 !important;
  line-height: 1.3 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  font-weight: 500 !important;
  min-height: 60px !important;
  max-height: none !important;
  overflow: visible !important;
  word-break: normal !important;
  white-space: normal !important;
  text-overflow: clip !important;
  display: block !important;
}

/* Action Buttons */
.custom-order-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem; /* Reduced vertical spacing */
  width: 100%;
  margin-top: 0.25rem;
}

.custom-order-action-btn,
.custom-order-view-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.3rem 0.5rem;
  text-align: center;
  border-radius: 0.25rem;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.custom-order-action-btn {
  background-color: var(--primary);
  color: var(--text-dark);
  border: none;
}

.custom-order-action-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.custom-order-view-btn {
  background-color: var(--secondary);
  color: var(--text-light);
  border: none;
}

.custom-order-view-btn:hover {
  background-color: var(--secondary-dark);
  color: var(--text-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

/* Pagination Styling */
.custom-orders-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.custom-orders-pagination-info {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.custom-orders-pagination-links {
  display: flex;
  gap: 0.75rem;
}

.custom-prev-page-btn,
.custom-next-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
  background-color: var(--primary);
  color: var(--text-dark);
  border-radius: 0.375rem;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.custom-prev-page-btn:hover,
.custom-next-page-btn:hover {
  background-color: var(--secondary);
  color: var(--text-light);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hide default WooCommerce orders table */
.woocommerce-MyAccount-orders {
  display: none;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
  .custom-orders-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .custom-orders-search {
    margin-left: 0;
    margin-top: 1rem;
    max-width: 100%;
    width: 100%;
  }
  
  .custom-order-header {
    align-items: flex-start; /* Align items to the top on mobile */
  }
  
  .custom-header-buttons {
    padding-top: 0.25rem; /* Add a bit of space at the top on mobile */
  }
  
  .custom-order-title {
    font-size: 1rem;
  }
  
  /* Override any default behavior to maintain the row layout */
  .custom-order-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    margin-bottom: 0.25rem; /* Reduced vertical spacing */
    gap: 4%;
  }
  
  .custom-order-column {
    width: 48% !important;
    margin-bottom: 0.25rem; /* Reduced vertical spacing */
  }
  
  .custom-order-status {
    display: inline-flex;
    padding: 0.25rem 0.375rem;
  }
  
  /* Ensure all columns have the same bottom margin */
  .custom-order-column:last-child {
    margin-bottom: 0.25rem; /* Reduced vertical spacing */
  }
  
  .custom-order-card {
    padding: 0.5rem;
  }
}

/* Small screens */
@media (max-width: 480px) {
  .custom-order-header {
    flex-wrap: wrap;
    min-height: 60px; /* Added to ensure space for absolute positioned buttons */
    padding-right: 80px; /* Added to prevent title overlapping with buttons */
  }
  
  .custom-order-title-group {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .custom-header-buttons {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    flex-direction: column;
    align-items: flex-end;
  }
  
  .support-button, .copy-button {
    font-size: 0.7rem;
    padding: 0.2rem 0.3rem;
  }
  
  .custom-orders-pagination {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .custom-orders-pagination-links {
    width: 100%;
    justify-content: space-between;
  }
  
  .custom-prev-page-btn,
  .custom-next-page-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* Only very small screens get single column */
@media (max-width: 320px) {
  .custom-order-row {
    flex-direction: column !important;
  }
  
  .custom-order-column {
    width: 100% !important;
  }
}