/* Custom styling for legacy tweet/post components alongside Tailwind */
:root {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

body {
  background-color: #020617;
  color: #e2e8f0;
  line-height: 1.6;
  font-size: 16px;
}

a {
  transition: color 150ms ease;
  color: inherit;
}

a:hover {
  color: #c7d2fe;
}

.posts-section {
  max-width: 600px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

@media (max-width: 767px) {
  .posts-section {
    max-width: 100% !important;
  }
}

.context-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  color: #e2e8f0;
}

.context-selector form {
  position: relative;
}

.context-selector__button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  color: #e2e8f0;
  cursor: pointer;
  font-family: inherit;
}

.context-selector__button:hover {
  color: #f8fafc;
}

.context-selector__chevron {
  color: #94a3b8;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.context-selector__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 180px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  z-index: 100;
  overflow: hidden;
  padding: 0.35rem 0;
}

.context-selector__option {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 0.95rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.context-selector__option:hover {
  background: rgba(148, 163, 184, 0.15);
}

.context-selector__option--selected {
  color: #a5b4fc;
  font-weight: 500;
}

.context-selector__separator {
  color: #64748b;
  font-weight: 300;
  user-select: none;
}

.context-selector__export {
  margin-left: auto;
  color: #64748b;
  opacity: 0.5;
  transition: opacity 150ms ease;
  display: flex;
  align-items: center;
}

.context-selector__export:hover {
  opacity: 1;
}

.tweets-filter,
.tweets-search form {
  position: relative;
}

.tweets-search__form {
  position: relative;
}

.tweets-search__input {
  width: 100%;
  padding: 0.85rem 2.75rem 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
  font-size: 1rem;
  transition: border 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.tweets-search__input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.tweets-search__clear {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #94a3b8;
  padding: 0.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.tweets-search__clear:hover {
  color: #f1f5f9;
  background: rgba(148, 163, 184, 0.15);
}

.tweets-search__clear svg {
  width: 1rem;
  height: 1rem;
}

.tweets-search {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  position: relative;
  margin-bottom: 1rem;
}

.tweets-search form {
  flex: 1;
}

.tweets-search__filter {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  color: #94a3b8;
  cursor: pointer;
  transition: border 150ms ease, background 150ms ease, color 150ms ease;
}

.tweets-search__filter:hover {
  color: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.95);
}

.tweets-search__filter--active {
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.1);
}

.tweets-search__filter--active:hover {
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.6);
}

.tweets-search__dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 200px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  z-index: 100;
  overflow: hidden;
}

.tweets-search__dropdown-header {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.tweets-search__dropdown-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 150ms ease;
  color: #f8fafc;
  font-size: 0.9rem;
}

.tweets-search__dropdown-option:hover {
  background: rgba(148, 163, 184, 0.1);
}

.tweets-search__dropdown-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #6366f1;
  cursor: pointer;
}

.tweet-thread {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
}

.tweet-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.25rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  box-shadow: 0 20px 45px -25px rgba(15, 23, 42, 0.9);
}

.tweet-card:last-child {
  margin-bottom: 0;
}

.tweet-card--reply {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(17, 24, 39, 0.95);
}

.tweet-card--reply::before {
  content: "";
  position: absolute;
  left: 2rem;
  top: -1rem;
  width: 2px;
  height: 1rem;
  background: rgba(99, 102, 241, 0.35);
}

.tweet-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.tweet-card__author {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.tweet-card__author-name {
  color: #f8fafc;
  font-weight: 600;
}

.tweet-card__author-username {
  color: #94a3b8;
  font-size: 0.95rem;
}

.tweet-card__score-button {
  background: rgba(99, 102, 241, 0.15);
  border: none;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font: inherit;
  color: #c7d2fe;
  cursor: pointer;
  font-weight: 600;
}

.tweet-card__score-button:hover,
.tweet-card__score-button:focus-visible {
  background: rgba(99, 102, 241, 0.3);
}

.tweet-card__score--high {
  color: #f87171;
}

.tweet-card__timestamp {
  color: #94a3b8;
  font-size: 0.85rem;
}

.tweet-card__reply-context {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.tweet-card__reply-context span {
  color: #a5b4fc;
}

.tweet-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.tweet-card__body {
  margin-bottom: 1rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tweet-card__body a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.tweet-card__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.tweet-card__meta-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tweet-card__platform-icon {
  display: flex;
  align-items: center;
  color: #64748b;
}

.tweet-card__platform-icon svg {
  width: 18px;
  height: 18px;
}

.tweet-card__meta-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.button {
  color: #cbd5f5;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 0.5rem;
  text-decoration: none;
  padding: 0.15rem 0.35rem;
  transition: color 150ms ease, background 150ms ease;
}

.button:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.15);
}

.button--primary {
  background: linear-gradient(130deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  border-radius: 0.9rem;
  box-shadow: 0 10px 20px -12px rgba(99, 102, 241, 0.9);
}

.button--primary:hover {
  opacity: 0.95;
}

.button--dim {
  color: #64748b;
  opacity: 0.6;
  padding: 0.25rem;
}

.button--dim:hover {
  color: #94a3b8;
  opacity: 1;
  background: rgba(148, 163, 184, 0.1);
}

.metadata-modal,
.noteworthy-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.metadata-modal.is-open,
.noteworthy-modal.is-open {
  display: flex;
}

.metadata-modal__backdrop,
.noteworthy-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(6px);
}

.metadata-modal__dialog,
.noteworthy-modal__dialog {
  position: relative;
  background: #050a1f;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1rem;
  max-width: 90vw;
  max-height: 80vh;
  width: 520px;
  padding: 1.75rem 1.75rem 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(2, 6, 23, 0.8);
  overflow: hidden;
}

.metadata-modal__fields {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metadata-modal__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.metadata-modal__label {
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metadata-modal__value-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metadata-modal__value {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  font-size: 0.9rem;
  word-break: break-all;
}

.metadata-modal__copy {
  padding: 0.45rem 0.75rem;
  background: rgba(79, 70, 229, 0.15);
  border: 1px solid rgba(79, 70, 229, 0.3);
  color: #c7d2fe;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
}

.metadata-modal__copy:hover:not(:disabled) {
  background: rgba(79, 70, 229, 0.3);
}

.metadata-modal__copy:disabled {
  opacity: 0.5;
}

.metadata-modal__content {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 0.5rem;
  max-height: 260px;
  overflow: auto;
}

.metadata-modal__close,
.noteworthy-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
}

/* Form controls */
form label {
  color: #cbd5f5 !important;
  font-weight: 600;
  font-size: 0.9rem;
}

form .text-gray-700,
form .text-gray-600,
form .text-slate-700,
form .text-slate-600 {
  color: #cbd5f5 !important;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  background-color: rgba(15, 23, 42, 0.85) !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  color: #f8fafc !important;
  border-radius: 0.85rem !important;
  padding: 0.75rem 1rem;
  width: 100%;
  transition: border 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background-color: rgba(15, 23, 42, 0.95) !important;
}

input::placeholder,
textarea::placeholder {
  color: rgba(203, 213, 225, 0.65);
}

button:not(.button) {
  color: inherit;
}

.dark-field {
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
}

.dark-field:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background-color: rgba(15, 23, 42, 0.95);
}

body .text-gray-900,
body .text-gray-800,
body .text-gray-700,
body .text-gray-600,
body .text-gray-500,
body .text-slate-700,
body .text-slate-600 {
  color: #e2e8f0 !important;
}

body .bg-white {
  background-color: rgba(15, 23, 42, 0.85) !important;
}

body .border-gray-200,
body .border-gray-300 {
  border-color: rgba(148, 163, 184, 0.2) !important;
}

/* Post embeds */
.post-embeds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.post-embed {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
}

.post-embed--image,
.post-embed--video {
  max-width: 100%;
}

.post-embed--image img,
.post-embed--video video {
  display: block;
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.post-embed--link {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease, background 150ms ease;
}

.post-embed--link:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(15, 23, 42, 0.8);
}

.post-embed__link-content {
  padding: 0.75rem 1rem;
}

.post-embed__link-url {
  font-size: 0.85rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.post-embed__link-title {
  font-weight: 600;
  color: #c7d2fe;
  margin-bottom: 0.25rem;
}

.post-embed__link-description {
  font-size: 0.9rem;
  color: #94a3b8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  pointer-events: none;
}

.mobile-menu.is-open {
  display: block;
  pointer-events: auto;
}

.mobile-menu__backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(4px);
}

.mobile-menu__panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.mobile-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  flex-shrink: 0;
}

.mobile-menu__close {
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: background 150ms ease, color 150ms ease;
}

.mobile-menu__close:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #f8fafc;
}

.mobile-menu__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}

.mobile-menu__link {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #e2e8f0 !important;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.mobile-menu__link:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #f8fafc !important;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .tweet-card__author {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }

  .tweet-card__author-username {
    font-size: 0.9rem;
  }
}
