/* =============================================
   ARO Contracts Page Styles
   ============================================= */

.aro-contracts-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 60px;
  font-family: inherit;
}

/* --- Category Buttons Grid --- */
.aro-category-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 32px 0 40px;
}

.aro-cat-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

/* --- No image: plain style --- */
.aro-cat-btn:not(.has-bg-image):hover {
  border-color: #0073aa;
  background: #f0f7ff;
  box-shadow: 0 2px 8px rgba(0, 115, 170, 0.15);
}

/* --- With background image --- */
.aro-cat-btn.has-bg-image {
  background-size: cover;
  background-position: center;
  border-color: transparent;
  color: #fff;
}

/* Dark overlay on photo buttons for readability */
.aro-cat-btn.has-bg-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 6px;
  transition: background 0.2s;
}

.aro-cat-btn.has-bg-image:hover::before {
  background: rgba(0, 0, 0, 0.28);
}

/* --- Active state: always solid blue, regardless of image --- */
.aro-cat-btn.active {
  border-color: #0073aa;
  background-color: #0073aa;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 115, 170, 0.35);
}

/* Replace dark overlay with blue overlay when active + has image */
.aro-cat-btn.has-bg-image.active::before {
  background: rgba(0, 115, 170, 0.88);
}

/* Text and count sit above the overlay */
.aro-cat-btn-label,
.aro-cat-btn-count {
  position: relative;
  z-index: 1;
}

.aro-cat-btn-label {
  display: block;
}

.aro-cat-btn-count {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.8;
}

.aro-cat-btn.active .aro-cat-btn-count {
  opacity: 0.9;
}

/* Old image span (kept for backward compat, hidden in new layout) */
.aro-cat-btn-img {
  display: none;
}

/* --- Active Category Label --- */
.aro-active-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #555;
  flex-wrap: wrap;
  gap: 8px;
}

.aro-active-label strong {
  color: #111;
}

.aro-result-count {
  font-size: 0.85rem;
  color: #777;
}

/* --- Contracts Table Wrapper --- */
.aro-contracts-wrap {
  overflow-x: auto;
  padding-top: 10px;
}

/* --- DataTables Overrides --- */
#aro-contracts-table {
  border-collapse: collapse;
  width: 100% !important;
}

#aro-contracts-table th,
#aro-contracts-table td {
  padding: 10px 14px;
  vertical-align: middle;
  font-size: 0.875rem;
  border-bottom: 1px solid #e8e8e8;
}

#aro-contracts-table thead th {
  background: #f5f5f5;
  font-weight: 700;
  color: #222;
  border-bottom: 2px solid #ccc;
  white-space: nowrap;
}

#aro-contracts-table tbody tr:hover td {
  background: #f9fbff;
}

/* Priority rows — subtle left accent */
#aro-contracts-table tbody tr.aro-priority td:first-child {
  border-left: 3px solid #0073aa;
}

/* Logo column */
.aro-col-logo {
  width: 90px;
  min-width: 70px;
}

.aro-logo-img {
  max-width: 70px;
  max-height: 50px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Column widths */
.aro-col-aro-cat {
  width: 22%;
}

.aro-col-product-cat {
  width: 30%;
}

.aro-col-contract-name {
  width: auto;
}

/* DataTables filter + length controls */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  font-size: 0.875rem;
  color: #555;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #0073aa !important;
  color: #fff !important;
  border-color: #0073aa !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .aro-category-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .aro-cat-btn {
    padding: 12px 8px;
    font-size: 0.78rem;
    min-height: 64px;
  }

  .aro-hero-title {
    font-size: 1.5rem;
  }

  #aro-contracts-table th,
  #aro-contracts-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .aro-category-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}
