/**
 * Data Stories CSS
 * Modern design aligned with Rapid Response
 * Styles for data story listing, display, and editing interfaces
 */

/* UNESCO Color Palette */
:root {
  --unesco-blue: #0072BC;
  --unesco-blue-dark: #005A9C;
  --unesco-blue-light: #009EE0;
  --unesco-blue-pale: #E3F2FD;
  --text-primary: #2c3e50;
  --text-secondary: #6c757d;
  --shadow-light: 0 2px 8px rgba(0, 114, 188, 0.08);
  --shadow-medium: 0 4px 16px rgba(0, 114, 188, 0.12);
  --shadow-strong: 0 8px 32px rgba(0, 114, 188, 0.16);
}

/* ========================================
   Modern Layout (Rapid Response Style)
   ======================================== */

.homepage.layout-1 {
  background: #f8f9fa;
  min-height: 100vh;
}

.main {
  padding-bottom: 3rem;
}

/* Breadcrumb (Data Stories) */
.data-story-breadcrumb .breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
}

.data-story-breadcrumb .breadcrumb > li {
  max-width: 100%;
  min-width: 0;
}

.data-story-breadcrumb .breadcrumb > li + li:before {
  padding: 0 0.35rem;
}

.data-story-breadcrumb .breadcrumb > li.active > a,
.data-story-breadcrumb .breadcrumb > li.active {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Module System */
.module {
  background: #fff;
  border: none;
  border-radius: 20px;
  box-shadow: var(--shadow-medium);
  transition: all 0.3s ease;
  overflow: hidden;
  margin-bottom: 2rem;
}

.module:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.module-content {
  padding: 2.5rem;
}

.module-heading {
  padding: 1rem 2.5rem;
  background: linear-gradient(135deg, var(--unesco-blue-pale) 0%, #ffffff 100%);
  border-bottom: 3px solid var(--unesco-blue-pale);
}

/* Section Title/Banner */
.section-title {
  position: relative;
  height: 300px;
  overflow: hidden;
  border-radius: 16px;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-strong);
}

.section-title-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-image: linear-gradient(135deg, #0072BC 0%, #009EE0 100%);
  filter: brightness(0.8);
  transition: transform 0.3s ease;
}

.section-title:hover .section-title-bg {
  transform: scale(1.02);
}

.section-title-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 114, 188, 0.9) 0%, rgba(0, 158, 224, 0.8) 100%);
}

.section-title-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 10;
  width: 90%;
  max-width: 700px;
}

.section-title-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.4);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-title-description {
  font-size: 1.2rem;
  margin-bottom: 0;
  opacity: 0.95;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.4);
  font-weight: 300;
  line-height: 1.4;
}

/* Breadcrumb */
.toolbar {
  margin-bottom: 2rem;
  padding: 0;
  width: 100%;
}

/* Simple breadcrumb (no card style) */
.breadcrumb-simple .breadcrumb {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.5rem 0 !important;
}

.breadcrumb {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 12px 20px;
  margin: 0;
  border-radius: 12px;
  border: 1px solid #e9ecef;
  box-shadow: var(--shadow-light);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  list-style: none;
  width: 100%;
}

.breadcrumb > li {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
}

.breadcrumb > li + li:before {
  content: "›";
  padding: 0 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
}

.breadcrumb > li.active a {
  color: var(--unesco-blue);
  font-weight: 600;
}

.breadcrumb > li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.breadcrumb > li a:hover {
  color: var(--unesco-blue);
}

.breadcrumb > li a i {
  margin-right: 0.25rem;
}

/* ========================================
   Featured & Draft Stories Sections
   ======================================== */

.featured-stories .module-heading,
.user-drafts .module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.featured-stories .module-content,
.user-drafts .module-content {
  padding: 1.5rem 2rem;
}

.featured-stories .story-card-modern,
.user-drafts .story-card-modern {
  margin-bottom: 1.25rem;
}

.featured-stories .story-card-modern:last-child,
.user-drafts .story-card-modern:last-child {
  margin-bottom: 0;
}

/* Draft stories - subtle different styling */
.user-drafts .module-modern {
  background: linear-gradient(135deg, #fffbf5 0%, #ffffff 100%);
  border-left: 4px solid #E65100;
}

/* Compact cards for drafts */
.story-card-compact .module-modern {
  min-height: auto;
}

.story-card-compact .event-card-content {
  padding: 1.25rem;
}

.story-card-compact .compact-title {
  font-size: 1.1rem;
  margin: 0.25rem 0 0.5rem 0;
  font-weight: 700;
  line-height: 1.3;
}

.story-card-compact .compact-meta {
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.story-card-compact .btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  border-radius: 20px;
}

/* Featured stories - highlight */
.featured-stories .module-modern {
  background: linear-gradient(135deg, #fffef7 0%, #ffffff 100%);
  border-left: 4px solid #FFB800;
}

/* Modern Card System (event-card-modern from rapid-response) */
.event-card-modern {
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.module-modern {
  background: #fff;
  border: none;
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  height: 100%;
}

.module-modern:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.event-card-content {
  padding: 1.75rem;
}

.event-image-container {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #E3F2FD 0%, #f8f9fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.event-card-modern:hover .event-image {
  transform: scale(1.05);
}

.event-card-modern .placeholder-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E3F2FD 0%, #f8f9fa 100%);
}

.event-card-modern .placeholder-image i {
  color: #0072BC;
  opacity: 0.5;
  font-size: 4rem;
}

.event-details {
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.event-title {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.event-title a {
  color: var(--unesco-blue);
  text-decoration: none;
  transition: color 0.3s ease;
}

.event-title a:hover {
  color: var(--unesco-blue-dark);
}

.event-excerpt {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

/* Badges */
.badge-modern {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-light);
}

/* Buttons - Modern Style */
.btn {
  border-radius: 25px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--unesco-blue) 0%, var(--unesco-blue-dark) 100%);
  color: white;
  box-shadow: var(--shadow-light);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  background: linear-gradient(135deg, var(--unesco-blue-dark) 0%, var(--unesco-blue) 100%);
  color: white;
  text-decoration: none;
}

.btn-default {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e9ecef;
  color: var(--text-primary);
  box-shadow: var(--shadow-light);
}

.btn-default:hover {
  background: var(--unesco-blue-pale);
  border-color: var(--unesco-blue);
  color: var(--unesco-blue);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
}

/* Form Controls */
.form-control {
  border-radius: 12px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: var(--shadow-light);
}

.form-control:focus {
  border-color: var(--unesco-blue);
  box-shadow: 0 0 0 0.2rem rgba(0, 114, 188, 0.25);
  outline: none;
  background: #ffffff;
}

/* ========================================
   Legacy Story List & Cards (Keep for compatibility)
   ======================================== */

/* Note: .story-list display:grid removed to use Bootstrap grid via .stories-grid */
.story-list {
  margin: 20px 0;
}

.story-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.story-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.story-card-header {
  padding: 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.story-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.story-card-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.4;
}

.story-card-title a {
  color: #0072BC;
  text-decoration: none;
}

.story-card-title a:hover {
  color: #005A9C;
  text-decoration: underline;
}

.story-card-abstract {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 15px;
  flex: 1;
}

.story-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #e9ecef;
  font-size: 13px;
  color: #666;
}

.story-card-meta .author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.story-card-meta .avatar-small {
  border-radius: 50%;
  width: 24px;
  height: 24px;
}

.story-card-meta .stats {
  display: flex;
  gap: 15px;
}

.story-card-meta .stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.story-card-organization {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e9ecef;
}

.story-card-footer {
  padding: 15px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
}

/* Featured stories */
.story-card.featured {
  border-color: #ffc107;
  background: linear-gradient(to bottom, #fff9e6 0%, #ffffff 100px);
}

/* ========================================
   Story Status Badges
   ======================================== */

.story-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

/* Modern badge styles for story cards */
.badge-modern.label-default {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
  color: #fff;
}

.badge-modern.label-info {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: #fff;
}

.badge-modern.label-warning {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
  color: #212529;
}

.badge-modern.label-success {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
  color: #fff;
}

.badge-modern.label-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: #fff;
}

/* Badge organization style */
.badge-organization {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #6c757d !important;
  border: 1px solid #dee2e6;
}

/* Notification badge for pending review */
.badge-notification {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border-radius: 50%;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4);
  padding: 0 6px;
  line-height: 1;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4);
  }
  50% {
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.7);
  }
}

/* Legacy badge styles (keep for compatibility) */
.label-default {
  background-color: #6c757d;
  color: #fff;
}

.label-info {
  background-color: #17a2b8;
  color: #fff;
}

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

.label-success {
  background-color: #28a745;
  color: #fff;
}

.label-danger {
  background-color: #dc3545;
  color: #fff;
}

/* ========================================
   Story Display (Single View)
   ======================================== */

.story-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.story-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #0072BC;
}

.story-title {
  font-size: 32px;
  line-height: 1.3;
  margin: 0 0 15px 0;
  color: #212529;
}

.story-abstract {
  font-size: 18px;
  line-height: 1.6;
  color: #666;
  font-style: italic;
  margin: 15px 0;
}

.story-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 4px;
}

.story-metadata-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.story-metadata-label {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
}

.story-metadata-value {
  font-size: 14px;
  color: #333;
}

/* ========================================
   Story Sections
   ======================================== */

.story-sections {
  margin: 30px 0;
}

.story-section {
  margin: 40px 0;
  padding: 30px;
  background: #fff;
  border-radius: 4px;
  border-left: 4px solid #0072BC;
}

.story-section:first-child {
  margin-top: 0;
}

.section-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.section-header h2 {
  margin: 0;
  font-size: 24px;
  color: #0072BC;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-content {
  font-size: 16px;
  line-height: 1.8;
  color: #333;
}

.section-content p {
  margin: 15px 0;
}

.section-content h3 {
  margin-top: 25px;
  margin-bottom: 15px;
  font-size: 20px;
  color: #212529;
}

.section-content ul,
.section-content ol {
  margin: 15px 0;
  padding-left: 30px;
}

.section-content li {
  margin: 8px 0;
}

/* Section Images */
.section-image {
  margin: 25px 0;
  text-align: center;
}

.section-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Section Videos */
.section-video {
  margin: 25px 0;
}

/* Terria Maps */
.section-terria {
  margin: 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 4px;
}

.terria-embed-container {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.terria-embed-iframe {
  display: block;
  width: 100%;
  border: none;
}

/* Section Type Colors */
.section-introduction {
  border-left-color: #0072BC;
}

.section-research_question {
  border-left-color: #17a2b8;
}

.section-study_area {
  border-left-color: #28a745;
}

.section-data_sources {
  border-left-color: #6f42c1;
}

.section-methodology {
  border-left-color: #fd7e14;
}

.section-spatial_analysis {
  border-left-color: #20c997;
}

.section-results {
  border-left-color: #ffc107;
}

.section-discussion {
  border-left-color: #e83e8c;
}

.section-conclusions {
  border-left-color: #dc3545;
}

.section-references {
  border-left-color: #6c757d;
}

.section-acknowledgments {
  border-left-color: #17a2b8;
}

/* ========================================
   Story Actions (Edit, Delete, etc.)
   ======================================== */

.story-actions {
  margin: 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ========================================
   Story Editor (Create/Edit Form)
   ======================================== */

.story-editor {
  max-width: 900px;
  margin: 0 auto;
}

.section-editor {
  margin: 20px 0;
  border: 1px solid #ddd;
  background: #fff;
}

.section-editor .panel-heading {
  background: #f8f9fa;
  padding: 15px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-editor .panel-title {
  margin: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-editor .panel-body {
  padding: 20px;
}

.section-editor .form-group {
  margin-bottom: 20px;
}

.section-type-select {
  font-size: 14px;
  font-weight: 600;
}

.markdown-editor {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
}

.code-editor {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 12px;
  background: #f8f9fa;
}

.terria-config-group .nav-tabs {
  margin-bottom: 15px;
}

.terria-config-group .tab-content {
  padding: 15px;
  border: 1px solid #ddd;
  border-top: none;
  background: #fff;
}

/* Drag handle for reordering sections */
.section-drag-handle {
  cursor: move;
  color: #999;
  padding: 5px;
}

.section-drag-handle:hover {
  color: #666;
}

/* ========================================
   Story Filters & Search
   ======================================== */

.story-filters {
  margin: 20px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 4px;
}

.story-filters .form-group {
  margin-bottom: 15px;
}

.story-filters label {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
}

.story-search {
  position: relative;
}

.story-search input {
  padding-right: 40px;
}

.story-search .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .story-list {
    margin: 10px 0;
  }

  .story-container {
    padding: 15px;
  }

  .story-title {
    font-size: 24px;
  }

  .story-section {
    padding: 20px 15px;
  }

  .section-header h2 {
    font-size: 20px;
  }

  .story-card-meta {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .story-metadata {
    flex-direction: column;
    gap: 15px;
  }

  .story-actions {
    flex-direction: column;
  }

  .story-actions .btn {
    width: 100%;
  }

  /* Breadcrumb responsive */
  .breadcrumb {
    font-size: 0.85rem;
    padding: 10px 15px;
    flex-wrap: wrap;
  }

  .breadcrumb > li + li:before {
    padding: 0 8px;
  }

  .breadcrumb > li a span {
    display: none;
  }

  .breadcrumb > li.home a span {
    display: inline;
  }
}

/* ========================================
   Linked Datasets Section
   ======================================== */

.story-datasets {
  margin: 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 4px;
}

.story-datasets-header {
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  color: #212529;
}

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

.dataset-item {
  padding: 12px;
  margin: 8px 0;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.dataset-item:hover {
  border-color: #0072BC;
  box-shadow: 0 2px 6px rgba(0, 114, 188, 0.15);
}

.dataset-item a {
  color: #0072BC;
  text-decoration: none;
  font-weight: 500;
}

.dataset-item a:hover {
  text-decoration: underline;
}

/* ========================================
   Contributors Section
   ======================================== */

.story-contributors {
  margin: 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 4px;
}

.contributors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 15px;
}

.contributor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 4px;
}

.contributor-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.contributor-info {
  display: flex;
  flex-direction: column;
}

.contributor-name {
  font-weight: 600;
  color: #212529;
}

.contributor-role {
  font-size: 12px;
  color: #666;
  text-transform: capitalize;
}

/* ========================================
   Countries
   ======================================== */
.story-country-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.story-country-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #e3f2fd;
  color: #0072bc;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: var(--shadow-light);
  border: 1px solid #cfe4fb;
}

.story-country-chip.more {
  background: #f8f9fa;
  color: #2c3e50;
  border-color: #e9ecef;
}

/* ========================================
   Loading & Empty States
   ======================================== */

.story-loading {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.story-loading i {
  font-size: 48px;
  animation: spin 1s linear infinite;
}

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

.story-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.story-empty i {
  font-size: 64px;
  color: #ddd;
  margin-bottom: 20px;
}

.story-empty p {
  font-size: 18px;
  margin-bottom: 20px;
}

/* ========================================
   Lightbox Modal - Fixed z-index issues
   ======================================== */

.ds-lightbox-modal {
  display: none;
  position: fixed;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.96) !important;
  z-index: 2147483647 !important;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  isolation: isolate !important;
}

.ds-lightbox-modal.open { 
  display: flex !important; 
  position: fixed !important;
  z-index: 2147483647 !important;
}

.ds-lightbox-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #fff;
  font-size: 40px;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 6px;
  z-index: 2147483647 !important;
  transition: background 0.2s ease;
}

.ds-lightbox-btn:hover { 
  background: rgba(255, 255, 255, 0.3); 
}

.ds-lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  margin-bottom: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.ds-lightbox-caption { 
  color: #fff; 
  font-size: 1.1rem; 
  padding: 10px; 
}

.ds-lightbox-counter { 
  color: #fff; 
  opacity: 0.7; 
  margin-top: 8px; 
}

/* Hide navigation elements when lightbox is open */
body.ds-lightbox-open .nav-link.dropdown-toggle.active-item,
body.ds-lightbox-open .dropdown-menu,
body.ds-lightbox-open .site-footer,
body.ds-lightbox-open .navbar,
body.ds-lightbox-open [class*="dropdown"],
body.ds-lightbox-open [class*="nav-"],
body.ds-lightbox-open .footer-links {
  z-index: -1 !important;
  visibility: hidden !important;
}

/* Ensure lightbox is on top of everything */
.ds-lightbox-modal {
  z-index: 2147483647 !important;
  position: fixed !important;
  inset: 0 !important;
  isolation: isolate !important;
}

/* Force modal content to be on top */
.ds-lightbox-modal * {
  z-index: inherit !important;
}

/* Override any other z-index when lightbox is open */
body.ds-lightbox-open * {
  z-index: auto !important;
}

body.ds-lightbox-open .ds-lightbox-modal,
body.ds-lightbox-open .ds-lightbox-modal * {
  z-index: 2147483647 !important;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .story-actions,
  .story-filters,
  .btn,
  .story-card-footer {
    display: none !important;
  }

  .story-section {
    page-break-inside: avoid;
  }

  .story-container {
    max-width: 100%;
  }
}
