@import url("../leather-seam-asset-path.css");

/* Fandoms Search Page Styles - Enhanced Design */

/* Reduce main-content padding on the fandoms page so more grid is visible */
.main-content {
  padding: 10px 14px !important;
}

/* Make fandoms-content the scroll container so it works within the
   fixed-height main-content flex layout. Without min-height:0 the flex
   item cannot shrink below its content size and content overflows the
   viewport instead of scrolling. */
#fandoms-content {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Loading state */
.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: fandoms-spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* Page Header — compact so the grid is visible without scrolling */
.page-header {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border: 3px solid #e9ecef;
  border-radius: 16px;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.08),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.04);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.header-icon .material-icons {
  font-size: 1.5rem !important;
}

.header-text h1 {
  margin: 0 0 0.1rem 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #2c3e50;
}

.header-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: #6c757d;
  line-height: 1.3;
}

/* Search and Filter Section — inline row layout to save vertical space */
.search-filter-section {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border: 3px solid #e9ecef;
  border-radius: 14px;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.06),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: #667eea;
  font-size: 1.2rem;
  pointer-events: none;
  z-index: 1;
}

#fandoms-search {
  width: 100%;
  padding: 8px 12px 8px 40px;
  font-size: 0.9rem;
  border-radius: 16px;
  border: 1px solid #9aa8bc;
  background-color: #f3f6fb;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.35) 28%, transparent 48%),
    linear-gradient(180deg, #fbfdff 0%, #e8eef8 52%, #dce6f2 100%);
  background-blend-mode: normal, normal;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.75),
    0 3px 12px rgba(0, 0, 0, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 2px 6px rgba(255, 255, 255, 0.95),
    inset 0 -3px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  color: #1a1a1a;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#fandoms-search:focus {
  outline: none;
  border-color: #4a90d9;
  background-color: #fafdff;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.45) 30%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #eef6ff 48%, #dfeaf8 100%);
  box-shadow:
    0 0 0 3px rgba(74, 144, 217, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.85),
    0 4px 14px rgba(0, 0, 0, 0.12),
    inset 0 2px 7px rgba(255, 255, 255, 1),
    inset 0 -3px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}

.clear-search-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.search-filter-section .search-wrapper {
  flex: 1;
  width: auto;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sort-label {
  font-family: 'Baloo 2', cursive;
  font-weight: 600;
  color: #495057;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.sort-select {
  padding: 7px 12px;
  padding-right: 2.25rem;
  font-size: 0.85rem;
  border-radius: 14px;
  border: 1px solid #9aa8bc;
  -webkit-appearance: none;
  appearance: none;
  background-color: #f3f6fb;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%235a6a82' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.35) 28%, transparent 48%),
    linear-gradient(180deg, #fbfdff 0%, #e8eef8 52%, #dce6f2 100%);
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-size: 14px 14px, 100% 100%, 100% 100%;
  background-position: calc(100% - 12px) 50%, 0 0, 0 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.75),
    0 3px 12px rgba(0, 0, 0, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 2px 6px rgba(255, 255, 255, 0.95),
    inset 0 -3px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  color: #1a1a1a;
  min-width: 180px;
}

.sort-select:focus {
  outline: none;
  border-color: #4a90d9;
  background-color: #fafdff;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%234a90d9' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.45) 30%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #eef6ff 48%, #dfeaf8 100%);
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-size: 14px 14px, 100% 100%, 100% 100%;
  background-position: calc(100% - 12px) 50%, 0 0, 0 0;
  box-shadow:
    0 0 0 3px rgba(74, 144, 217, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.85),
    0 4px 14px rgba(0, 0, 0, 0.12),
    inset 0 2px 7px rgba(255, 255, 255, 1),
    inset 0 -3px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.sort-select:hover {
  border-color: #7a8faf;
}

/* Experimental Feature Message */
.experimental-feature-message {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(145deg, #fff3cd, #ffeeba);
  border: 3px solid #ffc107;
  border-radius: 20px;
  box-shadow: 
    0 6px 12px rgba(255, 193, 7, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

.experimental-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

.experimental-content p {
  margin: 0;
  color: #856404;
  font-size: 1.1rem;
  flex: 1;
}

.experimental-content a {
  color: #007bff;
  text-decoration: underline;
  font-weight: bold;
}

/* Fandoms Grid */
.fandoms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  width: 100%;
  grid-auto-rows: auto;
  align-items: start;
}

.fandom-card {
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border: 3px solid #e9ecef;
  border-radius: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.1),
    0 4px 8px rgba(0, 0, 0, 0.08),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.fandom-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 16px 32px rgba(102, 126, 234, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.95),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08);
  border-color: #667eea;
}

.fandom-card-banner {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 40px;
}

.fandom-card-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 5px solid #ffffff;
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(102, 126, 234, 0.15);
  overflow: hidden;
  background: #ffffff;
  transition: transform 0.3s ease;
}

.fandom-card:hover .fandom-card-avatar {
  transform: scale(1.1);
}

.fandom-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fandom-card-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fandom-card-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c3e50;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fandom-card-description {
  margin: 0;
  font-size: 0.95rem;
  color: #6c757d;
  text-align: center;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fandom-card-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 2px solid #e9ecef;
}

.fandom-stat {
  font-size: 0.9rem;
  color: #495057;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fandom-stat::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  display: inline-block;
}

.fandom-card-creator {
  margin-top: 0.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: #868e96;
  font-style: italic;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(145deg, #f8f9fa, #e9ecef);
  border: 3px solid #dee2e6;
  border-radius: 24px;
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.08),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.05);
  margin-top: 2rem;
}

.empty-icon {
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  margin: 0 0 0.75rem 0;
  color: #495057;
  font-size: 1.75rem;
  font-weight: 700;
}

.empty-state p {
  margin: 0 0 1.5rem 0;
  color: #6c757d;
  font-size: 1.1rem;
}

.create-fandom-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 12px 24px;
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 16px;
  font-family: 'Baloo 2', cursive;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 
    0 6px 12px rgba(102, 126, 234, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.create-fandom-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 16px rgba(102, 126, 234, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

.create-fandom-btn:active {
  transform: translateY(0);
}

/* .error-state: global glossy panel — root style.css */

/* Responsive design */
@media (max-width: 768px) {
  .page-header {
    padding: 1.5rem;
  }

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

  .header-text h1 {
    font-size: 2rem;
  }

  .fandoms-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }
  
  .search-filter-section {
    padding: 1rem;
  }

  .search-wrapper {
    flex-direction: column;
  }
}
