/* virus client styles - comprehensive */

* {
  box-sizing: border-box;
}

body {
  font: 13px "Courier New", Courier, monospace;
  margin: 0;
  padding: 0.5em;
  background: #fff;
  line-height: 1.4;
}

/* Posts */
.post {
  margin: 1em 0;
  border: 2px inset #ccc;
  padding: 0.75em;
  background: #fafafa;
}

.post-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.75em;
  padding-bottom: 0.5em;
  border-bottom: 1px dotted #999;
}

.post-header a {
  text-decoration: none;
}

.post-meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.avatar {
  height: 2.5em;
  width: 2.5em;
  border: 1px solid #666;
  border-radius: 2px;
}

.favicon {
  height: 2em;
  width: 2em;
  vertical-align: middle;
}

.author {
  font-weight: bold;
  color: #000;
}

.author .emoji {
  height: 2em;
  width: auto;
  max-width: 2em;
  vertical-align: middle;
  display: inline-block;
}

/* Post actions - visible links */
.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
}

.action-link {
  font-size: 0.85em;
  padding: 0.2em 0.5em;
  text-decoration: none;
  color: #0066cc;
  border: 1px solid transparent;
}

.action-link:hover {
  background: #e6f2ff;
  border-color: #0066cc;
}

.action-link.in-reply {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  font-weight: bold;
}

.action-link.in-reply:hover {
  background: #ffeeba;
}

ruby {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: bottom;
}

ruby > rt {
  font-size: 0.7em;
  color: #666;
  line-height: 1;
}

ruby > rp {
  display: none;
}

.post-timestamp {
  margin-left: 0.5em;
  white-space: nowrap;
}

.timestamp-link {
  text-decoration: none;
  color: inherit;
}

.timestamp-link:hover .timestamp {
  color: #0066cc;
}

.timestamp {
  font-size: 0.9em;
  color: #666;
}

.timestamp time {
  font-family: monospace;
}

/* Content */
.post-content {
  margin: 0.75em 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.post-content a {
  color: #0066cc;
  text-decoration: underline;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  display: inline;
}

.post-content a:hover {
  background: #e6f2ff;
}

/* Spoiler */
.spoiler {
  margin: 0.75em 0;
  padding: 0.5em;
  border: 1px dashed #999;
  background: #f5f5f5;
}

.spoiler summary {
  cursor: pointer;
  font-weight: bold;
  color: #666;
}

.spoiler summary:hover {
  color: #000;
}

/* Media - using relative units for DPI independence */
.media {
  margin: 0.75em 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: center;
}

.media-item {
  display: flex;
  flex-direction: column;
  max-width: 28em;
  flex: 1 1 auto;
}

.media a {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f0f0f0;
}

.media img,
.media video {
  max-width: 100%;
  max-height: 40em;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid #ccc;
}

/* Custom emoji in post content */
.post-content .emoji,
.content .emoji {
  height: 2em;
  width: auto;
  vertical-align: middle;
  display: inline-block;
}

.quoted-content .emoji,
.content .emoji {
  height: 2em;
  width: auto;
  vertical-align: middle;
  display: inline-block;
}

.media img.sensitive,
.media video.sensitive {
  filter: blur(8px);
  transition: filter 0.2s;
}

.media img.sensitive:hover,
.media video.sensitive:hover {
  filter: none;
}

.media audio {
  width: 100%;
}

.media-desc {
  font-size: 0.85em;
  color: #666;
  font-style: italic;
  margin: 0.25em 0;
  max-width: 30em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.media-desc:hover {
  white-space: normal;
  overflow: visible;
  background: #fff;
  border: 1px solid #ccc;
  padding: 0.5em;
  position: relative;
  z-index: 10;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* Poll */
.poll {
  margin: 0.75em 0;
  padding: 0.5em;
  border: 1px solid #ccc;
  background: #f9f9f9;
}

.poll h4 {
  margin: 0 0 0.5em 0;
  font-size: 1em;
}

.poll ul {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.poll li {
  margin: 0.25em 0;
}

/* Reactions */
.reactions {
  margin: 0.5em 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
}

.reactions .emoji {
  height: 2em;
  width: auto;
  vertical-align: middle;
}

.reactions .emoji-text {
  padding: 0.1em 0.3em;
  background: #f0f0f0;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Footer */
.post-footer {
  margin-top: 0.75em;
  padding-top: 0.5em;
  border-top: 1px dotted #999;
  font-size: 0.9em;
}

.post-footer a {
  margin-right: 1em;
  color: #0066cc;
  text-decoration: none;
}

.post-footer a:hover {
  text-decoration: underline;
}

/* Notifications - columns layout: avatar | emoji/type | timestamp | link */
.notif {
  display: grid;
  grid-template-columns: 4em auto auto;
  justify-content: space-between;
  align-items: center;
  justify-items: center;
  gap: 0.5em;
  padding: 0.5em;
  border-bottom: 1px solid #ddd;
}

.notif:last-child {
  border-bottom: none;
}

.notif .avatar {
  height: 2em;
  width: 2em;
  justify-self: center;
}

.notif-emoji {
  height: 2em;
  width: 2em;
  object-fit: contain;
  justify-self: center;
}

.notif-emoji-text {
  height: 2em;
  line-height: 2em;
  padding: 0 0.3em;
  font-size: 1.2em;
  justify-self: center;
}

.notif-type {
  font-weight: bold;
  text-transform: capitalize;
  justify-self: start;
}

.notif .timestamp {
  font-size: 0.85em;
  justify-self: end;
}

/* Load more button */
.load-btn {
  display: block;
  width: 100%;
  padding: 1em;
  margin: 1em 0;
  text-align: center;
  background: #f0f0f0;
  border: 2px outset #ccc;
  text-decoration: none;
  color: #000;
  font-weight: bold;
}

.load-btn:hover {
  background: #e0e0e0;
}

.load-btn:active {
  border-style: inset;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 2em;
  color: #666;
  font-style: italic;
}

/* Forms */
form {
  margin: 0;
}

textarea {
  font: inherit;
  width: 100%;
  min-height: 4em;
  resize: vertical;
  padding: 0.5em;
  border: 2px inset #ccc;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="file"] {
  font: inherit;
  padding: 0.3em;
  border: 2px inset #ccc;
}

input[type="submit"],
button {
  font: inherit;
  padding: 0.5em 1em;
  cursor: pointer;
  border: 2px outset #ccc;
  background: #f0f0f0;
}

input[type="submit"]:active,
button:active {
  border-style: inset;
}

input[type="file"] {
  border: none;
  background: transparent;
}

/* Navigation */
nav {
  margin-bottom: 1em;
  padding: 0.5em;
  background: #f0f0f0;
  border: 1px solid #ccc;
}

nav a {
  color: #0066cc;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

/* Reply context */
.reply-context {
  margin: 1em 0;
  padding: 0.75em;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.reply-context strong {
  display: block;
  margin-bottom: 0.5em;
}

/* Green text */
.green-text {
  color: #789922;
}

/* Utility classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Scrollbars for frames */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Pagination navigation */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75em;
  margin: 0.5em 0;
  background: #f0f0f0;
  border: 1px solid #ccc;
  overflow-x: auto;
  gap: 0.5em;
}

.pagination .nav-title {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.9em;
}

.pagination .nav-btn {
  padding: 0.5em 1em;
  background: #fff;
  border: 2px outset #ccc;
  text-decoration: none;
  color: #000;
  font-size: 0.9em;
  white-space: nowrap;
}

.pagination .nav-btn:hover {
  background: #e8e8e8;
}

.pagination .nav-btn:active {
  border-style: inset;
}

.pagination .nav-btn.disabled {
  background: #ddd;
  color: #999;
  border: 2px solid #ccc;
  cursor: not-allowed;
}

.pagination .nav-btn.has-new {
  background: #90EE90;
  border-color: #228B22;
  font-weight: bold;
  animation: pulse 2s infinite;
}

.pagination .nav-btn.has-new:hover {
  background: #7FDD7F;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 139, 34, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(34, 139, 34, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 139, 34, 0); }
}

.pagination .refresh-btn {
  background: #f0f8ff;
  border-color: #4682b4;
}

/* Thread view styles */
.thread-context {
  margin: 1em 0;
  padding: 0.5em;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
}

.thread-context h3 {
  margin: 0 0 0.5em 0;
  font-size: 0.9em;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.thread-context.parents .post {
  border-left: 3px solid #ccc;
}

.main-post .post {
  border: 3px dashed #0cc;
}

.thread-context.children .post {
  border-left: 3px solid #ccc;
}

/* Account profile */
.account-profile {
  margin: 1em 0;
  border: 2px inset #ccc;
  background: #fafafa;
}

.account-top {
  position: relative;
}

.account-header {
  width: 100%;
  height: 15em;
  background-size: cover;
  background-position: center;
  background-color: #e0e0e0;
}

.account-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
  padding: 0.5em;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
}

.account-info {
  padding: 0.75em;
}

.account-avatar {
  width: 3em;
  height: 3em;
  border: 2px solid #666;
  border-radius: 2px;
  background: #fff;
}

.account-names {
  flex: 1;
  min-width: 0;
}

.account-display-name {
  margin: 0;
  font-size: 1em;
  font-weight: bold;
  line-height: 1.2;
}

.account-display-name .emoji {
  height: 2em;
  width: auto;
  vertical-align: middle;
}

.account-acct {
  margin: 0;
  color: #666;
  font-size: 0.8em;
}

.account-stats {
  display: flex;
  gap: 1em;
  font-size: 0.8em;
  margin-left: auto;
}

.account-stats strong {
  color: #000;
}

.account-note {
  margin: 0.5em 0;
  font-size: 0.85em;
  line-height: 1.3;
  max-height: 4em;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.account-note::after {
  content: "see more";
  position: absolute;
  bottom: 0;
  right: 0;
  background: linear-gradient(to right, transparent, #fafafa 30%);
  padding-left: 3em;
  color: #0066cc;
  font-weight: bold;
  font-size: 0.9em;
}

.account-note:hover {
  max-height: none;
  overflow: visible;
}

.account-note:hover::after {
  display: none;
}

.account-note .emoji {
  height: 2em;
  width: auto;
  vertical-align: middle;
}

.account-fields {
  margin: 0.75em 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5em 1em;
}

.account-fields dt {
  font-weight: bold;
  color: #666;
}

.account-fields dd {
  margin: 0;
}

/* Inline reply form */
.inline-reply-form {
  margin: 1em 0;
  padding: 1em;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.inline-reply-form form {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.inline-reply-form textarea {
  width: 100%;
  padding: 0.5em;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: inherit;
  resize: vertical;
}

.reply-form-actions {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.reply-form-actions input[type="file"] {
  flex: 1;
}

.reply-form-actions button {
  padding: 0.3em 0.8em;
  cursor: pointer;
}

.reply-form-actions button[type="submit"] {
  background: #0066cc;
  color: white;
  border: 1px solid #0055aa;
}

.reply-form-actions button.cancel-reply {
  background: #f0f0f0;
  border: 1px solid #ccc;
}

/* Mode toggle bar below pagination */
.mode-toggle-bar {
  text-align: center;
  padding: 0.5em;
  margin: 0.5em 0;
  background: #f5f5f5;
  border-top: 1px solid #ddd;
}

.mode-toggle-bar .mode-toggle {
  font-size: 0.8em;
  padding: 0.3em 0.8em;
  background: #2c3e50;
  color: white;
  text-decoration: none;
  border-radius: 3px;
  white-space: nowrap;
  display: inline-block;
}

.mode-toggle-bar .mode-toggle:hover {
  background: #34495e;
  text-decoration: none;
}

/* Mode toggle link in pagination */
.pagination .mode-toggle {
  font-size: 0.75em;
  padding: 0.2em 0.5em;
  background: #2c3e50;
  color: white;
  text-decoration: none;
  border-radius: 2px;
  white-space: nowrap;
}

.pagination .mode-toggle:hover {
  background: #34495e;
  text-decoration: none;
}

/* Spacer to push toggle to right in footer */
.pagination .nav-spacer {
  flex: 1;
}

/* Dashboard mode styles */
.dashboard-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 0.5em 0.75em;
  border-bottom: 2px solid #2ecc71;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Prevent scroll jumping when content is added */
#posts-container {
  overflow-anchor: none;
}

#overflow-anchor {
  overflow-anchor: auto;
  height: 2em;
  background: linear-gradient(to bottom, transparent, rgba(46, 204, 113, 0.1), rgba(46, 204, 113, 0.3));
  border: 2px dashed #2ecc71;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  color: #27ae60;
}

#overflow-anchor::after {
  content: "MY EYES, THEY SEE FOREVER";
}

.dashboard-header .dashboard-mode {
  display: inline-block;
  background: #2ecc71;
  color: white;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-header .mode-toggle {
  font-size: 0.8em;
  color: #3498db;
  text-decoration: underline;
  cursor: pointer;
}

.dashboard-header .mode-toggle:hover {
  color: #2980b9;
}

.dashboard-header .last-update {
  font-size: 0.75em;
  color: #7f8c8d;
  margin-left: auto;
  font-family: monospace;
}

/* Reblog banner styles */
.reblog-banner {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.6em;
  margin: 0 0 0.75em 0;
  background: #e8f5e9;
  border: 2px inset #81c784;
  font-size: 0.85em;
}

.reblog-banner .avatar-sm {
  width: 1.5em;
  height: 1.5em;
  border: 1px solid #4caf50;
  border-radius: 2px;
  flex-shrink: 0;
}

.reblog-banner .reblog-text {
  color: #2e7d32;
  font-weight: bold;
}

.reblog-banner .reblog-time {
  margin-left: auto;
  font-size: 0.85em;
  color: #666;
  font-family: monospace;
  flex-shrink: 0;
}

/* Shout box frame styles */
html.frame-shout,
html.frame-shout body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

html.frame-shout form {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.5em;
  box-sizing: border-box;
}

html.frame-shout textarea {
  flex: 1;
  width: 100%;
  resize: none;
  margin-bottom: 0.5em;
  min-height: 0;
}

html.frame-shout .form-row {
  display: flex;
  gap: 0.5em;
  align-items: center;
  flex-shrink: 0;
}

html.frame-shout input[type="file"] {
  flex: 1;
}

html.frame-shout button {
  padding: 0.5em 1em;
  flex-shrink: 0;
}

/* Quoted post styles - nested post appearance */
.quoted-post {
  margin: 0.75em 0;
  padding: 0.5em;
  border: 2px inset #ccc;
  background: #fafafa;
}

.quoted-header {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.5em;
  padding-bottom: 0.5em;
  border-bottom: 1px dotted #999;
  font-size: 0.9em;
}

.quoted-header .avatar-sm {
  width: 2em;
  height: 2em;
  border: 1px solid #666;
  border-radius: 2px;
  flex-shrink: 0;
  display: block;
  object-fit: cover;
}

.quoted-header a {
  display: flex;
  flex-shrink: 0;
}

.quoted-author {
  font-weight: bold;
  color: #000;
}

.quoted-acct {
  color: #666;
  font-size: 0.85em;
}

.quoted-actions {
  margin-left: auto;
  display: flex;
  gap: 0.75em;
}

.quoted-link {
  font-size: 0.85em;
  color: #0066cc;
  text-decoration: none;
}

.quoted-link:hover {
  text-decoration: underline;
}

.quoted-content {
  font-size: 0.9em;
  line-height: 1.4;
  color: #333;
}

.quoted-content p {
  margin: 0.5em 0;
}

.quoted-content p:first-child {
  margin-top: 0;
}

.quoted-content p:last-child {
  margin-bottom: 0;
}

/* User search form styles */
.user-search {
  margin: 0.5em 0;
  padding: 0.5em;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.user-search .search-form {
  display: flex;
  gap: 0.5em;
}

.user-search input[type="text"] {
  flex: 1;
  width: auto;
  min-width: 0;
}

.user-search button {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Login page styles */
.login-page body {
  max-width: 600px;
  margin: 2em auto;
  padding: 1em;
}

.login-page .method {
  margin: 2em 0;
  padding: 1em;
  border: 1px solid #ccc;
}

.login-page input[type="url"],
.login-page input[type="password"] {
  width: 100%;
  margin: 0.5em 0;
  padding: 0.5em;
}

.login-page button,
.login-page input[type="submit"] {
  padding: 0.5em 1em;
  margin: 0.5em 0;
}

.login-page .divider {
  text-align: center;
  margin: 1em;
  font-weight: bold;
}

.login-page .error {
  color: red;
  background: #fee;
  padding: 1em;
  border: 1px solid red;
}

/* Print styles */
@media print {
  .post-footer a[href^="/notice/"],
  .load-btn,
  nav {
    display: none;
  }

  .post {
    border: 1px solid #000;
    break-inside: avoid;
  }

  .dashboard-header {
    display: none;
  }
}
