/* Enhanced CSS for BBCode formatting */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: "Helvetica Neue",Helvetica,arial,-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6; 
    color: #333;
    margin: 0 auto;
    font-size: 19px;
}

/* Quote Styling */
blockquote {
    margin: 15px 0;
    padding: 12px 15px;
    border-left: 4px solid #4a90e2;
    background: #f8f9fa;
    border-radius: 0 4px 4px 0;
}

blockquote.user-quote {
    border-left-color: #28a745;
    background: #f0f9f0;
}

blockquote.simple-quote {
    border-left-color: #6c757d;
    background: #f8f9fa;
}

blockquote cite {
    display: block;
    font-weight: bold;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.9em;
}

blockquote cite:before {
    content: "💬 ";
}

/* Reply link styling */
.reply-link {
    background: #e8f4f8;
    padding: 2px 6px;
    border-radius: 3px;
    color: #1565c0;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid #b3e5fc;
}

.reply-link:hover {
    background: #b3e5fc;
    text-decoration: underline;
}

/* User Mentions */
.user-mention {
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    color: #1565c0;
    font-weight: 500;
    text-decoration: none;
}

.user-mention:hover {
    background: #bbdefb;
    text-decoration: underline;
}

.user-mention.unknown {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

/* Quote link styling */
.quote-link {
    display: block;
    background: #e8f5e8;
    padding: 8px 12px;
    border-radius: 4px;
    color: #2e7d32;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 8px;
    border-left: 3px solid #4caf50;
}

.quote-link:hover {
    background: #c8e6c9;
    text-decoration: underline;
}        

/* Links */
.external-link {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid #0066cc;
}

.external-link:hover {
    background: #f0f7ff;
}

header h3 {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 10px
}

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

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

.discussion-container { 
    max-width: 800px; 
    margin: 0 auto; 
}

.discussion-container.about p {
    margin-bottom: 20px;
}

.discussion-header h1 { 
    margin-bottom: 10px; 
    color: #222;
}

.discussion-meta, .comment-meta { 
    color: #666; 
    font-size: 0.9em; 
    margin-bottom: 10px;
    font-weight: bold;
}

.discussion-meta span, .comment-meta span { 
    margin-right: 15px; 
}

.comment-id {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.8em;
}

.comment-id a {
    color: #666;
    text-decoration: none;
}

.comment-id a:hover {
    color: #333;
}

.discussion-content, .comment-content { 
    margin-bottom: 30px; 
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.discussion-content {
    box-shadow: 7px 5px 7px 0px rgba(170,170,170,0.53);        
    border: 1px solid #ddd; 
}

.comment { 
    border: 1px solid #ddd; 
    padding-left: 15px; 
    padding-right: 15px; 
    margin-bottom: 20px;
    -webkit-box-shadow: 7px 5px 7px 0px rgba(170,170,170,0.53); 
    box-shadow: 7px 5px 7px 0px rgba(170,170,170,0.53);            
    padding-top: 12px;
    border-radius: 5px;
}

.discussion-summary {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}

.discussion-summary h3 {
    margin-bottom: 5px;
}

.discussion-summary a {
    text-decoration: none;
    color: #222;
}

.discussion-summary a:hover {
    color: #0066cc;
}

.user-image {
    max-width: 100%;
    height: auto;
    border-radius: 3px;
    border: 1px solid #ddd;
}

.media-embed {
    padding: 10px;
    background: #f0f0f0;
    border-radius: 3px;
    margin: 10px 0;
    border-left: 3px solid #ffc107;
}

pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 3px;
    overflow-x: auto;
    border: 1px solid #ddd;
}

code {
    font-family: 'Courier New', monospace;
    background: #f4f4f4;
    padding: 2px 4px;
    border-radius: 2px;
}

footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #666;
    text-align: center;
}

/* Enhanced Search Controls - Stacked layout */
.search-controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

#searchInput {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#searchButton {
    width: 100%;
    padding: 14px 24px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin-top: 20px;
    text-decoration: none;
}

#searchButton:hover {
    background: #0052a3;
}

.search-filters {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.9em;
    font-weight: bold;
    color: #555;
}

.filter-group input, .filter-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
}

.author-hint {
    font-size: 0.8em;
    color: #888;
    margin-top: 2px;
}

.search-stats {
    margin: 10px 0;
    color: #666;
    font-size: 0.9em;
}

.search-result {
    margin: 15px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
}

.search-result:hover {
    border-color: #4a90e2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 10px;
}

.type-discussion {
    background: #e3f2fd;
    color: #1565c0;
}

.result-meta {
    color: #666;
    font-size: 0.9em;
    margin: 8px 0;
}

.highlighted {
    background: #fff9c4;
    padding: 1px 3px;
    border-radius: 2px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pagination-arrow {
    padding: 8px 16px;
    background: #0066cc;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.pagination-arrow:hover {
    background: #0052a3;
    text-decoration: none;
}

.pagination-arrow.disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

.page-info {
    font-weight: 500;
    color: #333;
}

/* List Styles */
ol, ul {
    margin: 15px 0;
    padding-left: 30px;
}

li {
    margin: 5px 0;
    line-height: 1.5;
}

ol {
    list-style-type: decimal;
}

ol[type="a"] {
    list-style-type: lower-alpha;
}

ol[type="A"] {
    list-style-type: upper-alpha;
}

ol[type="i"] {
    list-style-type: lower-roman;
}

ol[type="I"] {
    list-style-type: upper-roman;
}

ul {
    list-style-type: disc;
}

/* Full-width header */
header {
    background: #10a064;
    box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25);
    width: 100%;
    top: 0;
    z-index: 1000;
    color: #fff;
    padding: 10px 0;
    margin-bottom: 15px;
}

.inner-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

div.logo img {
    max-height: 40px;
    display: block;
}

header nav {
    display: flex;
    gap: 15px;
}

header nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

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

/* Main content container */
main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 20px;
}

/* Desktop-only: Side-by-side layout for search */
@media (min-width: 769px) {
    .search-input-container {
        flex-direction: row;
        align-items: stretch;
    }
    
    #searchInput {
        flex: 1;
    }
    
    #searchButton {
        width: auto;
        min-width: 120px;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {

    body {
        font-size: 16px;
    }

    .search-controls {
        padding: 15px;
    }
    
    .search-filters {
        flex-direction: column;
        gap: 12px;
        margin-top: 15px;
    }
    
    .filter-group {
        min-width: 100%;
        width: 100%;
    }
    
    .inner-container {
        padding: 0 15px;
        flex-wrap: wrap;
    }
    
    div.logo img {
        max-height: 35px;
    }
    
    header nav {
        gap: 10px;
    }
    
    header nav a {
        padding: 6px 10px;
        font-size: 16px;
    }
    
    /* Mobile your-posts form */
    .author-selector {
        padding: 15px;
    }
    
    .content-type-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .content-type-option label {
        height: auto;
        min-height: 60px;
        padding: 15px;
        text-align: center;
        justify-content: center;        
    }
    
    #usernameInput, #findPostsBtn {
        width: 100%;
        font-size: 16px;
    }

    .tpf-archive-banner {
        max-width: 90% !important;
    }
}

@media (max-width: 480px) {
    .search-controls {
        padding: 12px;
    }
    
    .filter-group input, .filter-group select {
        padding: 12px;
    }
    
    header {
        padding: 8px 0;
    }
    
    .inner-container {
        justify-content: center;
        gap: 10px;
    }
    
    header nav {
        justify-content: center;
        width: 100%;
    }
    
    .author-selector {
        padding: 10px;
    }
}

.your-posts-container {
    max-width: 800px;
    margin: 0 auto;
}
.author-selector {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}
.form-hint {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}
.content-type-selector {
    display: flex;
    gap: 20px;
    margin: 15px 0;
}
.content-type-option {
    flex: 1;
}
.content-type-option input[type="radio"] {
    margin-right: 8px;
}
.content-type-option label {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    justify-content: center;    
    height: 85px;
}
.content-type-option input[type="radio"]:checked + label {
    border-color: #0066cc;
    background: #f0f7ff;
}
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}
.results-section {
    margin-top: 30px;
}
.post-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
}
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.post-title {
    font-weight: bold;
    color: #0066cc;
    margin-bottom: 5px;
}
.post-meta {
    color: #666;
    font-size: 0.9em;
}
.post-content {
    margin-top: 10px;
    line-height: 1.5;
    color: #555;
}
.post-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 10px;
}
.type-discussion {
    background: #e3f2fd;
    color: #1565c0;
}
.type-comment {
    background: #f3e5f5;
    color: #7b1fa2;
}
.download-section {
    background: #e8f5e8;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
    margin-bottom: 20px;
    text-align: center;
}
.action-btn {
    background: #0066cc;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin: 0 10px 0 0;
}
.action-btn:hover {
    background: #004385;
}
.action-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}
.stats {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.1em;
}
.error {
    color: #dc3545;
    background: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}
.content-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
}
.badge-both {
    background: #4CAF50;
    color: white;
}
.badge-discussions {
    background: #2196F3;
    color: white;
}
.badge-comments {
    background: #9C27B0;
    color: white;
}
.loading {
    text-align: center;
    padding: 2rem;
}

.loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tpf-archive-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin: 40px auto;
  padding: 14px 18px;

  border-radius: 12px;
  background: moccasin;
  border: 2px solid #999;

  max-width: 800px;
  font-size: 1.2rem;
  line-height: 1.4;
}

.tpf-archive-banner__text {
  flex: 1 1 320px;
}

.tpf-archive-banner__button {
  flex: 0 0 auto;
  text-decoration: none;

  padding: 8px 14px;
  border-radius: 4px;

  background: #2b6cb0;
  color: #fff;
  border: 1px solid #255ea3;

  font-size: 1rem;
  font-weight: 600;

  transition: background 0.15s ease, transform 0.05s ease;
}

.tpf-archive-banner__button:hover {
  background: #255ea3;
}

.tpf-archive-banner__button:active {
  transform: translateY(1px);
}