/* General container */
.affiliate-container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Heading */
.affiliate-container h2 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 28px;
  color: #333;
}

/* Summary cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  background: linear-gradient(135deg, #007bff, #00c6ff);
  color: #fff;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-5px);
}

.summary-card h4 {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
}

.summary-card p {
  font-size: 20px;
  font-weight: bold;
}

/* Filter Form */
.filter-form {
  margin-bottom: 25px;
  text-align: right;
}

.filter-form label {
  margin-right: 10px;
  font-weight: 500;
  color: #333;
}

.filter-form select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

/* Sales Table */
.sales-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 25px;
}

.sales-table th,
.sales-table td {
  padding: 12px 15px;
  border: 1px solid #eee;
  text-align: left;
}

.sales-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.sales-table tr:nth-child(even) {
  background: #fafafa;
}

.sales-table tr:hover {
  background: #f1f1f1;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
}

.pagination a {
  padding: 8px 14px;
  border-radius: 6px;
  background: #007bff;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.3s ease;
}

.pagination a:hover {
  background: #0056b3;
}

/* Responsive Design */
@media (max-width: 768px) {
  .affiliate-container {
    padding: 15px;
  }

  .affiliate-container h2 {
    font-size: 22px;
  }

  .sales-table th, .sales-table td {
    padding: 8px;
    font-size: 13px;
  }

  .filter-form {
    text-align: left;
    margin-bottom: 15px;
  }
}

@media (max-width: 500px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .pagination {
    flex-direction: column;
    gap: 8px;
  }
}


/* ✅ Table Responsive Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.sales-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 25px;
  min-width: 700px; /* prevent columns from squeezing too much */
}

.sales-table th,
.sales-table td {
  white-space: nowrap; /* keep columns tidy */
}

/* Responsive Design */
@media (max-width: 768px) {
  .affiliate-container {
    padding: 15px;
  }

  .affiliate-container h2 {
    font-size: 22px;
  }

  .sales-table th, 
  .sales-table td {
    padding: 8px;
    font-size: 13px;
  }

  .filter-form {
    text-align: left;
    margin-bottom: 15px;
  }
}

@media (max-width: 500px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .pagination {
    flex-direction: column;
    gap: 8px;
  }

  /* ✅ Force table scrolling on very small devices */
  .table-responsive {
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
  }

  .sales-table {
    font-size: 12px;
    min-width: 600px; /* still scrollable */
  }
}
