/* ================================
   Utility Classes & Reusable Styles
   ================================ */

/* Info Box / Legend Box - Used in admin pages */
.info-box,
.legend-box {
  background-color: #f0f7ff;
  border-left: 4px solid #3366cc;
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.info-box.warning {
  background-color: #fff7f0;
  border-left-color: #cc6633;
}

.info-box.success {
  background-color: #f0fff7;
  border-left-color: #33cc66;
}

.info-box.error {
  background-color: #fff0f0;
  border-left-color: #cc3333;
}

.info-box strong {
  display: block;
  margin-bottom: 8px;
}

.info-box ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

/* Flex helpers */
.flex-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.flex-row.flex-center {
  align-items: center;
}

.flex-row.flex-between {
  justify-content: space-between;
}

.flex-row.flex-wrap {
  flex-wrap: wrap;
}

.flex-row > input,
.flex-row > button,
.flex-row > select {
  flex: 1;
}

.flex-row > button.remove-btn {
  flex: none;
  padding: 10px 15px;
}

/* Document icons in tables */
.doc-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 16px;
  cursor: help;
}

.doc-icon:last-child {
  margin-right: 0;
}

.no-docs {
  color: var(--muted);
  font-size: 12px;
}

/* Spacing utilities */
.mb-5 {
  margin-bottom: 5px;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-15 {
  margin-bottom: 15px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-5 {
  margin-top: 5px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-15 {
  margin-top: 15px;
}

.mt-20 {
  margin-top: 20px;
}

/* Text utilities */
.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

.text-small {
  font-size: 12px;
}

.text-strong {
  font-weight: 600;
}

/* Visibility */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Button groups in forms */
.button-group {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.button-group .btn {
  flex: 1;
}

/* Code styling within help text */
.form-help code {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #c7254e;
}

/* Max width helpers */
.max-w-200 {
  max-width: 200px;
}

.max-w-300 {
  max-width: 300px;
}

.max-w-500 {
  max-width: 500px;
}

/* Border radius helpers */
.rounded {
  border-radius: 4px;
}

.rounded-lg {
  border-radius: var(--radius);
}

.rounded-xl {
  border-radius: var(--radius-lg);
}

/* Image thumbnail */
.thumbnail,
.comp-thumbnail {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  object-fit: cover;
}

.thumbnail.small {
  max-width: 100px;
  max-height: 100px;
}

.thumbnail.medium {
  max-width: 200px;
  max-height: 200px;
}

.thumbnail.large {
  max-width: 400px;
  max-height: 400px;
}

/* List helpers */
.no-margin {
  margin: 0;
}

.no-padding {
  padding: 0;
}

ul.clean-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.clean-list li {
  margin-bottom: 8px;
}

/* Grid helpers */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ================================
   Admin Table Styles
   ================================ */

/* Table thumbnails and images */
.comp-thumbnail,
.table-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.no-image {
  color: #999;
  font-style: italic;
}

/* Documents cell */
.documents-cell {
  text-align: center;
}

.doc-icon {
  display: inline-block;
  font-size: 1.2em;
  margin: 0 2px;
  cursor: help;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 500;
}

.badge-primary {
  background: #007bff;
  color: white;
}

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

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

.badge-info {
  background: #17a2b8;
  color: white;
}

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

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

/* Admin table specific */
.admin-table td {
  vertical-align: middle;
}

.admin-table small {
  color: #666;
  font-size: 0.85em;
}

.admin-table code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  color: #c7254e;
}

/* Group-specific styles */
.group-name-with-color {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-badge {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #ddd;
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-state p {
  margin-bottom: 20px;
  font-size: 1.1em;
}

/* Form centered alignment */
.form-centered {
  margin-left: auto;
  margin-right: auto;
  max-width: 600px;
  text-align: center;
}

.form-centered .form-group label {
  text-align: left;
  display: block;
}

.form-centered .form-group input,
.form-centered .form-group select,
.form-centered .form-group textarea {
  width: 100%;
}

/* Center header when form is centered */
.admin-section:has(.form-centered) .section-header,
.admin-content:has(.form-centered) .admin-header {
  text-align: center;
  justify-content: center;
}

.admin-section:has(.form-centered) .section-header h1,
.admin-content:has(.form-centered) .admin-header h1 {
  margin-left: auto;
  margin-right: auto;
}

/* Custom checkbox styling */
.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: normal;
  margin-bottom: 0;
}

.form-group input[type="checkbox"] {
  width: auto;
  accent-color: var(--cpar-blue-700);
  cursor: pointer;
}

/* Toggle switch style */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  vertical-align: middle;
  margin-right: 10px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--cpar-blue-700);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(26px);
}

/* Form group with toggle */
.form-group:has(.toggle-switch) {
  display: flex;
  align-items: center;
  gap: 0;
}

