:root {
  --color-background-main: #f5f5f5;
  /* Regular post colors */
  --color-background-post: rgb(248, 243, 226);
  --color-background-post-header: rgb(241, 236, 219);
  --color-border-light: #b0b0b0;

  /* Editable post colors */
  --color-background-edit: #ffffff;
  --color-background-edit-header: #ffffff;
  --color-border-edit: #b7b7b7;

  /* Add missing background color variable */
  --color-background-white: #ffffff;
  --color-background-comment: var(--color-background-white);
  --color-background-comment-hover: #fafafa;
  --color-background-comment-header: #fbfbfb;
  --color-border-comment: #d9d9d9;
  --color-border-transparent: transparent;

  --color-text-timestamp: #888;
  --color-text-comment-id: #707070;
  --color-text-comment-id-hover: #34345c;
  --color-text-reply: red;

  /* Other existing variables */
  --color-border-input: black;
  --color-text-muted: #6c757d;
  --color-text-muted-dark: #495057;

  /* Delete button colors */
  --color-delete: #3d3d3d;
  --color-delete-hover: #1d1d1d;

  --color-background-unread: rgb(255, 246, 219);
  --color-background-unread-header: rgb(255, 243, 209);
  --color-border-unread: #c4a006;

  font-size: 14px;

}

@font-face {
  font-family: 'RuneScapeFont';  /* This is the name you'll use to reference it */
  src: url('/static/fonts/RuneScape-Chat-Bold-07.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* Base styles */
body {
  font-family: 'Courier New';
  margin: 0;
  padding: 0;
  background: var(--color-background-main);
}

/* Layout */
.layout-container {
  display: grid;
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
}

.layout-container-single {
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
}

.fixed-header {
  display: flex;
  justify-content: center;
  font-size: 1.5em;
}

.main-content {
  min-width: 0;
  /* padding-right: 20px; */
}

/* Search and Filters */
.search-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-controls {
  flex: 1;
}

.search-controls input[type="search"] {
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  padding: 0.5rem;
  border: 1px solid var(--color-border-light);
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-dropdown select {
  padding: 0.5rem;
  font-family: inherit;
  font-size: inherit;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-light);
  background-color: white;
  cursor: pointer;
}

.sort-dropdown select:hover {
  border-color: var(--color-border-input);
}

/* Update existing .filters class */
.filters {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  flex-wrap: wrap;
}

.filters input[type="date"] {
  padding: 0.5rem;
  font-family: inherit;
  font-size: inherit;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-light);
}

.nav-buttons {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Posts Base Styles */
.post-item {
  padding: 0;
  margin-bottom: 0.4em;
}

/* Regular posts in feed (non-editable) */
.post-item:not(.editing):not(.single-view) {
  background: var(--color-background-post);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
}

/* Hover effect only for regular posts in feed */
.post-item:not(.editing):not(.single-view):hover {
  border: 1px solid var(--color-border-input);
}

/* For the create post object */
.post-item.editing:not(.single-view) {
  background: var(--color-background-edit);
  border: 1px solid var(--color-border-edit);
}

.post-item.single-view {
  background: var(--color-background-post);
  margin-top: 10px;
  margin-bottom: 0;
  border: 1px solid var(--color-border-light);
}


.post-item.unread:not(.editing):not(.single-view) {
  background: var(--color-background-unread);
  border: 1px solid var(--color-border-unread);
}

.post-item.unread:not(.editing):not(.single-view) .post-header {
  background-color: var(--color-background-unread-header);
  border-bottom: 1px solid var(--color-border-unread);
}

/* hover effect for unread posts */
.post-item.unread:not(.editing):not(.single-view):hover {
  border: 1px solid var(--color-border-input);
}

/* Optional: Add an unread indicator dot */
.post-item.unread:not(.editing):not(.single-view) .post-header:after {}


.post-content {
  padding: 10px;
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  position: relative;
  z-index: 1;
}

/* Regular post header */
.post-item:not(.editing) .post-header {
  background-color: var(--color-background-post-header);
  border-bottom: 1px solid var(--color-border-light);
}

/* Editable post header */
.post-item.editing .post-header {
  background-color: var(--color-background-edit-header);
  border-bottom: 1px solid var(--color-border-edit);
}

.post-header * {
  pointer-events: auto;
}

.post-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
}

.post-textarea-feed,
.post-textarea-edit,
.post-textarea-full {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  margin: 0;
}

.post-textarea-feed {
  height: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.post-textarea-edit {
  height: auto;
  cursor: text;
  padding-bottom: 0.1em;
}

.post-text {
  padding-bottom: 0.5em;
}

.post-textarea-full {
  height: auto;
  padding-bottom: 0.5em;
  cursor: default;
}

/* Button styles remain the same */
.post-button,
.edit-button,
.save-button,
.delete-button,
.add-files-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.post-button:hover,
.edit-button:hover,
.save-button:hover,
.delete-button:hover,
.add-files-button:hover {
  color: var(--color-text-muted-dark);
}

.button-separator {
  color: var(--color-text-muted);
}

/* Comments */
.comments-placeholder {
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem;
  font-style: italic;
}

.comments-section {
  padding: 0;
  border-top: 1px solid #eee;
}

.comment {
  background: var(--color-background-comment);
  border: 1px solid var(--color-border-comment);
  margin: 0.4em 0;
  padding: 0;
}

.comment-header {
  font-size: 0.8rem;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--color-background-comment-header, #f5f5f5);
  border-bottom: 1px solid var(--color-border-comment);
  padding: 4px 6px;
}

.comment-footer {
  font-size: 0.8rem;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--color-background-comment-header, #f5f5f5);
  border-top: 1px solid var(--color-border-comment);
  padding: 4px 6px;
}

.comment-content {
  line-height: 1;
  overflow: hidden;
  overflow-wrap: break-word;
  display: flow-root;
  padding: 12px 12px;
}

.comment-content .reply-link {
  color: var(--color-text-reply);
  text-decoration: none;
  display: inline;
  margin-right: 0.3em;
  text-decoration: underline;
}

.comment-content .reply-link:hover {
  text-decoration: underline;
}

.comment-input {
  border: 1px solid var(--color-border-comment);
  box-sizing: border-box;
}

.comment-input:focus {
  outline: none; 
  border: 1px solid var(--color-border-comment); 
}

.comment-user {
  font-weight: bold;
}

.comment-timestamp,
.timestamp {
  color: var(--color-text-timestamp);
  font-size: 0.875rem;
}

.comment-id {
  color: var(--color-text-comment-id);
  cursor: pointer;
  text-decoration: underline;
}

.comment-id:hover {
  color: var(--color-text-comment-id-hover);
}

.comment-form-title {
  margin-bottom: 0.5em;
}

/* Comment Form */
#comment-form {
  margin: 0;
  padding: 1em;
  background: var(--color-background-comment);
  border: 1px solid var(--color-border-comment);
}

#comment-form textarea {
  font-family: inherit;
  font-size: inherit;
  resize: none;
  width: 100%;
  min-height: 100px;
  margin-bottom: 1em;
}

#comment-form button {
  margin-right: 0.5em;
}

/************* Runescape Text Effects *****************/
/* Basic colors - using exact RS colors */
.rs-yellow { color: #FFFF00; }
.rs-red { color: #FF0000; }
.rs-green { color: #00B000; }
.rs-cyan { color: #00FFFF; }
.rs-purple { color: #800080; }
.rs-white { color: #FFFFFF; }
.rs-orange { color: #FF9900; }
.rs-pink { color: #FF69B4; }
.rs-black { color: #000000; }
.rs-blue { color: #0000FF; }
.rs-light-gray { color: #CCCCCC; }
.rs-dark-blue { color: #000066; }

/* Text shadow for all RS text */
[class*="rs-"] {
  font-family: 'RuneScapeFont', sans-serif;
  font-size: 1.2em;
  text-shadow: 1px 1px black;
  position:relative;
  vertical-align: -0.1em;
}

@keyframes rs-wave {
  0% { bottom: 0px; }
  25% { bottom: 5px; }
  50% { bottom: 0px; }
  75% { bottom: -5px; }
  100% { bottom: 0px; }
}

@keyframes rs-wave2 {
  0% { bottom: 0px; left: 0px; }
  25% { bottom: 2px; left: 2px; }
  50% { bottom: 0px; left: 0px; }
  75% { bottom: -2px; left: -2px; }
  100% { bottom: 0px; left: 0px; }
}

@keyframes rs-shake {
  0%, 100% { bottom: 0px; left: 0px; transform: rotate(0deg);}
  25% { bottom: 1px; left: 1px; transform: rotate(1deg);}
  50% { bottom: -1px; left: -1px; transform: rotate(-1deg);}
  75% { bottom: 1px; left: -1px;transform: rotate(1deg);}
}

/* Color animations */
@keyframes rs-flash1 {
  0% { color: #FF0000; }
  50% { color: #FFFF00; }
}

@keyframes rs-flash2 {
  0% { color: #0000FF; }
  50% { color: #00FFFF; }
}

@keyframes rs-flash3 {
  0% { color: #00B000; }
  50% { color: #80FF80; }
}

@keyframes rs-glow1 {
  0% { color: #FF0000; }
  33% { color: #00B000; }
  66% { color: #0000FF; }
  100% { color: #FF0000; }
}

@keyframes rs-glow2 {
  0% { color: #FF0000; }
  33% { color: #800080; }
  66% { color: #0000FF; }
  100% { color: #FF0000; }
}

@keyframes rs-glow3 {
  0% { color: #FFFFFF; }
  25% { color: #00B000; }
  50% { color: #FFFFFF; }
  67.5% { color: #00FFFF; }
  75% { color: #0000FF; }
  100% { color: #FFFFFF; }
}


/* Image Grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.attachment-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
}

.file-links-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

small {
  color: var(--color-text-timestamp);
  display: block;
  margin-top: 5px;
}

[hx-indicator] {
  display: block;
  text-align: center;
  margin: 20px 0;
}

/* Back Button */
.back-button {
  color: var(--color-text-muted);
  text-decoration: none;
}

.back-button:hover {
  color: var(--color-text-muted-dark);
}

/* Responsive */
@media (max-width: 768px) {
  .search-container {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    flex-wrap: wrap;
  }
}


/* Image attachment styles */
.image-wrapper {
  position: relative;
  display: inline-block;
}

.image-wrapper .delete-attachment-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--color-border-light);
  color: var(--color-delete);
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-delete);
  z-index: 10;
  font-size: inherit;
}

.image-wrapper .delete-attachment-btn:hover {
  color: var(--color-delete-hover);
}

/* File attachment styles */
.file-wrapper {
  align-items: center;
  padding: 0;
  gap: 8px;
  margin-bottom: 4px;
}

/* Audio player styles */
.audio-wrapper {
  width: 100%;
  max-width: 500px;
  margin: 8px 0;
  padding: 8px;
  background: var(--color-background-white);
  border: 1px solid var(--color-border-light);
  box-sizing: border-box;
}

.audio-wrapper audio {
  width: 100%;
  height: 32px;
  margin: 4px 0;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
}

.audio-title {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.audio-wrapper .delete-attachment-btn {
  border: 1px solid var(--color-border-light);
  margin-left: 0.5em;
  color: var(--color-delete);
  cursor: pointer;
  font-size: inherit;
}

.audio-wrapper .delete-attachment-btn:hover {
  color: var(--color-delete-hover);
}


.file-wrapper .delete-attachment-btn {
  border: 1px solid var(--color-border-light);
  margin-left: 0.5em;
  color: var(--color-delete);
  cursor: pointer;
  font-size: inherit;
}

.file-wrapper .delete-attachment-btn:hover {
  color: var(--color-delete-hover);
}

.file-wrapper .attachment-link {
  flex-grow: 1;
}

.delete-comment-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.2s;
  margin-left: auto;
}

.comment-image {
  max-width: 150px;
  max-height: 150px;
  object-fit: cover;
  border-radius: 4px;
  float: left;
  margin-right: 15px;
  margin-bottom: 10px;
}

/* Image attachment styles */
.comment-image-wrapper {
  position: relative;
  float: left;
}