/* ==================== DIALOGS & MODAL OVERLAYS STYLES ==================== */

/* Backdrop overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-overlay);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Base Modal Card design */
.modal-card {
  background-color: var(--bg-modal);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
  width: 100%;
  animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Close buttons standard */
.modal-close-btn {
  color: var(--text-primary);
  font-size: 1.25rem;
}

.modal-action-btn {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.9rem;
}

.modal-action-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Modal Headers */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-primary);
  background-color: var(--bg-modal);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ==================== MODAL: CREATE POST STYLES ==================== */
.create-post-card {
  max-width: 850px;
  height: 600px;
}

.modal-body-split {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100% - 53px);
  width: 100%;
}

/* Left pane: Media drop-zone */
.create-media-pane {
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  border-right: 1px solid var(--border-primary);
}

.create-media-pane.drag-active {
  border: 3px dashed var(--accent-blue);
  background-color: var(--bg-secondary-hover);
}

.media-select-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-primary);
}

.media-select-prompt .media-icon {
  width: 96px;
  height: 96px;
  stroke-width: 1;
  color: var(--text-secondary);
}

.media-select-prompt p {
  font-size: 1.2rem;
  font-weight: 300;
}

.accent-btn {
  background-color: var(--accent-blue);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
}

.accent-btn:hover {
  background-color: var(--accent-blue-hover);
}

.media-preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.2s ease;
}

/* Right pane: Metadata fields */
.create-details-pane {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  overflow-y: auto;
}

.details-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.details-user-header img {
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius-pill);
}

.details-user-header strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.create-details-pane textarea {
  width: 100%;
  height: 120px;
  border: none;
  background-color: transparent;
  resize: none;
  font-size: 0.9rem;
}

.create-details-pane textarea:focus {
  border: none;
  background-color: transparent;
}

.location-field-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border-secondary);
  border-bottom: 1px solid var(--border-secondary);
  padding: 14px 0;
  color: var(--text-primary);
}

.location-field-wrapper i {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.location-field-wrapper input {
  border: none;
  background-color: transparent;
  flex-grow: 1;
  font-size: 0.9rem;
  padding: 0;
}

.location-field-wrapper input:focus {
  border: none;
  background-color: transparent;
}

/* Upload spinner overlay screen */
.uploading-progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: white;
  z-index: 100;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid var(--accent-blue);
  border-radius: var(--border-radius-pill);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==================== CSS IMAGE FILTERS SPECS ==================== */
.filter-normal {
  filter: none;
}
.filter-clarendon {
  filter: contrast(1.2) saturate(1.35) hue-rotate(-5deg);
}
.filter-gingham {
  filter: sepia(0.04) contrast(0.9) brightness(1.1) saturate(0.95);
}
.filter-lark {
  filter: contrast(0.9) saturate(1.1) brightness(1.1) hue-rotate(5deg);
}
.filter-juno {
  filter: contrast(1.15) saturate(1.15) brightness(1.05) hue-rotate(-10deg) sepia(0.05);
}
.filter-ludwig {
  filter: contrast(1.05) saturate(1.05) brightness(1.05) sepia(0.05) hue-rotate(5deg);
}
.filter-aden {
  filter: hue-rotate(-20deg) saturate(0.85) contrast(0.9) brightness(1.2);
}

.filters-selection-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.filters-selection-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.filters-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.filter-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 72px;
  cursor: pointer;
}

.filter-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--border-radius-md);
  background-image: url('https://images.unsplash.com/photo-1502082553048-f009c37129b9?w=100');
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}

.filter-option.active .filter-preview {
  border-color: var(--accent-blue);
}

.filter-option span {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.filter-option.active span {
  color: var(--accent-blue);
  font-weight: 600;
}

/* ==================== MODAL: POST DETAIL STYLES ==================== */
.modal-outer-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #ffffff;
  font-size: 2rem;
  z-index: 1001;
}

.post-detail-card {
  max-width: 900px;
  height: 600px;
  background-color: var(--bg-primary);
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  height: 100%;
  width: 100%;
}

.detail-media-container {
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
}

.detail-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Comments thread detailed panel */
.detail-comments-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-left: 1px solid var(--border-primary);
}

.detail-comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-secondary);
}

.detail-comments-header .user-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-comments-header .user-block img {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-pill);
}

.detail-comments-header .user-meta {
  display: flex;
  flex-direction: column;
}

.detail-comments-header .user-meta strong {
  font-size: 0.88rem;
}

.detail-comments-header .user-meta span {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.comments-scroll-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Individual Comments Layout inside scroll */
.comment-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.85rem;
}

.comment-item img {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-pill);
  flex-shrink: 0;
}

.comment-content-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comment-username-link {
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 6px;
}

.comment-text {
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.comment-footer-meta {
  display: flex;
  gap: 16px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.comment-footer-meta button {
  font-weight: 600;
}

/* Post Actions inside Detail Modal */
.post-interactions-section {
  padding: 16px 20px 12px;
  border-top: 1px solid var(--border-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions-buttons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-actions {
  display: flex;
  gap: 16px;
}

.actions-buttons-row button {
  color: var(--text-primary);
}

.actions-buttons-row button i {
  width: 24px;
  height: 24px;
}

.likes-count-display {
  font-size: 0.88rem;
  font-weight: 700;
}

.post-date-display {
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.comment-input-bar {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border-secondary);
  gap: 12px;
}

.comment-input-bar input {
  flex-grow: 1;
  border: none;
  background-color: transparent;
  font-size: 0.88rem;
  padding: 4px 0;
}

.comment-input-bar input:focus {
  border: none;
  background-color: transparent;
}

.comment-input-bar button {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.88rem;
}

.comment-input-bar button:disabled {
  opacity: 0.35;
}

/* ==================== MODAL: PROFILE EDIT STYLES ==================== */
.edit-profile-card {
  max-width: 500px;
  max-height: 520px;
}

.edit-profile-body {
  padding: 24px;
  overflow-y: auto;
}

.edit-avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.edit-avatar-row img {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-pill);
}

.avatar-actions {
  display: flex;
  flex-direction: column;
}

.avatar-actions h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.accent-text-btn {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.82rem;
  text-align: left;
}

.accent-text-btn:hover {
  color: var(--accent-blue-hover);
}

.edit-inputs-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.edit-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-input-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.edit-input-group input, .edit-input-group textarea {
  padding: 10px 14px;
  font-size: 0.88rem;
  border-radius: var(--border-radius-md);
}

.edit-input-group textarea {
  height: 80px;
  resize: none;
}

.edit-input-group small {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ==================== MODAL: NEW CHAT SEARCH DIALOG ==================== */
.new-chat-card {
  max-width: 440px;
  height: 480px;
}

.search-users-bar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-primary);
  gap: 16px;
}

.search-users-bar label {
  font-size: 0.95rem;
  font-weight: 600;
}

.search-users-bar input {
  flex-grow: 1;
  border: none;
  background-color: transparent;
  font-size: 0.9rem;
}

.search-users-bar input:focus {
  border: none;
  background-color: transparent;
}

.users-scroll-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Users rows for chat toggles */
.new-chat-user-row {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  gap: 12px;
  transition: background-color var(--transition-fast);
}

.new-chat-user-row:hover {
  background-color: var(--bg-secondary-hover);
}

.new-chat-user-row img {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-pill);
}

.new-chat-user-row .user-meta {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.new-chat-user-row .user-meta .username {
  font-size: 0.88rem;
  font-weight: 600;
}

.new-chat-user-row .user-meta .fullname {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.select-checkbox-indicator {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-focus);
  border-radius: var(--border-radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.new-chat-user-row.selected .select-checkbox-indicator {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.new-chat-user-row.selected .select-checkbox-indicator::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* Responsive adjustments for modal splits */
@media (max-width: 767px) {
  .create-post-card {
    height: 100%;
    border-radius: 0;
    max-height: 100vh;
  }

  .modal-body-split {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 200px;
    height: calc(100% - 53px);
  }

  .create-media-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-primary);
  }

  .post-detail-card {
    height: 100%;
    border-radius: 0;
    max-height: 100vh;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 300px;
  }

  .detail-comments-container {
    border-left: none;
    border-top: 1px solid var(--border-primary);
  }

  .modal-outer-close-btn {
    display: none; /* Hide outer close button on mobile, use inner nav items */
  }
}
