/* Feature Area Center Modal (2025-10-01)
   Goal: Unified modal experience matching Upload/Profile/Discovery centers
   Principles: Consistent theme, smooth animations, mobile-first responsive design, accessibility */

/* Root & Visibility Orchestration */
#feature-area-center-root {
  position: fixed;
  inset: 0;
  z-index: 14020;
  font-family: var(--font-mono, 'VT323', monospace);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 380ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 380ms;
}

#feature-area-center-root.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 380ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}

#fa-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

#feature-area-center-root.is-open #fa-backdrop {
  opacity: 1;
}

/* Shell (Modal Container) */
#fa-shell {
  position: absolute;
  left: 50%;
  top: 10vh;
  transform: translateX(-50%) translateY(-10px) scale(0.985);
  width: min(880px, 92vw);
  max-height: calc(100vh - 20vh);
  display: flex;
  flex-direction: column;
  background: #101018;
  border: 1px solid #00ff88;
  border-radius: 20px;
  padding: 22px 26px 18px;
  box-shadow: 0 0 28px -6px rgba(0, 255, 136, 0.55), 0 0 3px 1px rgba(0, 255, 136, 0.38) inset;
  box-sizing: border-box;
  opacity: 0;
  overflow: hidden;
  transition: opacity 380ms cubic-bezier(0.16, 1, 0.3, 1) 120ms, transform 380ms cubic-bezier(0.16, 1, 0.3, 1) 120ms;
}

#feature-area-center-root.is-open #fa-shell {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

@media (max-width: 760px) {
  #fa-shell {
    top: 8vh;
    max-height: calc(100vh - 16vh);
    padding: 20px 20px 18px;
  }
}

@media (max-width: 560px) {
  #fa-shell {
    top: 6vh;
    width: 94vw;
    max-height: calc(100vh - 12vh);
    border-radius: 18px;
    padding: 18px 16px 18px;
  }
}

@media (max-width: 380px) {
  #fa-shell {
    padding: 16px 12px 16px;
  }
}

/* Header */
.fa-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
@media (max-width:560px){ .fa-header { padding-right:56px; position:relative; } .fa-header-actions { position:absolute; top:8px; right:8px; gap:8px; } }

.fa-header h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 1px;
  color: #00ff88;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.35);
  flex: 1 1 auto;
}

@media (max-width: 560px) {
  .fa-header h2 { font-size: 1.35rem; }
}

.fa-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.fa-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #00ff88;
  border: 1px solid #00ff88;
  color: #000;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .12s ease, filter .18s ease;
  font-size: 18px;
  line-height: 1;
}
.fa-close:hover, .fa-close:focus-visible { filter: brightness(1.06); border-color:#00ff88; }
.fa-close:active { transform: scale(.92); }

/* Main Content Area */
.fa-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 4px 20px;
  scrollbar-width: thin;
  scrollbar-color: #00ff88 #0b0b14;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(var(--dark-color-rgb), 0.6);
    border: 1px solid var(--secondary-color);
    color: var(--primary-color);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    font-size: 18px;
    line-height: 1;
    opacity: .9;
  box-shadow: 0 0 0 2px #0b0b14 inset;
}

.fa-main::-webkit-scrollbar-thumb:hover {
  filter: brightness(1.1);
}

@media (max-width: 560px) {
  .fa-main {
    padding: 2px 2px 16px;
  }
}

/* Content Sections */
.fa-section {
  background: #0b0b11;
  border: 1px solid rgba(0, 255, 136, 0.35);
  border-radius: 14px;
  padding: 14px 14px 12px;
  margin-bottom: 14px;
}

.fa-section h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  letter-spacing: 1px;
  font-weight: 600;
  color: #8ff6ff;
}

.fa-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  gap: 12px;
}

.fa-detail-label {
  color: #9fd;
  font-size: 0.85rem;
  min-width: 100px;
  flex-shrink: 0;
}

.fa-detail-value {
  color: #e5e5e5;
  font-size: 0.85rem;
  text-align: right;
  word-break: break-word;
}

/* Admin Controls */
.fa-admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
}

.fa-admin-btn {
  background: none;
  border: 1px solid #00ff88;
  color: #d6d6d6;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  transition: background 0.2s;
  flex: 1 1 auto;
  min-width: 120px;
}

.fa-admin-btn:hover,
.fa-admin-btn:focus-visible {
  background: #00ff8815;
}

.fa-admin-btn.danger {
  border-color: #ff6060;
  color: #ff9b9b;
}

.fa-admin-btn.danger:hover,
.fa-admin-btn.danger:focus-visible {
  background: rgba(255, 96, 96, 0.15);
}

@media (max-width: 560px) {
  .fa-admin-controls {
    flex-direction: column;
  }
  
  .fa-admin-btn {
    width: 100%;
    min-width: 0;
  }
}

/* Share Section */
.fa-share-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.fa-share-btn {
  background: none;
  border: 1px solid #00ff88;
  color: #d6d6d6;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.fa-share-btn:hover,
.fa-share-btn:focus-visible {
  background: #00ff8815;
}

.fa-share-notification {
  font-size: 0.7rem;
  color: #35ffc9;
  opacity: 0;
  transition: opacity 0.3s;
}

.fa-share-notification.show {
  opacity: 1;
}

/* Comments Section */
.fa-comments-section {
  margin-top: 8px;
}

.fa-comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 60px;
}

.fa-comment-item {
  background: #14141d;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 12px;
  padding: 12px;
}

.fa-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.fa-comment-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fa-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 255, 136, 0.35);
}

.fa-comment-username {
  color: #8ff6ff;
  font-weight: 600;
  font-size: 0.85rem;
}

.fa-comment-actions {
  display: flex;
  gap: 6px;
}

.fa-comment-edit-btn,
.fa-comment-delete-btn {
  background: none;
  border: 1px solid rgba(0, 255, 136, 0.35);
  color: #d6d6d6;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.fa-comment-edit-btn:hover,
.fa-comment-edit-btn:focus-visible,
.fa-comment-delete-btn:hover,
.fa-comment-delete-btn:focus-visible {
  background: #00ff8815;
}

.fa-comment-delete-btn {
  border-color: rgba(255, 96, 96, 0.5);
  color: #ff9b9b;
}

.fa-comment-delete-btn:hover,
.fa-comment-delete-btn:focus-visible {
  background: rgba(255, 96, 96, 0.15);
}

.fa-comment-text {
  color: #e5e5e5;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

.fa-comment-text a {
  color: #35ffc9;
  text-decoration: underline;
}

.fa-comment-text a:hover {
  color: #8ff6ff;
}

.fa-comment-meta {
  margin-top: 8px;
  font-size: 0.65rem;
  opacity: 0.7;
}

.fa-comment-media {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.fa-comment-media:hover {
  opacity: 0.85;
}

/* Comment Form */
.fa-comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.fa-comment-textarea {
  background: #0b0b14;
  color: #e5e5e5;
  border: 1px solid rgba(0, 255, 136, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 80px;
}

.fa-comment-textarea:focus {
  outline: none;
  border-color: #00ff88;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.fa-comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.fa-comment-action-btn {
  background: none;
  border: 1px solid #00ff88;
  color: #d6d6d6;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.fa-comment-action-btn:hover,
.fa-comment-action-btn:focus-visible {
  background: #00ff8815;
}

.fa-comment-action-btn.primary {
  background: #FFD400;
  color: #000;
  border: none;
  font-weight: 700;
}

.fa-comment-action-btn.primary:hover,
.fa-comment-action-btn.primary:focus-visible {
  filter: brightness(1.08);
}

/* Comment Edit Mode */
.fa-comment-item.editing .fa-comment-text {
  display: none;
}

.fa-comment-item.editing .fa-comment-actions {
  display: none;
}

.fa-comment-edit-textarea {
  width: 100%;
  background: #0b0b14;
  color: #e5e5e5;
  border: 1px solid #00ff88;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 8px;
}

.fa-comment-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Empty State */
.fa-empty {
  text-align: center;
  padding: 24px 12px;
  color: #9fd;
  opacity: 0.65;
  font-size: 0.85rem;
}

/* Loading Skeleton */
.fa-skel {
  position: relative;
  background: #14141d;
  overflow: hidden;
  border-radius: 12px;
  height: 80px;
  margin-bottom: 12px;
}

.fa-skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.09) 45%, rgba(255, 255, 255, 0) 90%);
  animation: faShine 1.2s linear infinite;
}

@keyframes faShine {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* Focus Ring Unification */
#feature-area-center-root :focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.5);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  #feature-area-center-root,
  #fa-backdrop,
  #fa-shell,
  .fa-comment-media,
  .fa-comment-action-btn,
  .fa-admin-btn,
  .fa-share-btn {
    transition: none !important;
  }
  
  .fa-skel::after {
    animation: none;
  }
}

/* Safety: Prevent Scroll */
#fa-shell,
.fa-main {
  overscroll-behavior: contain;
}

/* Link Preview Embeds (YouTube, etc.) */
.fa-comment-link-preview {
  margin-top: 10px;
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: 10px;
  overflow: hidden;
  background: #0b0b11;
}

.fa-comment-link-preview iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: none;
}

/* Login prompt for comment form */
.fa-login-prompt {
  text-align: center;
  padding: 16px;
  background: #14141d;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 12px;
  color: #9fd;
  font-size: 0.85rem;
}

.fa-login-prompt a {
  color: #35ffc9;
  text-decoration: underline;
  font-weight: 600;
}

.fa-login-prompt a:hover {
  color: #8ff6ff;
}

/* Confirmation Dialog Overlay */
.fa-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 20px;
}

.fa-confirm-dialog {
  background: #1a1a26;
  border: 2px solid #00ff88;
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 255, 136, 0.3);
  animation: confirmSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes confirmSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fa-confirm-dialog h3 {
  margin: 0 0 16px 0;
  color: #00ff88;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.fa-confirm-dialog p {
  margin: 0 0 24px 0;
  color: #9fd;
  font-size: 1rem;
  line-height: 1.5;
}

.fa-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.fa-confirm-cancel,
.fa-confirm-proceed {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fa-confirm-cancel {
  background: #2a2a36;
  color: #9fd;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.fa-confirm-cancel:hover {
  background: #34343e;
  border-color: rgba(0, 255, 136, 0.5);
  color: #bfe;
}

.fa-confirm-proceed {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
  color: #fff;
  border: 1px solid #ff5555;
}

.fa-confirm-proceed:hover {
  background: linear-gradient(135deg, #ff5555 0%, #dd1111 100%);
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
  transform: translateY(-1px);
}

.fa-confirm-proceed:active {
  transform: translateY(0);
}

/* Edit Mode Styles */
.fa-edit-input,
.fa-edit-textarea {
  width: 100%;
  background: #1a1a26;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  color: #9fd;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.fa-edit-input:focus,
.fa-edit-textarea:focus {
  outline: none;
  border-color: #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.fa-edit-textarea {
  resize: vertical;
  min-height: 80px;
}

.fa-edit-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
}

.fa-edit-save-btn,
.fa-edit-cancel-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fa-edit-save-btn {
  background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
  color: #000;
  border: 1px solid #00ff88;
}

.fa-edit-save-btn:hover {
  background: linear-gradient(135deg, #00ff99 0%, #00dd7b 100%);
  box-shadow: 0 4px 12px rgba(0, 255, 136, 0.4);
  transform: translateY(-1px);
}

.fa-edit-cancel-btn {
  background: #2a2a36;
  color: #9fd;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.fa-edit-cancel-btn:hover {
  background: #34343e;
  border-color: rgba(0, 255, 136, 0.5);
  color: #bfe;
}

.fa-edit-save-btn:active,
.fa-edit-cancel-btn:active {
  transform: translateY(0);
}
