/**
 * GALLERY STYLES
 * Стили для страницы галереи пользователя
 */

/* ==========================================
   GALLERY HERO
   ========================================== */

.gallery-hero {
  background: linear-gradient(180deg, #0f1624 0%, #12192a 100%);
  padding: 3rem 0 2rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.gallery-header {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 2rem;
}

.gallery-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gallery-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
  flex-shrink: 0;
}

.gallery-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.gallery-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  color: #f1f5f9;
  margin: 0;
}

.gallery-subtitle {
  font-size: clamp(14px, 2.5vw, 16px);
  color: #cbd5e1;
  margin: 0;
}

/* Stats Cards */
.gallery-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(11, 18, 32, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon-generation {
  background: rgba(139, 92, 246, 0.15);
}

.stat-icon-upscale {
  background: rgba(14, 165, 233, 0.15);
}

.stat-icon-background {
  background: rgba(34, 197, 94, 0.15);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #f1f5f9;
}

.stat-label {
  font-size: 13px;
  color: #94a3b8;
}

/* Controls */
.gallery-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #94a3b8;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 12px;
  color: #f1f5f9;
  font-size: 15px;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(15, 23, 42, 0.8);
}

.filters-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.favorite-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.favorite-toggle[data-active="true"] {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
  color: #a78bfa;
}

.favorite-icon {
  width: 18px;
  height: 18px;
}

.controls-secondary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.sort-select {
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 13px;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  padding: 4px;
}

.view-btn {
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn svg {
  width: 18px;
  height: 18px;
}

.view-btn.active {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}

/* ==========================================
   GALLERY SECTION
   ========================================== */

.gallery-section {
  min-height: 60vh;
  padding: 3rem 0;
  background: linear-gradient(180deg, #12192a 0%, #0f1624 100%);
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 1rem;
  color: #cbd5e1;
  font-size: 15px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  color: #475569;
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-title {
  font-size: 24px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
}

.empty-text {
  font-size: 16px;
  color: #94a3b8;
  margin-bottom: 2rem;
}

.empty-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.empty-btn svg {
  width: 20px;
  height: 20px;
}

.empty-btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.empty-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

.empty-btn-secondary {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #cbd5e1;
}

.empty-btn-secondary:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.5);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.gallery-grid[data-view="list"] {
  grid-template-columns: 1fr;
}

/* Gallery Card */
.gallery-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(11, 18, 32, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.25);
}

.card-image-wrapper {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #1a1f2e;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-card:hover .card-image {
  transform: scale(1.05);
}

.card-favorite-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.card-favorite-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.card-favorite-btn.active {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.2);
}

.card-favorite-btn svg {
  width: 18px;
  height: 18px;
}

.card-content {
  padding: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid;
}

.badge-generation {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #a78bfa;
}

.badge-upscale {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.4);
  color: #38bdf8;
}

.badge-background {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.card-prompt {
  font-size: 14px;
  color: #e2e8f0;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 13px;
  color: #94a3b8;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================
   MODAL
   ========================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[aria-hidden="false"] {
  display: flex;
}

.modal-container {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(11, 18, 32, 0.98));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 20px;
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.modal-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #a78bfa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-nav-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
}

.modal-nav-btn svg {
  width: 20px;
  height: 20px;
}

.modal-title-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.modal-close-btn svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  padding: 2rem;
  max-height: calc(90vh - 120px);
  overflow-y: auto;
}

.modal-image-wrapper {
  border-radius: 12px;
  overflow: hidden;
  background: #1a1f2e;
  margin-bottom: 1rem;
}

.modal-image {
  width: 100%;
  height: auto;
  display: block;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.modal-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-action-btn svg {
  width: 18px;
  height: 18px;
}

.modal-action-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border: none;
  grid-column: 1 / -1;
}

.modal-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

.modal-action-secondary {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
}

.modal-action-ghost {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #cbd5e1;
}

.modal-action-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Details Column */
.modal-details-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.detail-section {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  padding: 1rem;
}

.detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #a78bfa;
  margin-bottom: 0.75rem;
}

.detail-section-title svg {
  width: 16px;
  height: 16px;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.detail-label {
  color: #94a3b8;
}

.detail-value {
  color: #e2e8f0;
  font-weight: 600;
}

.detail-prompt {
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.6;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-item {
  padding: 4px 10px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 6px;
  font-size: 12px;
  color: #a78bfa;
}

/* Load More */
.load-more-container {
  text-align: center;
  padding: 2rem 0;
}

.load-more-btn {
  padding: 12px 32px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  color: #a78bfa;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.load-more-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .gallery-hero {
    padding: 2rem 0 1.5rem;
  }
  
  .gallery-header {
    gap: 1.5rem;
  }
  
  .gallery-stats {
    grid-template-columns: 1fr;
  }
  
  /* Modal Header - mobile optimization */
  .modal-header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    position: relative;
    gap: 0.75rem;
  }
  
  /* Hide navigation buttons on mobile */
  .modal-nav-btn {
    display: none;
  }
  
  /* Close button - absolute positioning */
  .modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    z-index: 10;
  }
  
  /* Badge and title - vertical layout */
  .modal-title-wrapper {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.5rem;
    padding-right: 48px; /* Space for close button */
  }
  
  .modal-badge {
    align-self: flex-start;
  }
  
  .modal-title {
    font-size: 16px;
    line-height: 1.3;
  }
  
  /* Container optimization */
  .modal-container {
    max-height: 95vh;
    margin: 0.5rem;
    border-radius: 16px;
  }
  
  /* Body - single column with better spacing */
  .modal-body {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }
  
  /* Image wrapper optimization */
  .modal-image-wrapper {
    margin-bottom: 0.75rem;
  }
  
  /* Actions - single column */
  .modal-actions {
    grid-template-columns: 1fr;
  }
  
  /* Details column - better scrolling */
  .modal-details-column {
    max-height: none;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}
