/**
 * Congeries Collection Display Styles
 */

.congeries-collection-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Filter Bar */
.congeries-filters {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 30px;
}

.congeries-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.congeries-view-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
  padding-right: 12px;
  border-right: 1px solid #dee2e6;
}

.congeries-view-switcher label {
  font-weight: 500;
  margin-right: 8px;
  margin-bottom: 0;
}

.congeries-search {
  flex: 1;
  min-width: 200px;
}

.congeries-search-input {
  border-radius: 4px;
}

.congeries-filter {
  flex: 0 1 200px;
}

.congeries-filter select {
  border-radius: 4px;
}

.congeries-btn-add-new {
  white-space: nowrap;
}

/* Results Section */
.congeries-results {
  margin-bottom: 30px;
}

.congeries-empty {
  text-align: center;
  padding: 40px 20px;
  background: #f8f9fa;
  border-radius: 4px;
  color: #6c757d;
  font-size: 16px;
}

/* List View */
.congeries-view-list .congeries-table {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  overflow: hidden;
}

.congeries-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
}

.congeries-table th {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  border: none;
  color: #495057;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.congeries-table td {
  padding: 12px;
  vertical-align: middle;
  border: none;
  border-top: 1px solid #dee2e6;
}

.congeries-table tbody tr:hover {
  background-color: #f8f9fa;
}

.congeries-make-model strong {
  color: #0d6efd;
  display: block;
  margin-bottom: 4px;
}

.congeries-make-model small {
  color: #6c757d;
}

.congeries-item-row {
  transition: background-color 0.2s ease;
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  font-weight: 500;
  display: inline-block;
}

/* Grid View */
.congeries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.congeries-card {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.congeries-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: #0d6efd;
}

.congeries-card-image {
  width: 100%;
  height: 200px;
  background: #f8f9fa;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.congeries-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.congeries-card-image.placeholder {
  background: linear-gradient(135deg, #f5f6f7 25%, #f8f9fa 25%, #f8f9fa 50%, #f5f6f7 50%, #f5f6f7 75%, #f8f9fa 75%);
  background-size: 20px 20px;
  color: #ccc;
  font-size: 48px;
}

.congeries-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.congeries-card-title {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #212529;
  line-height: 1.3;
}

.congeries-card-model {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #6c757d;
}

.congeries-card-meta {
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.congeries-card-location {
  margin: 8px 0 12px 0;
  font-size: 13px;
  color: #495057;
  flex-grow: 1;
}

.congeries-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.congeries-card-actions .btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
}

/* Hierarchy View */
.congeries-hierarchy {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 16px;
}

.congeries-tree-node {
  margin: 4px 0;
}

.congeries-tree-node-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.congeries-tree-node-label:hover {
  background-color: #f8f9fa;
}

.congeries-tree-toggle {
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.congeries-tree-toggle.collapsed {
  transform: rotate(-90deg);
}

.congeries-tree-spacer {
  width: 20px;
  display: inline-block;
}

.congeries-tree-children {
  margin-left: 12px;
  border-left: 2px solid #dee2e6;
  padding-left: 8px;
}

/* Pagination */
.congeries-pagination {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.pagination {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-item .page-link {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  background: white;
  color: #0d6efd;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.page-item .page-link:hover:not(.disabled) {
  background: #0d6efd;
  color: white;
}

.page-item.active .page-link {
  background: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.page-item.disabled .page-link {
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.5;
}

.congeries-pagination-info {
  text-align: center;
  color: #6c757d;
  font-size: 13px;
  margin-top: 16px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  background: white;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  overflow-y: auto;
  max-width: 900px;
  width: 95%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #dee2e6;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
}

.close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #495057;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close:hover {
  color: #212529;
}

/* Buttons */
.btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.btn-primary:hover {
  background: #0b5ed7;
  border-color: #0a58ca;
}

.btn-primary.active,
.btn-primary.show {
  background: #0b5ed7;
  border-color: #0a58ca;
}

.btn-outline-primary {
  border-color: #0d6efd;
  color: #0d6efd;
  background: white;
}

.btn-outline-primary:hover {
  background: #0d6efd;
  color: white;
}

.btn-warning {
  background: #ffc107;
  color: #212529;
  border-color: #ffc107;
}

.btn-warning:hover {
  background: #ffbb2d;
  border-color: #ffa500;
}

.btn-success {
  background: #198754;
  color: white;
  border-color: #198754;
}

.btn-success:hover {
  background: #157347;
  border-color: #146c43;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Utility classes */
.badge-info {
  background: #0d6efd;
  color: white;
}

.badge-secondary {
  background: #6c757d;
  color: white;
}

.badge-danger {
  background: #dc3545;
  color: white;
}

.badge-warning {
  background: #ffc107;
  color: #212529;
}

.badge-success {
  background: #198754;
  color: white;
}

.badge-light {
  background: #f8f9fa;
  color: #212529;
  border: 1px solid #dee2e6;
}

/* Error message */
.congeries-error {
  background: #f8d7da;
  color: #721c24;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid #f5c6cb;
  margin: 16px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .congeries-filter-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .congeries-view-switcher,
  .congeries-search,
  .congeries-filter,
  .congeries-btn-add-new {
    width: 100%;
  }
  
  .congeries-view-switcher {
    border-right: none;
    border-bottom: 1px solid #dee2e6;
    padding-right: 0;
    padding-bottom: 12px;
  }
  
  .congeries-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  
  .congeries-table {
    font-size: 13px;
  }
  
  .congeries-table th,
  .congeries-table td {
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .congeries-collection-wrapper {
    padding: 10px;
  }
  
  .congeries-filters {
    padding: 12px;
  }
  
  .congeries-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-dialog {
    width: 100%;
  }
}
