/* ============================================
   Photonicat Forum - Modern UI Overrides
   ============================================ */

/* === Layout === */

.thredded--main-container {
  max-width: 1200px !important;
  width: 100% !important;
  padding: 0.75rem 1rem 1rem !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  color: #1f2937 !important;
}

/* === Remove all thredded borders globally === */

.thredded--main-container *:not(input):not(textarea):not(.CodeMirror):not(.CodeMirror *):not(.editor-toolbar):not(.EasyMDEContainer *) {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
}

/* === Navigation / Header === */

.thredded--main-header {
  background: #ffffff !important;
  border-radius: 0 !important;
  padding: 0.5rem 0 0.25rem !important;
  margin-bottom: 0.5rem !important;
  box-shadow: none !important;
  border: none !important;
}

/* Navigation - single row: breadcrumbs | search | settings */

.thredded--navigation {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.75rem !important;
  flex-wrap: nowrap !important;
  padding: 0 !important;
  position: static !important;
  width: auto !important;
}

.thredded--user-navigation {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  border: none !important;
  border-bottom: none !important;
}

.thredded--user-navigation--item,
.thredded--user-navigation--settings {
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

.thredded--user-navigation--settings a {
  padding: 0 0.5rem !important;
}

.thredded--user-navigation--item .thredded--nav-text {
  display: inline !important;
}

.thredded--user-navigation--item a {
  display: flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
  font-size: 0.8rem !important;
  color: #6b7280 !important;
  padding: 0 0.5rem !important;
  margin: 0 !important;
  line-height: 1 !important;
}

.thredded--user-navigation--item .thredded--icon {
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
}

.thredded--navigation-breadcrumbs {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0.875rem !important;
  white-space: nowrap !important;
}

.thredded--navigation--search {
  position: static !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  width: auto !important;
}

.thredded--navigation--search label {
  display: none !important;
}

.thredded--navigation--search input[type="search"] {
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  padding: 0.4rem 0.75rem !important;
  font-size: 0.85rem !important;
  background: #f9fafb !important;
  width: 200px !important;
}

.thredded--navigation--search input[type="search"]:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
  background: #fff !important;
  outline: none !important;
}

.thredded--navigation--search button[type="submit"] {
  display: none !important;
}

.thredded--navigation a,
.thredded--navigation .thredded--link {
  color: #4b5563 !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  padding: 0.5rem 1rem !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
  text-decoration: none !important;
}

.thredded--navigation a:hover,
.thredded--navigation .thredded--link:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}

.thredded--navigation-breadcrumbs a,
.thredded--navigation .thredded--navigation-breadcrumbs a {
  color: #2563eb !important;
  text-decoration: none !important;
  font-size: 0.875rem !important;
  padding: 0 !important;
  margin: 0 !important;
}

.thredded--navigation-breadcrumbs a:hover {
  text-decoration: underline !important;
}

/* === Messageboard Group Title === */

.thredded--messageboards-group--title {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin-bottom: 1rem !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 2px solid #fbbf24 !important;
}

/* === Messageboard List (line-by-line) === */

.thredded--messageboards {
  display: block !important;
}

.thredded--messageboards-group {
  display: block !important;
  flex-direction: unset !important;
  flex-wrap: unset !important;
  margin: 0 !important;
}

.thredded--messageboards-group::before,
.thredded--messageboards-group::after {
  display: none !important;
}

.thredded--messageboard {
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #e5e7eb !important;
  border-radius: 0 !important;
  padding: 1.25rem 0.5rem !important;
  margin: 0 !important;
  box-shadow: none !important;
  transition: none !important;
  display: block !important;
  flex-basis: unset !important;
  flex-grow: unset !important;
}

.thredded--messageboard:last-child {
  border-bottom: none !important;
}

.thredded--messageboard:hover {
  background: #f9fafb !important;
  transform: none !important;
  box-shadow: none !important;
  border-color: #f3f4f6 !important;
}

.thredded--messageboard--header {
  display: flex !important;
  align-items: baseline !important;
  gap: 0.75rem !important;
}

.thredded--messageboard--title {
  font-size: 1rem !important;
  font-weight: 600 !important;
  margin-bottom: 0 !important;
}

.thredded--messageboard--title a {
  color: #1f2937 !important;
  text-decoration: none !important;
}

.thredded--messageboard--title a:hover {
  color: #2563eb !important;
}

.thredded--messageboard--description {
  color: #6b7280 !important;
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
  margin-bottom: 0 !important;
  flex-basis: 100% !important;
}

.thredded--messageboard--meta {
  border-top: none !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.thredded--messageboard--meta--counts {
  font-size: 0.8rem !important;
  color: #9ca3af !important;
}

.thredded--messageboard--byline {
  font-size: 0.8rem !important;
  color: #9ca3af !important;
}

/* === Grid sizers (masonry) - disable === */

.thredded--grid-sizer,
.thredded--messageboards--grid-sizer {
  display: none !important;
}

/* === Topic List === */

.thredded--topics {
  background: #ffffff !important;
  border-radius: 0 !important;
  border: none !important;
  overflow: visible !important;
  box-shadow: none !important;
}

.thredded--topics--topic {
  padding: 0.5rem 0.75rem !important;
  border-bottom: 1px solid #f3f4f6 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.625rem !important;
  transition: background 0.1s ease !important;
  cursor: pointer !important;
}

.thredded--topics--topic:last-child {
  border-bottom: none !important;
}

.thredded--topics--topic:hover {
  background: #f9fafb !important;
}

.thredded--topics--title {
  flex: 1 !important;
  min-width: 0 !important;
}

.thredded--topics--title a {
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  color: #1f2937 !important;
  text-decoration: none !important;
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  transition: color 0.15s ease !important;
}

.thredded--topics--title a:hover {
  color: #2563eb !important;
}

.thredded--topics--posts-count {
  background: #f3f4f6 !important;
  color: #6b7280 !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 0.25rem 0.75rem !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
  min-width: auto !important;
  width: auto !important;
  height: auto !important;
  line-height: 1.4 !important;
  position: static !important;
  left: auto !important;
}

.thredded--topics--topic {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* === Admin options (sticky/locked checkboxes) === */

.thredded--form-list--admin-options {
  display: flex !important;
  gap: 1.5rem !important;
  padding: 0.5rem 0 !important;
}

.thredded--form-list--admin-options label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  color: #4b5563 !important;
  cursor: pointer !important;
}

.thredded--form-list--admin-options input[type="checkbox"] {
  -moz-appearance: auto !important;
       appearance: auto !important;
  -webkit-appearance: checkbox !important;
  width: 16px !important;
  height: 16px !important;
  cursor: pointer !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: static !important;
}

.thredded--topics--updated-by {
  font-size: 0.75rem !important;
  color: #9ca3af !important;
  white-space: nowrap !important;
}

.thredded--topics--follow-info {
  display: none !important;
}

/* Topic unread indicator */

.thredded--topic-unread .thredded--topics--title a {
  color: #111827 !important;
}

.thredded--topic-unread .thredded--topics--title a::before {
  content: "" !important;
  display: inline-block !important;
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  background: #2563eb !important;
  margin-right: 0.5rem !important;
  vertical-align: middle !important;
}

/* === Topic Header (detail page) === */

.thredded--topic-header {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.25rem 0 !important;
  margin-bottom: 0.375rem !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: baseline !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
}

.thredded--topic-header--title {
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin-bottom: 0 !important;
  line-height: 1.3 !important;
}

.thredded--topic-header--started-by {
  font-size: 0.75rem !important;
  color: #9ca3af !important;
  font-style: normal !important;
}

.thredded--topic-header--follow-info {
  margin-left: auto !important;
}

/* === Posts === */

.thredded--post {
  background: #ffffff !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.625rem 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
  border-bottom: 1px solid #f3f4f6 !important;
  display: grid !important;
  grid-template-columns: 32px 1fr !important;
  gap: 0.5rem !important;
}

.thredded--post--avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  -o-object-fit: cover !important;
     object-fit: cover !important;
}

.thredded--post--header {
  display: flex !important;
  align-items: baseline !important;
  gap: 0.5rem !important;
  flex-wrap: wrap !important;
}

.thredded--post--user {
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  color: #111827 !important;
  margin-bottom: 0 !important;
  display: inline !important;
}

.thredded--post--user a {
  color: #111827 !important;
  text-decoration: none !important;
}

.thredded--post--user a:hover {
  color: #2563eb !important;
}

.thredded--post--created-at {
  font-size: 0.7rem !important;
  color: #9ca3af !important;
  text-decoration: none !important;
}

.thredded--post--content {
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  color: #374151 !important;
  grid-column: 2 !important;
}

.thredded--post--content h1 {
  font-size: 1.375rem !important;
  font-weight: 700 !important;
  margin: 0.75rem 0 0.375rem !important;
  line-height: 1.3 !important;
}

.thredded--post--content h2 {
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  margin: 0.625rem 0 0.25rem !important;
  line-height: 1.3 !important;
}

.thredded--post--content h3 {
  font-size: 1rem !important;
  font-weight: 600 !important;
  margin: 0.5rem 0 0.25rem !important;
  line-height: 1.4 !important;
}

.thredded--post--content h4 {
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  margin: 0.5rem 0 0.25rem !important;
}

.thredded--post--content h5,
.thredded--post--content h6 {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  margin: 0.375rem 0 0.25rem !important;
}

.thredded--post--content p {
  margin-bottom: 0.375rem !important;
}

.thredded--post--content ul,
.thredded--post--content ol {
  margin: 0.25rem 0 0.375rem 1.25rem !important;
  padding: 0 !important;
}

.thredded--post--content ul {
  list-style-type: disc !important;
}

.thredded--post--content ol {
  list-style-type: decimal !important;
}

.thredded--post--content li {
  margin-bottom: 0.25rem !important;
}

.thredded--post--content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 4px !important;
  margin: 0.25rem 0 !important;
}

.thredded--post--content a {
  color: #2563eb !important;
  text-decoration: underline !important;
}

.thredded--post--content a:hover {
  color: #1d4ed8 !important;
}

.thredded--post--content hr {
  border: none !important;
  border-top: 1px solid #e5e7eb !important;
  margin: 1.5rem 0 !important;
}

.thredded--post--content table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 0.75rem 0 !important;
}

.thredded--post--content th,
.thredded--post--content td {
  padding: 0.5rem 0.75rem !important;
  text-align: left !important;
  border-bottom: 1px solid #e5e7eb !important;
}

.thredded--post--content th {
  font-weight: 600 !important;
  background: #f9fafb !important;
}

.thredded--post--content blockquote {
  border-left: 3px solid #d1d5db !important;
  padding: 0.25rem 0.75rem !important;
  margin: 0.375rem 0 !important;
  color: #6b7280 !important;
  background: #f9fafb !important;
  border-radius: 0 4px 4px 0 !important;
  font-size: 0.85rem !important;
}

.thredded--post--content code {
  background: #f3f4f6 !important;
  padding: 0.15rem 0.4rem !important;
  border-radius: 4px !important;
  font-size: 0.85em !important;
  color: #dc2626 !important;
}

.thredded--post--content pre {
  background: #1f2937 !important;
  color: #e5e7eb !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 4px !important;
  overflow-x: auto !important;
  margin: 0.375rem 0 !important;
  font-size: 0.8rem !important;
}

.thredded--post--content pre code {
  background: none !important;
  color: inherit !important;
  padding: 0 !important;
}

.thredded--post--actions {
  grid-column: 2 !important;
}

.thredded--post--actions a {
  font-size: 0.7rem !important;
  color: #9ca3af !important;
  text-decoration: none !important;
  padding: 0.125rem 0.375rem !important;
  border-radius: 4px !important;
  transition: all 0.15s ease !important;
  text-transform: lowercase !important;
}

.thredded--post--actions a:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}

/* === Forms (New Topic / Reply) === */

.thredded--form {
  background: #ffffff !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.5rem 0 !important;
  box-shadow: none !important;
}

.thredded--form-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.thredded--form-list li {
  margin-bottom: 1rem !important;
}

.thredded--form-list label {
  display: block !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  color: #374151 !important;
  margin-bottom: 0.375rem !important;
}

.thredded--form-list input[type="text"],
.thredded--form-list textarea {
  width: 100% !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  padding: 0.625rem 0.875rem !important;
  font-size: 0.95rem !important;
  color: #1f2937 !important;
  background: #ffffff !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
}

.thredded--form-list input[type="text"]:focus,
.thredded--form-list textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
  outline: none !important;
}

.thredded--form-list textarea {
  min-height: 180px !important;
  line-height: 1.6 !important;
  resize: vertical !important;
}

/* === Buttons === */

.thredded--form--submit,
.thredded--button,
input[type="submit"].thredded--form--submit {
  background: #2563eb !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 0.625rem 1.5rem !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.thredded--form--submit:hover,
.thredded--button:hover,
input[type="submit"].thredded--form--submit:hover {
  background: #1d4ed8 !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
}

.thredded--messageboards--actions a {
  background: #2563eb !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  padding: 0.5rem 1rem !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.thredded--messageboards--actions a:hover {
  background: #1d4ed8 !important;
}

/* === New Topic Form - always expanded === */

.thredded--is-compact input[type="submit"],
.thredded--is-compact label {
  height: auto !important;
  margin-bottom: 0.375rem !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.thredded--is-compact li:not(.title) {
  height: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-bottom: 1rem !important;
}

/* === Pagination === */

.thredded--pagination-bottom,
.thredded--pagination-top {
  padding: 1rem 0 !important;
}

.thredded--pagination-bottom a,
.thredded--pagination-top a {
  padding: 0.375rem 0.75rem !important;
  border-radius: 6px !important;
  font-size: 0.875rem !important;
  color: #4b5563 !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.thredded--pagination-bottom a:hover,
.thredded--pagination-top a:hover {
  background: #f3f4f6 !important;
}

/* === Flash Messages === */

.thredded--flash-message {
  border-radius: 8px !important;
  font-size: 0.9rem !important;
}

/* === Spacers / Misc === */

.thredded--spacer {
  display: none !important;
}

.thredded--currently-online {
  display: none !important;
}

/* === SVG Icons === */

.thredded--icon {
  width: 16px !important;
  height: 16px !important;
  fill: #9ca3af !important;
}

/* === Staff Badge === */

.thredded--user-badge {
  display: inline-block !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 0.15rem 0.5rem !important;
  border-radius: 4px !important;
  vertical-align: middle !important;
  margin-left: 0.5rem !important;
  line-height: 1.4 !important;
}

.thredded--user-badge--staff {
  background: #fbbf24 !important;
  color: #78350f !important;
}

/* === Follow button on topic === */

.thredded--topic-header--follow-info a {
  background: #f3f4f6 !important;
  color: #4b5563 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 4px !important;
  padding: 0.2rem 0.625rem !important;
  font-size: 0.7rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.thredded--topic-header--follow-info a:hover {
  background: #e5e7eb !important;
  color: #111827 !important;
}

/* === EasyMDE editor within thredded === */

.thredded--form .EasyMDEContainer {
  width: 100% !important;
}

.thredded--form .EasyMDEContainer .CodeMirror {
  border: 1px solid #d1d5db !important;
  border-radius: 0 0 8px 8px !important;
  min-height: 200px !important;
  font-size: 0.95rem !important;
}

.thredded--form .EasyMDEContainer .editor-toolbar {
  border: 1px solid #d1d5db !important;
  border-bottom: none !important;
  border-radius: 8px 8px 0 0 !important;
}

/* === Responsive === */

@media (max-width: 768px) {
  .thredded--main-container {
    padding: 0.5rem !important;
  }
  .thredded--messageboards {
    grid-template-columns: 1fr !important;
  }
  .thredded--post {
    grid-template-columns: 24px 1fr !important;
    padding: 0.5rem 0 !important;
  }
  .thredded--post--avatar {
    width: 24px !important;
    height: 24px !important;
  }
  .thredded--topic-header {
    padding: 0.5rem !important;
  }
}
