/* ===========================================
   POST DETAIL MODAL STYLES
   Full-screen post view with comments
   =========================================== */

/* Modal Container */
.post-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.post-detail-modal.open {
  opacity: 1;
  visibility: visible;
}

/* Overlay */
.post-detail-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

/* Container */
.post-detail-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-detail-modal.open .post-detail-container {
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Close Button */
.post-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all 0.2s;
  z-index: 10;
}

.post-detail-close:hover {
  background: var(--bg-tertiary);
}

/* Content */
.post-detail-content {
  flex: 1;
  overflow-y: auto;
}

/* Article */
.post-detail-article {
  display: flex;
  flex-direction: column;
}

/* Header */
.post-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.post-detail-header .post-author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.post-detail-header .post-author-info {
  flex: 1;
}

.post-detail-header .post-author-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}

.post-detail-header .post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.post-detail-header .post-time {
  font-size: 13px;
  color: var(--text-tertiary);
}

.post-detail-header .post-project-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.post-detail-header .post-menu-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.post-detail-header .post-menu-btn:hover {
  background: var(--bg-secondary);
}

/* Body */
.post-detail-body {
  padding: 16px;
}

.post-detail-body .post-content {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.post-detail-body .post-content .mention {
  color: var(--primary-color);
  text-decoration: none;
}

.post-detail-body .post-content .hashtag {
  color: var(--primary-color);
  text-decoration: none;
}

/* Media Grid */
.post-detail-body .post-media-grid {
  display: grid;
  gap: 4px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
}

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

.post-media-grid.double {
  grid-template-columns: repeat(2, 1fr);
}

.post-media-grid.triple {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.post-media-grid.triple .media-item:first-child {
  grid-row: span 2;
}

.post-media-grid.grid {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.media-item {
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  aspect-ratio: 1;
  cursor: pointer;
}

.post-media-grid.single .media-item {
  aspect-ratio: 16/9;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 600;
}

/* Poll */
.post-poll {
  margin-top: 12px;
}

.poll-option {
  position: relative;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}

.poll-option:hover {
  border-color: var(--primary-color);
}

.poll-option.voted {
  cursor: default;
}

.poll-option.selected {
  border-color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 5%, var(--bg-primary));
}

.poll-option-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: color-mix(in srgb, var(--primary-color) 15%, transparent);
  transition: width 0.5s ease;
}

.poll-option-text {
  position: relative;
  z-index: 1;
  font-weight: 500;
}

.poll-option-percent {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  color: var(--primary-color);
}

.poll-info {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Link Preview */
.post-link-preview {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  margin-top: 12px;
  transition: border-color 0.2s;
}

.post-link-preview:hover {
  border-color: var(--primary-color);
}

.post-link-preview .link-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.post-link-preview .link-info {
  padding: 12px;
}

.post-link-preview .link-domain {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.post-link-preview .link-title {
  font-weight: 600;
  color: var(--text-primary);
  margin: 4px 0;
}

.post-link-preview .link-description {
  font-size: 14px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stats */
.post-detail-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}

.post-reactions-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reaction-icons {
  font-size: 16px;
}

.reaction-count {
  font-size: 14px;
  color: var(--text-secondary);
}

.post-counts {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Actions */
.post-detail-actions {
  display: flex;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.post-detail-actions .post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color 0.2s;
}

.post-detail-actions .post-action-btn:hover {
  background: var(--bg-secondary);
}

.post-detail-actions .post-action-btn.active {
  color: var(--primary-color);
}

.post-detail-actions .action-icon {
  font-size: 18px;
}

/* Comments Section */
.post-detail-comments {
  padding: 16px;
  background: var(--bg-secondary);
}

/* Loading */
.post-detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.post-detail-loading .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Error */
.post-detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
  padding: 40px;
}

.post-detail-error .error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.post-detail-error p {
  margin: 0 0 20px;
  color: var(--text-secondary);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1070;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
}

.lightbox-image {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================== */
/* RESPONSIVE */
/* =========================================== */

@media (max-width: 768px) {
  .post-detail-container {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    height: 100%;
  }

  .post-detail-close {
    top: 8px;
    right: 8px;
  }

  .post-detail-header {
    padding-top: 60px;
  }

  .post-detail-actions .post-action-btn span:not(.action-icon) {
    display: none;
  }

  .post-detail-actions .post-action-btn .action-icon {
    font-size: 22px;
  }
}
