/* Posts Styling */

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

.posts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.posts-header h1 {
  margin: 0;
  color: #2d3748;
  font-size: 2rem;
}

.posts-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.view-switcher {
  display: flex;
  gap: 0.5rem;
  background: white;
  padding: 0.25rem;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.view-switcher .btn {
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  background: transparent;
  color: #718096;
}

.view-switcher .btn:hover {
  background: #f7fafc;
  color: #2d3748;
  transform: none;
  box-shadow: none;
}

.view-switcher .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.view-switcher .btn-primary:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transform: translateY(-1px);
}

/* Create Post Button */
.btn-create-post {
  padding: 0.625rem 1.5rem !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
}

.btn-create-post:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.post-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

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

.post-card-header {
  padding: 1.25rem;
  border-bottom: 1px solid #e9ecef;
}

.post-card-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  color: #212529;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-card-title a {
  color: #212529;
  text-decoration: none;
}

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

.post-card-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.post-card-body {
  padding: 1.25rem;
  flex-grow: 1;
}

.post-card-content {
  color: #718096;
  font-size: 0.95rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1rem;
}

.post-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #718096;
}

.post-card-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-card-info-item strong {
  color: #4a5568;
  min-width: 120px;
}

.post-card-footer {
  padding: 1rem 1.25rem;
  background: #f7fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

.post-show-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.post-show-header {
  padding: 2rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-show-header h1 {
  margin: 0;
  font-size: 2rem;
  color: #212529;
  flex: 1;
  min-width: 250px;
}

.post-show-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-show-body {
  padding: 2rem;
}

.post-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.post-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-info-label {
  font-weight: 600;
  color: #495057;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-info-value {
  color: #212529;
  font-size: 1rem;
}

.post-content-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e9ecef;
}

.post-content-section h3 {
  margin: 0 0 1rem 0;
  color: #495057;
  font-size: 1.125rem;
  font-weight: 600;
}

.post-content-box {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  color: #212529;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-content-box p {
  margin: 0 !important;
  padding: 0 !important;
  margin-bottom: 0.25rem !important;
}

.post-content-box p:last-child {
  margin-bottom: 0 !important;
}

.post-content-box br {
  display: none;
}

.post-media-section {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.post-show-footer {
  padding: 1.5rem 2rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #718096;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 0.5rem 0;
  color: #4a5568;
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* Media Preview Styles */

.post-media-preview {
  margin-bottom: 1rem;
}

.media-container {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.media-type-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
}

/* Photo Media */
.media-photo {
  width: 100%;
  max-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-image {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

/* Video Media */
.media-video {
  width: 100%;
  max-height: 400px;
}

.media-video-player {
  width: 100%;
  height: auto;
  max-height: 400px;
  display: block;
  background: #000;
}

/* Document Media */
.media-document {
  padding: 1.5rem;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-document-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.media-document-icon {
  font-size: 3rem;
  opacity: 0.6;
}

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

.media-document-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.media-document-link {
  color: #0088cc;
  text-decoration: none;
  word-break: break-all;
  font-size: 0.875rem;
}

.media-document-link:hover {
  text-decoration: underline;
}

/* Media in cards (index page) */
.post-card .post-media-preview {
  margin-bottom: 1rem;
}

.post-card .media-container {
  max-height: 250px;
}

.post-card .media-image {
  max-height: 250px;
}

.post-card .media-video-player {
  max-height: 250px;
}

/* Media in show page */
.post-show-body .post-media-preview {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e9ecef;
}

/* Tabs Styles */
.tabs-container {
  margin-top: 1.5rem;
  background: white;
  border-radius: 0 0 12px 12px;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e9ecef;
  background: #f8f9fa;
}

.tab-button {
  flex: 1;
  min-width: 150px;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.2s;
  position: relative;
}

.tab-button:hover {
  color: #374151;
  background-color: #f3f4f6;
}

.tab-button.active {
  color: #2563eb;
  background: white;
  border-bottom-color: #2563eb;
}

.tab-content {
  display: none;
  padding: 1.5rem;
}

.tab-content.active {
  display: block;
}

/* Post Details Journey Styles */
.post-details-container {
  padding: 0;
}

.post-journey {
  margin-bottom: 2rem;
}

.post-journey h3 {
  margin: 0 0 1.5rem 0;
  color: #212529;
  font-size: 1.5rem;
  font-weight: 600;
}

.journey-step {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid #0088cc;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0088cc;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.step-info {
  flex: 1;
}

.step-info h4 {
  margin: 0 0 0.25rem 0;
  color: #212529;
  font-size: 1.125rem;
  font-weight: 600;
}

.step-content {
  margin-left: 56px;
  color: #495057;
}

.content-preview {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* AI Agents Timeline */
.ai-agents-timeline {
  margin-top: 1rem;
}

.timeline-section {
  margin-bottom: 1.5rem;
}

.timeline-section h5 {
  margin: 0 0 1rem 0;
  color: #495057;
  font-size: 1rem;
  font-weight: 600;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-item {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 1rem;
  transition: box-shadow 0.2s;
}

.timeline-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.timeline-item.success {
  border-left: 3px solid #28a745;
}

.timeline-item.failed {
  border-left: 3px solid #dc3545;
}

.timeline-item.pending {
  border-left: 3px solid #6c757d;
}

.timeline-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.agent-name {
  font-weight: 600;
  color: #212529;
  font-size: 0.95rem;
}

.timeline-item-content {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #495057;
}

.timeline-item-content details {
  cursor: pointer;
}

.timeline-item-content summary {
  font-weight: 500;
  color: #0088cc;
  padding: 0.5rem 0;
  user-select: none;
}

.timeline-item-content summary:hover {
  color: #006699;
}

.rewritten-content,
.planning-response,
.media-response {
  margin-top: 0.75rem;
  padding: 1rem;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  line-height: 1.6;
}

.media-response .response-section {
  margin-bottom: 1rem;
}

.media-response .response-section:last-child {
  margin-bottom: 0;
}

.media-response .response-section strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #495057;
  font-size: 0.9rem;
}

.media-response .response-section pre {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid #e9ecef;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}



.generated-media-preview {
  margin-bottom: 1rem;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e9ecef;
}

.generated-media-preview img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
  background: #f8f9fa;
}

.timeline-item-footer {
  margin-top: 0.5rem;
}

/* Post Metadata */
.post-metadata {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e9ecef;
}

.post-metadata h3 {
  margin: 0 0 1rem 0;
  color: #212529;
  font-size: 1.25rem;
  font-weight: 600;
}

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

.metadata-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.metadata-label {
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metadata-value {
  font-size: 1rem;
  color: #212529;
  font-weight: 500;
}

@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }

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

  .post-show-header {
    flex-direction: column;
  }

  .post-info-grid {
    grid-template-columns: 1fr;
  }

  .media-container {
    max-height: 300px;
  }

  .media-image,
  .media-video-player {
    max-height: 300px;
  }

  .media-document {
    padding: 1rem;
  }

  .media-document-icon {
    font-size: 2rem;
  }

  .tabs {
    flex-direction: column;
  }

  .tab-button {
    min-width: auto;
  }

  .step-content {
    margin-left: 0;
    margin-top: 1rem;
  }

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