/* ================================
   WORLD EXPLORER STYLES
   ================================ */

/* World List View */
.world-list-view {
  min-height: 60vh;
}

.world-list-header {
  text-align: center;
  padding: var(--space-4xl) 0 var(--space-3xl);
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg-primary) 100%);
}

.world-list-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-md);
  letter-spacing: var(--letter-spacing-tight);
}

.world-list-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* World Grid */
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-xl);
  padding: var(--space-2xl) 0 var(--space-4xl);
}

.world-grid-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4xl);
  color: var(--color-text-muted);
}

.world-grid-loading .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-lg);
}

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

/* World Card */
.world-card {
  position: relative;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  aspect-ratio: 16 / 10;
}

.world-card:hover {
  transform: translateY(-8px);
  border-color: var(--color-accent-primary);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.world-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform var(--transition-slow);
}

.world-card:hover .world-card-bg {
  transform: scale(1.05);
}

.world-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(13, 13, 15, 0.6) 50%,
    rgba(13, 13, 15, 0.95) 100%
  );
}

.world-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xl);
}

.world-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-sm);
}

.world-card-excerpt {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.world-card-enter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-accent-primary);
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-base);
}

.world-card:hover .world-card-enter {
  opacity: 1;
  transform: translateY(0);
}

/* World Detail View */
.world-detail-view {
  animation: fadeIn 0.4s ease;
}

.world-detail-view[hidden] {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Back Button */
.back-to-worlds {
  position: fixed;
  top: calc(var(--space-4xl) + 60px);
  left: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  z-index: 100;
}

.back-to-worlds:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border-color: var(--color-border-hover);
}

/* World Hero */
.world-hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.world-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(2px);
  transform: scale(1.1);
}

.world-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 13, 15, 0.4) 0%,
    rgba(13, 13, 15, 0.7) 50%,
    var(--color-bg-primary) 100%
  );
  z-index: 1;
}

.world-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  max-width: 800px;
}

.world-title {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-lg);
  letter-spacing: var(--letter-spacing-tight);
}

.world-excerpt {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
}

/* World Tabs */
.world-tabs {
  position: sticky;
  top: 60px;
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border);
  z-index: 50;
}

.world-tabs .container {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.world-tabs .container::-webkit-scrollbar {
  display: none;
}

.world-tab {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-xl);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-base);
}

.world-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-md);
  right: var(--space-md);
  height: 2px;
  background: var(--color-accent-primary);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.world-tab:hover {
  color: var(--color-text-primary);
}

.world-tab.active {
  color: var(--color-accent-primary);
}

.world-tab.active::after {
  transform: scaleX(1);
}

/* World Content Panels */
.world-content {
  padding: var(--space-3xl) 0 var(--space-4xl);
  min-height: 50vh;
}

.world-panel {
  animation: fadeIn 0.3s ease;
}

.world-panel[hidden] {
  display: none;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-xl);
}

/* World Description */
.world-description {
  max-width: 800px;
  margin: 0 auto;
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
}

.world-description p {
  margin-bottom: var(--space-lg);
}

.world-description h2,
.world-description h3 {
  font-family: var(--font-heading);
  color: var(--color-text-heading);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.world-description ul,
.world-description ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.world-description li {
  margin-bottom: var(--space-sm);
}

/* Stories Grid */
.world-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
}

.story-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.story-card:hover {
  border-color: var(--color-accent-primary);
  transform: translateY(-4px);
}

.story-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-sm);
}

.story-card-excerpt {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-meta {
  margin-top: var(--space-md);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Characters Grid */
.world-characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-lg);
}

.character-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.character-card:hover {
  border-color: var(--color-accent-primary);
  transform: translateY(-4px);
}

.character-card-image {
  aspect-ratio: 1;
  background: var(--color-bg-tertiary);
  background-size: cover;
  background-position: center;
}

.character-card-content {
  padding: var(--space-md);
}

.character-card-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-heading);
}

.character-card-role {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Gallery Grid */
.world-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-md);
}

.gallery-item {
  aspect-ratio: 1;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.gallery-item:hover {
  border-color: var(--color-accent-primary);
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13, 13, 15, 0.9) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-base);
  display: flex;
  align-items: flex-end;
  padding: var(--space-md);
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-title {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

/* Empty States */
.empty-content {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
}

.empty-content p {
  margin-bottom: var(--space-md);
}

/* ================================
   SIDEBAR LAYOUT
   ================================ */

/* World Detail Layout - Sidebar + Content */
.world-detail-layout {
  padding: var(--space-2xl) 0 var(--space-4xl);
}

.world-detail-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-2xl);
}

/* World Sidebar Navigation */
.world-sidebar {
  position: sticky;
  top: calc(60px + var(--space-xl));
  height: fit-content;
}

.world-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-md);
}

.world-sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
}

.world-sidebar-item:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.world-sidebar-item.active {
  background: var(--color-bg-tertiary);
  color: var(--color-accent-primary);
  border-left: 3px solid var(--color-accent-primary);
  margin-left: -3px;
}

.sidebar-icon {
  font-size: var(--text-lg);
  width: 24px;
  text-align: center;
}

.sidebar-label {
  flex: 1;
}

.sidebar-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-count:empty {
  display: none;
}

.world-sidebar-item.active .sidebar-count {
  background: var(--color-accent-primary);
  color: var(--color-bg-primary);
}

/* World Main Content */
.world-main-content {
  min-height: 50vh;
}

/* Places Grid */
.world-places-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
}

/* Place Card */
.place-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.place-card:hover {
  border-color: var(--color-accent-primary);
  transform: translateY(-4px);
}

.place-card-image {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-tertiary);
  background-size: cover;
  background-position: center;
}

.place-card-content {
  padding: var(--space-lg);
}

.place-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-sm);
}

.place-card-excerpt {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.place-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.place-tag {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Story Reader (inline) */
.story-reader {
  max-width: 800px;
}

.story-reader-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: var(--space-md);
}

.story-reader-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.story-reader-body {
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
}

.story-reader-body p {
  margin-bottom: var(--space-lg);
}

.back-to-stories {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-xl);
  transition: color var(--transition-base);
}

.back-to-stories:hover {
  color: var(--color-accent-primary);
}

/* Hide old tabs navigation - now using sidebar */
.world-tabs {
  display: none;
}

.world-content {
  display: none;
}

/* Responsive Sidebar */
@media (max-width: 900px) {
  .world-detail-grid {
    grid-template-columns: 1fr;
  }

  .world-sidebar {
    position: static;
    order: -1;
  }

  .world-sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: var(--space-sm);
  }

  .world-sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .world-sidebar-item {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
  }

  .world-sidebar-item.active {
    border-left: none;
    border-bottom: 2px solid var(--color-accent-primary);
    margin-left: 0;
    padding-bottom: calc(var(--space-sm) - 2px);
  }

  .sidebar-label {
    display: none;
  }

  .sidebar-icon {
    margin: 0;
  }
}

/* Standard Responsive */
@media (max-width: 768px) {
  .back-to-worlds {
    top: auto;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
  }

  .world-hero {
    min-height: 40vh;
  }

  .world-title {
    font-size: var(--text-2xl);
  }

  .world-grid {
    grid-template-columns: 1fr;
  }

  .world-places-grid,
  .world-stories-grid {
    grid-template-columns: 1fr;
  }
}
