@font-face {
    font-family: 'Roboto';
    src: url('/fonts/Roboto-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('/fonts/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('/fonts/Roboto-Bold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

body { 
    font-family: 'Roboto', sans-serif;
    max-width: 500px;
    margin: auto; 
    padding: 20px;
    color: #333;
    min-height: 100vh;

    background: 
    linear-gradient(to bottom, #fff7ec, #ffefcc 800px),
    #ffefcc; /* Fallback solid color beyond gradient */
    background-repeat: no-repeat;
    background-size: 100% 800px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    background: #b3cde0;
    color: #2a3d4f;
    border-radius: 8px;
    position: relative;
}

.logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.header-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.header-text {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 4px;
}

h1 {
    margin: 0;
    font-size: 20px;
}

.tagline {
    margin: 0;
    font-size: 14px;
    color: #1f2d3d;
}

nav {
    position: absolute;
    top: 10px;
    right: 10px;
}

nav a {
    color: #2a3d4f;
    text-decoration: none;
    font-size: 14px;
}

textarea {
    width: 100%;
    height: 200px;
    font-size: 15px;
    border-radius: 5px;
    border: 1px solid #999;
    padding: 10px;
    background-color: #f0ebe2;
}

.thread-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

#thread-preview-title {
    display: none;
}

.thread {
    border: 1px solid #888; 
    padding: 10px; 
    margin: 0;
    text-align: left;
    background: #e0d6ca; 
    border-radius: 5px;
    font-size: 15px;
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    min-width: 100%;
    box-sizing: border-box;
}

.thread:not(:last-child)::after, .preview-group:has(.first-thread):not(:last-child) .first-thread::after {
    content: "";
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 20px solid #888;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.preview-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.preview-group .content-warning-preview {
    background-color: #f8d7da;
    border: 1px solid #dc3545;
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 10px 10px 10px 30px;
    margin-bottom: 0;
    font-size: 15px;
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    min-width: 100%;
    box-sizing: border-box;
    position: relative;
}

.content-warning-icon {
    position: absolute;
    left: 5px;
    top: 20px;
    transform: translateY(-50%);
    font-size: 16px;
    color: #dc3545;
}

.preview-group .first-thread {
    border: 1px solid #888;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding: 10px;
    margin: 0;
    text-align: left;
    background: #e0d6ca; 
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    min-width: 100%;
    box-sizing: border-box;
}

.content-warning-wrapper {
    position: relative;
    display: none;
    width: calc(100% - 4px);
    max-width: 496px;
    background-color: #f0ebe2;
    border-bottom: 1px solid #ccc;
    box-sizing: border-box;
    margin: 0 auto;
}

.content-warning-input {
    width: 100%;
    max-width: 496px;
    padding: 10px 10px 10px 30px;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    border: none;
    border-bottom: none;
    background-color: #f0ebe2;
    border-radius: 0;
    box-sizing: border-box;
}

.buttons {
  display: flex;
  flex-direction: row; /* Explicitly set to row for horizontal layout */
  flex-wrap: wrap; /* Allows wrapping on smaller screens if needed */
  align-items: flex-start; /* Aligns items to the top */
  margin-top: 10px; /* Matches existing margin */
  justify-content: flex-start; /* Aligns buttons to the left */
}

.buttons > *:not(:first-child) {
  margin-left: 10px;
}

.btn {
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: white;
    border-radius: 5px;
    vertical-align: middle;
}

.submit-btn {
    background-color: #4a6fa5;
    text-decoration: none;
}

.submit-btn:hover {
    background-color: #3c5a87;
}

.preview-btn {
    background-color: transparent;
    color: #4a6fa5;
    border: 1px solid #4a6fa5;
}

.preview-btn:hover {
    background-color: rgba(74, 111, 165, 0.1);
}

.preview-container {
  display: flex;
  flex-direction: column; /* Stacks Preview button and checkbox vertically */
  align-items: flex-start; /* Aligns content to the left */
}

.btn.preview-btn, .btn.submit-btn {
  padding: 10px 15px; /* Matches existing .btn padding */
  font-size: 16px; /* Matches existing .btn font-size */
  border-radius: 5px; /* Matches existing .btn border-radius */
  cursor: pointer;
  vertical-align: middle; /* Matches existing .btn vertical-align */
}

.live-preview-label {
  font-size: 0.75em; /* Smaller font size for unobtrusive checkbox */
  color: #333; /* Matches existing color scheme */
  margin-top: 5px; /* Small gap below Preview button */
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.live-preview-label input[type="checkbox"] {
  margin-right: 5px; /* Space between checkbox and text */
  transform: scale(0.8); /* Smaller checkbox */
}

.live-preview-label:hover {
  color: #555; /* Matches existing hover effect */
}

.about-link { 
    text-align: center; 
    margin-top: 20px; 
}

.about-link a { 
    text-decoration: none; 
    color: #444; 
}

.success-message {
  background-color: #5c9ead; /* Muted teal for success */
  color: #ffffff; /* White text for contrast */
  padding: 8px 20px; /* Slightly more padding for balance */
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  font-weight: 400; /* Regular weight for readability */
  display: flex;
  align-items: flex-start; /* Align content to top */
  justify-content: space-between; /* Space between message and close button */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); /* Softer shadow */
  max-width: 400px;
  margin: 15px auto; /* Slightly increased margin */
  position: relative;
}

.success-message .message-content {
  flex: 1; /* Takes available space, pushing close button to right */
  padding-right: 10px; /* Prevents text from touching close button */
}

.success-message a {
  color: #d4f0f7; /* Light cyan for links, contrasts with teal */
  text-decoration: none; /* No underline by default */
}

.success-message a:hover {
  text-decoration: underline; /* Underline on hover for clarity */
}

.success-message .close-btn {
  background: transparent;
  border: none;
  color: #ffffff; /* White to match text */
  font-size: 18px;
  font-weight: 600; /* Slightly bolder for visibility */
  cursor: pointer;
  padding: 0 5px;
  position: absolute;
  top: 1px; /* Positioned in upper-right corner */
  right: 1px;
  line-height: 1; /* Prevent vertical stretching */
  transition: color 0.2s ease; /* Smooth hover transition */
}

.success-message .close-btn:hover {
  color: #e0e0e0; /* Slightly darker white on hover */
}

.close-btn {
    position: absolute;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    background: none;
    border: none;
    color: white;
}

.info {
    margin-top: 5px;
}

.info-icon {
    font-size: 18px;
    font-weight: bold;
    color: black;
    text-decoration: none;
}

.info-icon:hover {
    opacity: 0.7;
}

.file-info {
    margin-top: 5px;
    font-size: 14px;
    color: #555;
    display: none;
}

.visibility-dropdown {
    position: relative;
    display: inline-block;
    min-width: 30px;
    vertical-align: middle;
}

.visibility-menu {
    position: absolute;
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10000;
    min-width: 250px;
    right: 0;
    top: calc(100% + 5px);
}

.visibility-option {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.visibility-icon {
    flex: 0 0 24px;
    font-size: 18px;
    line-height: 1.5;
    margin-right: 8px;
}

.visibility-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.visibility-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.visibility-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.visibility-option:hover {
    background-color: #f0f0f0;
}

.visibility-option.selected {
    background-color: #e0e0e0;
    font-weight: bold;
}

.visibility-option.selected .visibility-name {
    font-weight: 600;
}

#languageSelectContainer {
    display: inline-block;
    width: 80px;
    vertical-align: middle;
}

#languageSelectContainer select {
    width: 100%;
    font-size: 0.85rem;
    padding: 5px 6px;
    border: 1px solid #888;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    appearance: auto;
}

.tools-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-top: 0px;
    background-color: #f0ebe2;
    font-size: 0.9rem;
    width: calc(100% - 4px);
    max-width: 496px;
    box-sizing: border-box;
    margin: 0 auto;
}

.textarea-wrapper {
    border: 1px solid #999;
    border-radius: 6px;
    overflow: visible;
    background-color: #f0ebe2;
    box-sizing: border-box;
    width: 100%;
    max-width: 500px;
}

.textarea-wrapper:focus {
    outline: none;
}

.textarea-input:focus {
    outline: none;
}

.textarea-input {
    border: none;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
    width: calc(100% - 4px);
    max-width: 496px;
    padding: 10px;
    background-color: #f0ebe2;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    margin: 0 auto;
    outline: none;
    color: black; /* Text color for contenteditable */
    height: 200px; /* Fixed height, matching original textarea */
    resize: vertical; /* Allow vertical resizing */
    overflow: auto; /* Enable scrolling */
}

.textarea-input:empty:before {
    content: attr(placeholder);
    color: #999; /* Placeholder color */
    pointer-events: none;
}

.post-break {
    color: red; /* Highlight ===== in red */
    position: relative; /* For tooltip positioning */
}

.post-break-tooltip {
    visibility: hidden;
    background-color: #333;
    color: white;
    text-align: center;
    border-radius: 4px;
    padding: 5px 10px;
    position: absolute;
    z-index: 10;
    bottom: 100%; /* Above the text */
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 12px;
}

.post-break:hover .post-break-tooltip {
    visibility: visible; /* Show tooltip on hover */
}

#postContent {
    border: none;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
    width: calc(100% - 4px);
    max-width: 496px;
    padding: 7px;
    background-color: #f0ebe2;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    margin: 0 auto;
    outline: none;
    color: black;
    height: 200px; /* Fixed height, matching original textarea */
    resize: vertical; /* Allow vertical resizing */
    overflow: auto; /* Enable scrolling */
}

.tool-buttons .btn {
    background: none;
    border: 1px solid #888;
    padding: 4px 6px;
    margin-left: 4px;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
}

.tool-buttons .btn:hover {
    background-color: #e0dbd0;
}

emoji-picker {
    display: none;
    position: absolute;
    z-index: 9999;
}

.tool-buttons-active {
    background: #b8ad93 !important;
}

.uploaded-file {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

.uploaded-file p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.media-upload {
    display: none;
}

.remove-media-btn {
    cursor: pointer;
    color: #d9534f;
    font-weight: bold;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.remove-media-btn:hover {
    background-color: #f2dede;
    color: #c9302c;
}

.alt-text-input {
    display: block;
    width: 100%;
    max-width: 300px;
    padding: 5px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.consent-container {
  margin: 15px 0;
  font-size: 0.9em; /* Slightly smaller than main text */
  color: #333; /* Matches body text color */
}

.consent-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
}

.consent-label input[type="checkbox"] {
  margin-right: 8px;
  margin-top: 3px; /* Aligns checkbox with text */
  transform: scale(1.1); /* Slightly larger for visibility */
}

.consent-label:hover {
  color: #555; /* Matches .live-preview-label hover */
}

.sticky-footer {
  text-align: center;
  padding: 20px 0;
  font-size: 0.9em;
  color: #666;
  margin-top: auto; /* Pushes the footer to the bottom of the flex container */
}

.sticky-footer a {
  color: #007bff; /* Link color to match typical web styling, adjust as needed */
  text-decoration: none;
}

.sticky-footer a:hover {
  text-decoration: underline; /* Optional hover effect */
}

/* Mobile view */
@media (max-width: 500px) {
    .textarea-wrapper {
        max-width: 500px;
        border: 2px solid #999;
        width: 100%;
        box-sizing: border-box;
    }

    .content-warning-wrapper {
        max-width: 496px;
        width: 100%;
        box-sizing: border-box;
    }

    .content-warning-input {
        max-width: 496px;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 10px 10px 30px;
    }

    .tools-line {
        max-width: 496px;
        width: 100%;
        box-sizing: border-box;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px;
    }

    .tools-line .info {
        width: 100%;
        text-align: left;
        order: 2;
    }

    .tools-line .tool-buttons {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        order: 1;
    }

    #postContent {
        max-width: 496px;
        width: 100%;
        box-sizing: border-box;
    }

    .visibility-menu {
        right: auto; /* Remove fixed right alignment */
        left: 0; /* Align to the left edge of the parent */
        transform: translateX(-50%); /* Center relative to the button */
        margin-left: 50%; /* Adjust for centering */
        max-width: 90vw; /* Ensure it doesn't exceed viewport width */
    }
}