/* Reset and Base Styles */
/* Note: Other stylesheets are loaded separately in the layout */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background-color: #f8fafc;
}

/* Header Styles */
.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.app-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0;
}

/* Loading Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-processing {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

/* Navigation */
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.nav-links a:hover {
  opacity: 0.8;
}

/* Navigation */
.nav-search {
    margin: 0 1rem;
    flex: 0 0 auto;
}

.nav-search-form {
    display: flex;
}

.nav-search-input {
    width: 220px;
    padding: .4rem .85rem;
    font-size: .9rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.nav-search-input:focus {
    width: 360px;
    outline: 2px solid #6b8dff;
}

/* Main Content */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Page Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 1rem;
}

.add-to-group-page-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 3rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: #718096;
  font-size: 1.1rem;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Cards and Content Blocks */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
}

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #2d3748;
  margin: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

thead, tfoot {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

th {
  font-weight: 600;
  color: #4a5568;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody tr:hover {
  background-color: #f7fafc;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #cbd5e0;
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.btn-outline {
  background: transparent;
  color: #007bff;
  border: 2px solid #007bff;
}

.btn-outline:hover {
  background: #007bff;
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  color: #4a5568;
  margin-top: 1rem;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Status Badges */
.badges-container {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge a  {
  text-decoration: none;
  color: inherit;
}

.badge-success {
  background: #c6f6d5;
  color: #22543d;
}

.badge-warning {
  background: #fef5e7;
  color: #744210;
}

.badge-danger {
  background: #fed7d7;
  color: #742a2a;
}

.badge-info {
  background: #bee3f8;
  color: #2a4365;
}

.badge-pending {
  background: #fef5e7;
  color: #744210;
}

.badge-processing {
  background: #bee3f8;
  color: #2a4365;
  animation: pulse-processing 2s infinite;
}

.badge-completed {
  background: #c6f6d5;
  color: #22543d;
}

.badge-failed {
  background: #fed7d7;
  color: #742a2a;
}

.badge-status {
  background: #bee3f8;
  color: #2a4365;
}

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

.badge-collection { background: #e3f2fd; color: #1976d2; }
.badge-project { background: #f3e5f5; color: #7b1fa2; }
.badge-folder { background: #fff3e0; color: #f57c00; }
.badge-curated { background: #e8f5e8; color: #388e3c; }
.badge-featured { background: #fff9c4; color: #f9a825; }
.badge-public { background: #e8f5e8; color: #388e3c; }


/* Page Layout */
.layout-row {
  display: flex;
  flex-direction: column; /* mobile: vertical */
  gap: 1rem;
}

.layout-section-two-thirds,
.layout-section-one-third-right,
.layout-section-one-third-left {
  width: 100%;
}

.section-card {
  background: rgba(255, 255, 255, 1);
  padding: 1rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

@media (min-width: 1024px) {
  .layout-row {
    flex-direction: row; /* desktop: horizontal */
    margin-right: 1rem;
  }

  .layout-section-two-thirds {
    flex: 0 0 66.6667%; /* two-thirds */
    max-width: 66.6667%;
    min-width: 0;  
  }

  .layout-section-one-third-right {
    flex: 0 0 33.3333%; /* one-third */
    margin-left: auto; /* pushes it to the right */
    max-width: 33.3333%;
    min-width: 0;
  }

  .layout-section-one-third-left {
    flex: 0 0 33.3333%; /* one-third */
    margin-right: auto; /* pushes content to the left */
    max-width: 33.3333%;
    min-width: 0;
    order: -1; /* ensures it appears first in flex order */
  }
}

  /* Table Layout */
  .data-table {
    box-shadow: none;
    border-radius: 0;
  }

  .data-table__actions-col {
    position: relative;
    width: 1%;
    white-space: nowrap;
  }

  .data-table__details-col {
    max-width: 350px;
    line-height: 1.4;
  }

  @media (max-width: 768px) {
    .data-table__details-col {
      max-width: 250px;
    }
  }

  .item-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .action-menu__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 1;
    transition: opacity 0.15s;
  }

  .data-table__row:hover .action-menu__trigger,
  .action-menu__trigger:focus {
    opacity: 1;
  }
  
  .table-cell-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
  }

  .action-menu__trigger::-webkit-details-marker { display: none; }
  .action-menu__trigger::marker { content: ""; }

  /* ---------------- dropdown list ---------------- */
  .action-menu__list {
    position: absolute;
    right: 100%;
    top: 0;
    margin: 0;
    margin-right: 0.5rem;
    padding: 0.5rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    z-index: 1000;
  }

  /* hide list when <details> is closed */
  .action-menu:not([open]) .action-menu__list {
    display: none;
  }

  /* menu items */
  .action-menu__link {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: #1e293b;
    font-size: 0.9rem;
  }

  .action-menu__link:hover {
    background: #f6f6f6;
  }

  .action-menu__item--danger .action-menu__link {
    color: #c00;
  }

  .action-menu__item--danger .action-menu__link:hover {
    background: #ffecec;
  }

/* Grid Layout */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Design Gallery */
.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.design-card,
.design-card-static {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #e2e8f0;
  position: relative;
  display: flex;
  flex-direction: column;
  height: auto;
}

.design-card:hover,
.design-card-static:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Fixed Image container with proper height constraint */
.design-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a0aec0;
  font-size: 0.9rem;
  flex-shrink: 0;
  aspect-ratio: unset !important;
}

.hero-design-image {
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: contain;
  border-radius: 8px;
}

.design-image-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

/* Proper image sizing */
.design-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.design-card:hover .design-preview-img,
.design-card-static:hover .design-preview-img {
  transform: scale(1.05);
}

.design-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  min-width: 1.5rem;
  max-width: 100%;
  width: 2.5rem;
  border-radius: 0.5rem;
}

.design-thumb.design-thumb-lg {
  width: 8rem;
}

/* Content area that doesn't overlap */
.design-content {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.design-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
  margin: 0;
  line-height: 1.3;
}

.design-title a {
  color: #2d3748;
  text-decoration: none;
  transition: color 0.2s ease;
}

.design-title a:hover {
  color: #007bff;
}

.design-meta {
  color: #718096;
  font-size: 0.9rem;
  margin: 0;
}

.design-description {
  color: #495057;
  line-height: 1.4;
  font-size: 0.9rem;
  margin: 0;
  flex-grow: 1;
}

.design-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

.design-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.design-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
}

.tag {
  background: #edf2f7;
  color: #4a5568;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Ensure placeholders fit properly */
.preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f8f9fa;
  color: #6c757d;
}

.placeholder-content {
  text-align: center;
  padding: 1rem;
}

.placeholder-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.placeholder-text {
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

.placeholder-subtext {
  font-size: 0.75rem;
  opacity: 0.8;
  display: block;
}

/* Status indicator positioning */
.preview-status {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.status-indicator {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
}

/* Design Collections Section */
.design-collections-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.design-collections-section h3 {
  margin: 0 0 1.5rem 0;
  color: #212529;
  font-size: 1.25rem;
  font-weight: 600;
}

.collections-list {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.collection-link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: #f8f9fa;
}

.collection-link-card:hover {
  border-color: #007bff;
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.collection-preview {
  flex-shrink: 0;
}

.collection-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e9ecef;
}

.collection-thumb-placeholder {
  width: 60px;
  height: 60px;
  background: #e9ecef;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #dee2e6;
}

.collection-icon {
  font-size: 1.5rem;
  opacity: 0.6;
}

.collection-info {
  flex: 1;
  min-width: 0;
}

.collection-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.collection-name-link {
  color: #212529;
  text-decoration: none;
  transition: color 0.2s ease;
}

.collection-name-link:hover {
  color: #007bff;
}

.collection-meta {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: #6c757d;
}

.collection-description {
  margin: 0;
  font-size: 0.875rem;
  color: #495057;
  line-height: 1.4;
}

.collection-actions {
  flex-shrink: 0;
}

.collection-actions-footer {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
  flex-wrap: wrap;
}

/* No Collections Section */
.no-collections-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.no-collections-content {
  max-width: 400px;
  margin: 0 auto;
}

.no-collections-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.no-collections-section h3 {
  margin: 0 0 0.75rem 0;
  color: #495057;
  font-size: 1.25rem;
}

.no-collections-section p {
  color: #6c757d;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.no-collections-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Alerts and Notices */
.notice {
  background: #c6f6d5;
  color: #22543d;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border-left: 4px solid #48bb78;
}

.alert {
  background: #fed7d7;
  color: #742a2a;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border-left: 4px solid #f56565;
}

.alert-danger {
  background: #fed7d7;
  color: #742a2a;
  border-left: 4px solid #f56565;
}

.alert h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

.alert ul {
  margin: 0;
  padding-left: 1.5rem;
}

/* Search Styles */
.search-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid #e2e8f0;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
}

.search-input-group {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  font-size: 1.1rem;
}

.search-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.search-results-count {
  color: #718096;
  font-size: 0.9rem;
}

.clear-search {
  color: #667eea;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.clear-search:hover {
  text-decoration: underline;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.active-filter {
  background: #667eea;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remove-filter {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 1rem;
}

/* Pagination Styles */
.pagination-wrapper {
  margin-top: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  min-width: 2.5rem;
  height: 2.5rem;
  border: 1px solid #dee2e6;
  background-color: #fff;
  color: #495057;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
}

.pagination-link:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
  color: #495057;
  text-decoration: none;
}

.pagination-link.current {
  background-color: #007bff;
  border-color: #007bff;
  color: #fff;
  cursor: default;
}

.pagination-link.disabled {
  background-color: #f8f9fa;
  border-color: #dee2e6;
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.65;
}

.pagination-prev,
.pagination-next {
  font-weight: 600;
  padding: 0.5rem 1rem;
}

.pagination-ellipsis {
  padding: 0.5rem 0.25rem;
  color: #6c757d;
  font-weight: 500;
  user-select: none;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6c757d;
  text-align: center;
}

/* Text Styles */
.description-text {
  margin: 0;
  color: #4b5563;
  font-size: 0.875rem;
  line-height: 1.4;
  font-style: italic;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Dark mode support */
/* DISABLED: to re-enable, edit the first line to be */
/* @media (prefers-color-scheme: dark) { */
  @media (prefers-color-scheme: dark) and (max-width: 0px) {
  body {
    background-color: #1a202c;
    color: #e2e8f0;
  }

  .card {
    background: #2d3748;
    border-color: #4a5568;
  }

  table {
    background: #2d3748;
  }

  thead {
    background: #4a5568;
  }

  th, td {
    border-color: #4a5568;
  }

  tbody tr:hover {
    background-color: #4a5568;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
  .hidden-mobile {
    display: none;
  }

  .header-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .nav-links {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Don't expand nav search input on mobile */
  .nav-search-input { width: 100%; max-width: none; }
  .nav-search-input:focus { width: 100%; }

  .main-container {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    justify-content: center;
  }

  .page-title {
    font-size: 1.5rem;
  }

  th, td {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .search-filters {
    grid-template-columns: 1fr;
  }

  .search-results-header {
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
  }

  .collection-link-card {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .collection-info {
    order: 1;
  }

  .collection-preview {
    order: 0;
  }

  .collection-actions {
    order: 2;
  }

  .collection-actions-footer {
    flex-direction: column;
    align-items: center;
  }

  .no-collections-actions {
    flex-direction: column;
    align-items: center;
  }

  .design-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }

  .design-image {
    height: 180px;
  }

  .repeat-checker-container {
    width: 95vw !important;
    max-height: 95vh !important;
  }
  
  #custom-repeat-image-container {
    text-align: center;
    margin: 0 auto;
    max-height: 500px;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    position: relative;
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
  }

  #custom-repeat-image-container {
    max-height: 300px;
  }
  
  #custom-repeat-image-container::before {
    content: "👆 Scroll to explore";
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    top: 5px;
    right: 5px;
  }
  
  .zoom-hint {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
  }

  .design-group-selector {
    min-width: 90vw;
    max-width: 95vw;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .selector-actions {
    flex-direction: column;
  }

  .derived-images-section .gallery-controls {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .derived-images-section .gallery-nav {
    justify-content: space-between;
  }
  
  .derived-images-section .gallery-view-controls {
    align-self: center;
  }
  
  .derived-images-section .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .derived-images-section .section-actions {
    justify-content: center;
  }

  #custom-repeat-checker-modal .repeat-image-wrapper img {
    max-width: 95vw;
    max-height: 80vh;
  }
  
  #custom-repeat-checker-modal .repeat-instructions {
    bottom: -40px;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    max-width: 90%;
    white-space: normal;
  }
  
  #custom-repeat-checker-modal .zoom-container {
    padding-bottom: 50px;
  }

  .design-show-container {
    padding: 1rem;
  }

  .design-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .semantic-filters {
    grid-template-columns: 1fr;
  }
  
  .search-actions {
    flex-direction: column;
  }
  
  .search-btn {
    width: 100%;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .reference-design-card {
    flex-direction: column;
  }
  
  .reference-image {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
  
  .no-results-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .search-info {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 767px) {
  .pagination {
    gap: 0.25rem;
  }

  .pagination-link {
    padding: 0.375rem 0.5rem;
    min-width: 2rem;
    height: 2rem;
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .design-collections-section,
  .no-collections-section {
    padding: 1.5rem 1rem;
    margin: 1rem 0;
  }

  .collection-thumb,
  .collection-thumb-placeholder {
    width: 50px;
    height: 50px;
  }

  .collection-icon {
    font-size: 1.25rem;
  }

  .design-show-container {
    padding: 0.5rem;
  }
}

@media (min-width: 769px) {
  .hidden-desktop {
    display: none;
  }
}
/* =================== END Responsive Design =====================*/

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex !important;  /* Use flex instead of block for centering */
  opacity: 1 !important;
}

/* ------------------ Design Detail Shared Styles ------------ */

.design-show-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header Section */
.design-header-content {
  flex: 1;
}

.breadcrumb-link {
  color: #6c757d;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  transition: color 0.2s ease;
}

.breadcrumb-link:hover {
  color: #007bff;
}

.design-header {
  flex-direction: column;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

/* Image Section */
.design-image-container {
  position: relative;
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.text-muted {
  color: #6c757d;
}

.info-item {
  margin-bottom: 1rem;
}

.info-item strong {
  color: #495057;
  display: block;
  margin-bottom: 0.25rem;
}

.design-info-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  height: fit-content;
  margin-bottom: 2rem;
  overflow-x: wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.design-info-card h3 {
  margin: 0 0 1.5rem 0;
  color: #212529;
  font-size: 1.5rem;
}

.design-info-card h4 {
  margin: 1.5rem 0 1rem 0;
  color: #495057;
  font-size: 1.2rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.property-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.property-label {
  font-weight: 500;
  color: #495057;
}

.file-size, .file-type {
  font-size: 0.875rem;
  color: #6c757d;
  word-break: keep-all;
  white-space: nowrap;
}

.group-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.group-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ========================= DESIGN GROUP STYLES ========================== */
.design-groups-toolbar {
  position: fixed; 
  bottom: 7.5rem; 
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #0d6efd; 
  color: #fff;
  border-radius: 20px; 
  padding: 1rem 1.5rem;
  box-shadow: 0 12px 40px rgba(13,110,253,.3);
  min-width: 320px; 
  opacity: 0; 
  visibility: hidden;
  pointer-events: none; 
  transition: all .3s ease;
}

.design-groups-toolbar.visible {
  opacity: 1; 
  visibility: visible; 
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.design-group-selector {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: white;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  min-width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  display: none;
  opacity: 0;
  transition: all 0.3s ease;
}

.design-group-selector.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.selector-header h3 {
  margin: 0;
  color: #212529;
  font-size: 1.25rem;
  font-weight: 600;
}

.close-selector {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6c757d;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-selector:hover {
  background: #e9ecef;
  color: #495057;
}

/* Modal Content */
.selector-options {
  padding: 1.5rem;
}

.option-group {
  border: 2px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.option-group:hover {
  border-color: #007bff;
}

.radio-option {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  margin: 0;
}

.radio-option input[type="radio"] {
  margin-right: 0.75rem;
  cursor: pointer;
}

.option-label {
  font-weight: 600;
  color: #495057;
  cursor: pointer;
  margin: 0;
}

.option-content {
  padding: 1rem;
  background: white;
}

.existing-group-content,
.new-group-content {
  display: block;
}

.new-group-content {
  display: none;
}

/* Form styling within modal */
.selector-options .form-group {
  margin-bottom: 1rem;
}

.selector-options .form-label {
  display: block;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.selector-options .form-control {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.selector-options .form-control:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ========================= FORM STYLES ========================== */

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
}

.form-label.required::after {
  content: ' *';
  color: #dc3545;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.checkbox-label {
  margin: 0;
  cursor: pointer;
  font-weight: 500;
  color: #495057;
}

/* Modal Actions */
.selector-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding: 1.5rem;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 0 0 12px 12px;
}

/* Body modal state */
body.modal-open {
  overflow: hidden;
}

/* Selection styles */
.design-card.selected,
.design-card-static.selected {
  border: 3px solid #007bff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 123, 255, 0.2) !important;
}

.design-card.selected .design-image::after,
.design-card-static.selected .design-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 123, 255, 0.1);
  pointer-events: none;
}

.design-card.selection-mode,
.design-card-static.selection-mode {
  cursor: pointer;
}

.checkbox-container { 
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 8px;
  transition: 0.2s;
  opacity: 0;
  backdrop-filter: blur(2px);
}

.design-checkbox {
  width: 20px;
  height: 20px;
  margin: 0px;
  cursor: pointer;
  accent-color: rgb(0, 123, 255);
}

.design-card.selection-mode .checkbox-container,
.design-card-static.selection-mode .checkbox-container {
  opacity: 1 !important;
}

/* Core tag badge */
.tag-link {
  display: inline-block;
  margin: 0 0.25rem 0.25rem 0;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 600;
  color: #3A2B45;
  background-color: #EFEAF7;
  border: 1px solid #D7CDEB;
  border-radius: 9999px;
  text-decoration: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

/* Hover / focus state */
.tag-link:hover,
.tag-link:focus {
  background-color: #E4DEEF;
  color: #0b4120;
  box-shadow: 0 0 0 2px rgba(21, 87, 36, 0.25);
  text-decoration: none;
}

/* Active (mousedown) */
.tag-link:active {
  background-color: #DAD2E7;
  border-color: #BEB1D3;
}

/* Searchable Table Styles */
.searchable-table-container {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

  /* ==========================================================================
     CONTENT TABS
     ========================================================================== */
  
  .content-tabs {
    margin-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .tab-buttons {
    display: flex;
    gap: 1rem;
  }
  
  .tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
  }
  
  .tab-btn:hover {
    color: #007bff;
  }
  
  .tab-content {
    display: none;
  }
  
  .tab-content.active {
    display: block;
  }

/* ==========================================================================
   DERIVED IMAGES GALLERY COMPONENT - Added directly to application.css
   ========================================================================== */

  .derived-images-section {
    margin: 2rem 0;
  }

  /* Gallery focus indicator */
  .derived-images-section:focus {
    outline: 3px solid #007bff;
    outline-offset: 3px;
    border-radius: 8px;
    background-color: rgba(0, 123, 255, 0.02);
  }

  /* Show that gallery is clickable */
  .derived-images-section[tabindex="0"] {
    cursor: pointer;
  }

  /* Remove focus from buttons when gallery is focused */
  .derived-images-section:focus button {
    outline: none;
  }
  
  .derived-images-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
  }
  
  .derived-images-section .section-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 600;
  }
  
  .derived-images-section .section-actions {
    display: flex;
    gap: 0.5rem;
  }
  
  /* Gallery Controls */
  .derived-images-section .gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
  }
  
  .derived-images-section .gallery-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  
  .derived-images-section .gallery-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .derived-images-section .gallery-nav-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
  }
  
  .derived-images-section .gallery-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  .derived-images-section .gallery-position {
    font-size: 0.875rem;
    color: #6c757d;
    min-width: 80px;
    text-align: center;
  }
  
  .derived-images-section .gallery-view-controls {
    display: flex;
    gap: 2px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
  }
  
  .derived-images-section .view-size-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .derived-images-section .view-size-btn:hover {
    background: #e9ecef;
    color: #495057;
  }
  
  .derived-images-section .view-size-btn.active {
    background: #007bff;
    color: white;
  }
  
  /* Gallery Container */
  .derived-images-section .gallery-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .derived-images-section .gallery-track {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    gap: 1rem;
    padding: 1rem;
    width: auto !important;
  }
  
  /* Gallery Items */
  .derived-images-section .gallery-item {
    flex-shrink: 0;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  
  .derived-images-section .gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #007bff;
  }
  
  .derived-images-section .gallery-item:hover .thumbnail-image {
    transform: scale(1.05) !important;
  }
  
  /* Size variations - THE IMPORTANT PART */
  .derived-images-section .gallery-container.size-small .gallery-item {
    width: 120px !important;
    max-width: 120px !important;
    min-width: 120px !important;
  }
  
  .derived-images-section .gallery-container.size-small .gallery-thumbnail {
    height: 80px !important;
    width: 120px !important;
  }
  
  .derived-images-section .gallery-container.size-medium .gallery-item {
    width: 160px !important;
    max-width: 160px !important;
    min-width: 160px !important;
  }
  
  .derived-images-section .gallery-container.size-medium .gallery-thumbnail {
    height: 120px !important;
    width: 160px !important;
  }
  
  .derived-images-section .gallery-container.size-large .gallery-item {
    width: 200px !important;
    max-width: 200px !important;
    min-width: 200px !important;
  }
  
  .derived-images-section .gallery-container.size-large .gallery-thumbnail {
    height: 160px !important;
    width: 200px !important;
  }
  
  /* Default to medium */
  .derived-images-section .gallery-container:not([class*="size-"]) .gallery-item {
    width: 160px !important;
    max-width: 160px !important;
    min-width: 160px !important;
  }
  
  .derived-images-section .gallery-container:not([class*="size-"]) .gallery-thumbnail {
    height: 120px !important;
    width: 160px !important;
  }
  
  .derived-images-section .gallery-thumbnail {
    position: relative;
    background: #f8f9fa;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
  }
  
  .derived-images-section .thumbnail-link {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
  }
  
  .derived-images-section .thumbnail-image {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.2s ease;
    aspect-ratio: unset !important;
  }
  
  /* Override any conflicting design-image styles */
  .derived-images-section .gallery-item .thumbnail-image {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    aspect-ratio: unset !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
  }
  
  /* Status badges and other elements */
  .derived-images-section .status-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .derived-images-section .status-badge.status-completed {
    background: #28a745;
    color: white;
  }
  
  .derived-images-section .status-badge.status-processing {
    background: #007bff;
    color: white;
  }
  
  .derived-images-section .status-badge.status-failed {
    background: #dc3545;
    color: white;
  }
  
  .derived-images-section .status-badge.status-pending {
    background: #ffc107;
    color: #212529;
  }
  
  .derived-images-section .gallery-item-info {
    padding: 0.75rem;
  }
  
  .derived-images-section .gallery-item-info h5 {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    line-height: 1.2;
  }
  
  .derived-images-section .item-meta {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    font-size: 0.75rem;
    color: #6c757d;
  }
  
  /* Placeholders and empty states */
  .derived-images-section .thumbnail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    color: #6c757d;
    font-size: 0.75rem;
  }
  
  .derived-images-section .thumbnail-placeholder.processing {
    color: #007bff;
  }
  
  .derived-images-section .thumbnail-placeholder.failed {
    color: #dc3545;
  }
  
  .derived-images-section .thumbnail-placeholder.pending {
    color: #ffc107;
  }
  
  .derived-images-section .no-derived-images {
    padding: 3rem 2rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
  }
  
  .derived-images-section .empty-state-content {
    max-width: 300px;
    margin: 0 auto;
  }
  
  .derived-images-section .empty-state-content h4 {
    margin: 0 0 0.5rem 0;
    color: #495057;
  }
  
  .derived-images-section .empty-state-content p {
    margin: 0 0 1.5rem 0;
    color: #6c757d;
    font-size: 0.875rem;
  }
  
  .derived-images-section .empty-actions {
    display: flex;
    justify-content: center;
  }
  
  /* Animations */
  .derived-images-section .spinner,
  .derived-images-section .mini-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  .derived-images-section .mini-spinner {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
  }

   /* Upload Wizard Modal Styles */
   .upload-wizard-container {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  }

  .wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
  }

  .wizard-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
  }

  .close-wizard {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
  }

  .wizard-content {
    padding: 2rem;
  }

  .wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
  }

  /* Step 2: Image Layout */
  .derived-images-container {
    margin-bottom: 2rem;
  }

  .image-main {
    flex: 1;
  }

  .image-quarters {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .image-quarter {
    flex: 1;
  }

  .image-placeholder {
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 8px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 140px;
  }

  .image-placeholder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
  }

  /* Upload wizard specific spinners */
  .upload-wizard-container .spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin: 1rem auto;
    display: block;
  }

  /* Small spinners for status indicators */
  .mini-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
  }

  /* Spinner animation */
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  /* Spinner container - centers spinner and removes text */
  .spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
  }

  /* Hide any text inside spinners */
  .spinner:not(:empty) {
    text-indent: -9999px;
    overflow: hidden;
  }

  /* Custom repeat checker container enhancements */

  #custom-repeat-image-container img {
    display: block;
    max-width: none; /* Allow image to be larger than container */
    height: auto;
    margin: 0;
    /* Remove max-width: 100% to allow full-size image */
  }

  #custom-repeat-image-container svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
  }

  #custom-repeat-image-container:hover svg {
    opacity: 1;
  }
  
  /* Scrollbar styling for better UX */
  #custom-repeat-image-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  
  #custom-repeat-image-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
  }
  
  #custom-repeat-image-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
  }
  
  #custom-repeat-image-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
  
  /* Add scroll indicators */
  #custom-repeat-image-container::before {
    content: "📜 Scroll to explore the full image";
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
  }
  
  /* Hide scroll hint after user starts scrolling */
  #custom-repeat-image-container.scrolled::before {
    opacity: 0;
  }

  /* Loading states for upload wizard */
  .upload-wizard-container .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 1rem;
  }

  .upload-wizard-container .loading-state .spinner {
    margin-bottom: 0.5rem;
  }

  .upload-wizard-container .loading-state .loading-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
  }

  /* Image placeholder with spinner */
  .image-loading {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    min-height: 200px;
  }

  .image-loading .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  /* Wizard Controls */
  .wizard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
  }

  .controls-right {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Zoom Modal */
  .zoom-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
  }

  .zoom-container img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
  }

  .close-zoom {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
  }

  /* Repeat Checker Modal */
  .repeat-checker-container {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
  }

  .repeat-checker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
  }

  .repeat-checker-content {
    padding: 1.5rem;
  }

  .repeat-image-container {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
  }

  .repeat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  .repeat-checker-actions {
    margin-top: 1rem;
    text-align: center;
  }

  .modal-overlay.active .upload-wizard-container {
    background: white !important;
    border-radius: 12px !important;
    max-width: 900px !important;
    width: 90vw !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .modal-overlay.active .wizard-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1.5rem 2rem !important;
    border-bottom: 1px solid #e0e0e0 !important;
    background: white !important;
    margin: 0 !important;
  }
  
  .modal-overlay.active .wizard-header h3 {
    margin: 0 !important;
    font-size: 1.5rem !important;
    color: #333 !important;
  }
  
  .modal-overlay.active .close-wizard {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    color: #666 !important;
    padding: 0.5rem !important;
  }
  
  .modal-overlay.active .wizard-content {
    padding: 2rem !important;
    background: white !important;
  }
  
  .modal-overlay.active .wizard-actions {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 2rem !important;
    padding-top: 1.5rem !important;
    border-top: 1px solid #e0e0e0 !important;
  }

  /* ============================================================================
   CHECKBOX ENHANCEMENTS - Add to your application.css
   ============================================================================ */

/* Enhanced checkbox styling for upload wizard */
.upload-wizard-container .checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  background: #f8f9fa;
  margin-bottom: 0.5rem;
}

.upload-wizard-container .checkbox-group:hover {
  background: #e9ecef;
}

.upload-wizard-container .checkbox-group input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  transform: scale(1.2);
}

.upload-wizard-container .checkbox-group label {
  margin: 0;
  cursor: pointer;
  font-weight: 500;
  color: #495057;
  user-select: none;
}

/* Visual states for checked checkboxes */
.upload-wizard-container .checkbox-group input[type="checkbox"]:checked + label,
.upload-wizard-container .checkbox-group:has(input[type="checkbox"]:checked) {
  color: #007bff;
  font-weight: 600;
}

.upload-wizard-container .checkbox-group:has(input[type="checkbox"]:checked) {
  background: #e3f2fd;
  border-color: #90caf9;
}

/* Seamlessly repeats - positive styling */
.upload-wizard-container .checkbox-group:has(#seamlessly-repeats:checked) {
  background: #e8f5e8;
  border-color: #81c784;
}

.upload-wizard-container .checkbox-group:has(#seamlessly-repeats:checked) label {
  color: #2e7d32;
}

/* Flag non-repeating - warning styling */
.upload-wizard-container .checkbox-group:has(#flag-non-repeating:checked) {
  background: #fff3e0;
  border-color: #ffb74d;
}

.upload-wizard-container .checkbox-group:has(#flag-non-repeating:checked) label {
  color: #f57c00;
}

/* Add some helpful text */
.upload-wizard-container .checkbox-help {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #dee2e6;
}

.upload-wizard-container .checkbox-help.seamless-help {
  border-left-color: #28a745;
  background: #e8f5e8;
  color: #155724;
}

.upload-wizard-container .checkbox-help.flag-help {
  border-left-color: #ffc107;
  background: #fff3e0;
  color: #856404;
}

#custom-repeat-checker-modal .repeat-image-wrapper {
  position: relative;
  display: inline-block; /* This makes the container size to its content (the image) */
}

#custom-repeat-checker-modal .repeat-image-wrapper img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  width: auto;
  height: auto;
}

#custom-repeat-checker-modal .repeat-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#custom-repeat-checker-modal .repeat-instructions {
  position: absolute;
  bottom: -50px; /* Position below the image container */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
  max-width: 400px;
  z-index: 10;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

#custom-repeat-checker-modal .zoom-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding-bottom: 60px; /* Make room for instructions below */
}

/* ==========================================================================
   SEMANTIC SEARCH STYLES
   ========================================================================== */

/* Help Section */
.search-help {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.search-help h3 {
  color: #075985;
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
}

.help-content p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #0c4a6e;
}

.help-actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-help-toggle {
  background: none;
  border: 1px solid #0ea5e9;
  color: #0ea5e9;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-help-toggle:hover {
  background: #0ea5e9;
  color: white;
}

.search-help.hidden .help-content {
  display: none;
}

/* Search Form - Updated Layout */
.semantic-search-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.semantic-search-input {
  width: 100%;
  font-size: 1.1rem;
  padding: 1rem 1rem 1rem 4.5rem;
  border-radius: 12px;
  border: 3px solid #e2e8f0;
  background: linear-gradient(to right, #f8fafc, #ffffff);
  transition: all 0.3s ease;
}

.semantic-search-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
  background: white;
  outline: none;
}

.semantic-search-icon {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: #667eea;
  font-size: 1.2rem;
}

.search-btn {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  transition: all 0.3s ease;
  cursor: pointer;
  font-weight: 600;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.search-btn:disabled {
  transform: none;
  opacity: 0.7;
  cursor: not-allowed;
}

/* Search Filters - now below search button */
.semantic-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* Search Info */
.search-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding: 1rem;
  background: #f1f5f9;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.search-query {
  font-weight: 600;
  color: #334155;
}

.search-time {
  font-size: 0.875rem;
  color: #64748b;
}

.search-type-info {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #0ea5e9;
  border-radius: 6px;
  padding: 0.75rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: #0c4a6e;
  text-align: center;
}

/* Results Grid */
.results-section {
  margin-top: 2rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.result-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

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

.design-preview {
  max-width: 100%;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.result-card:hover .design-preview {
  transform: scale(1.05);
}

.no-preview {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-weight: 500;
}

.similarity-score {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.result-info {
  padding: 1rem;
}

.result-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  line-height: 1.3;
}

.result-title a {
  color: #1e293b;
  text-decoration: none;
  font-weight: 600;
}

.result-title a:hover {
  color: #667eea;
}

.result-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.designer-tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: #f0fdf4;
  color: #166534;
}

.season-tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: #fef7cd;
  color: #92400e;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-outline-primary {
  border: 1px solid #667eea;
  color: #667eea;
  background: transparent;
}

.btn-outline-primary:hover {
  background: #667eea;
  color: white;
}

.btn-outline-secondary {
  border: 1px solid #64748b;
  color: #64748b;
  background: transparent;
}

.btn-outline-secondary:hover {
  background: #64748b;
  color: white;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.no-results i {
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.no-results h3 {
  color: #475569;
  margin-bottom: 1rem;
}

.no-results-suggestions {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
  text-align: left;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.no-results-suggestions h4 {
  color: #475569;
  margin-bottom: 1rem;
}

.no-results-suggestions ul {
  list-style: none;
  padding: 0;
}

.no-results-suggestions li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.no-results-suggestions li:last-child {
  border-bottom: none;
}

.no-results-suggestions li:before {
  content: "💡";
  margin-right: 0.5rem;
}

/* Reference Design (Similar page) */
.reference-design-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 2px solid #e2e8f0;
}

.reference-design-section h3 {
  color: #475569;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.reference-design-card {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.reference-image {
  flex-shrink: 0;
  width: 200px;
  min-height: 150px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.reference-preview {
  max-width: 100%;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.reference-info {
  flex: 1;
}

.reference-title {
  color: #1e293b;
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.reference-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.reference-description {
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

/* Similar Results */
.similar-results-section {
  margin-top: 2rem;
}

.similar-results-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.similar-results-header h3 {
  color: #334155;
  margin-bottom: 0.5rem;
}

.results-count {
  color: #64748b;
  margin: 0;
}

.no-similar-results {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.no-similar-results i {
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.no-similar-results h3 {
  color: #475569;
  margin-bottom: 1rem;
}

.no-results-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.logo-preview {
  border: 1px solid black;
  min-width: 75px;
  min-height: 75px;
  max-height: 75px;
}

.logo-preview-small {
  border: 1px solid black;
  min-width: 50px;
  min-height: 50px;
  max-height: 50px;
}
