/* ============================================================
   News Aggregator - Shared Stylesheet
   ============================================================

   DESIGN THEME: Earthen Calm

   A soothing design inspired by natural earth tones and organic
   materials. This theme creates a warm, comfortable reading
   environment that's easy on the eyes for extended periods.

   DESIGN PHILOSOPHY:
   - Warm neutrals: Soft browns, beiges, and tans that evoke
     natural materials like clay, sand, weathered wood, and stone
   - Low contrast: Gentle color relationships that reduce eye
     strain during long reading sessions
   - Organic feel: Color palette inspired by nature's earthen
     tones, creating a calming presence
   - Subtle depth: Gentle shadows and rounded corners for a
     softer, more approachable appearance
   - Focus on readability: Enhanced line-height and generous
     spacing prioritize comfortable content consumption

   INSPIRATION:
   - Japanese wabi-sabi aesthetic (beauty in imperfection)
   - Scandinavian design's use of natural tones
   - Artisanal paper and craft materials
   - Coffee shop and reading room atmospheres
   - Earth-toned interior design principles

   COLOR PALETTE:
   - Background: #e9e3d9 (warm sand)
   - Container: #f8f5f0 (cream/off-white)
   - Top bar: #a89176 (warm taupe)
   - Primary text: #3d3229 (dark brown)
   - Links: #4a3f34 (medium brown) → #6b5d4f (hover)
   - Meta text: #7a6b5c (gray-brown)
   - Borders: #d9cfc2 (light tan)
   - Accents: #9b8977 (muted brown)

   This file contains all shared styles for the application.
   Modify this single file to change the look and feel globally.
   ============================================================ */

/* ------------------------------------------------------------
   Reset & Base
   Applied to: all pages (via base.html)
   ------------------------------------------------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: #3d3229;
    background-color: #e9e3d9;
    padding: 20px;
}

/* ------------------------------------------------------------
   Layout - Top Bar
   Applied to: all pages (via base.html header)
   ------------------------------------------------------------ */
.topbar {
    max-width: 800px;
    margin: 0 auto 0;
    padding: 12px 24px;
    background-color: #a89176;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar a {
    color: #f5f1eb;
    text-decoration: none;
}

.topbar a:hover {
    text-decoration: underline;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar .site-name {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.topbar-right {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-right .logout-text {
    color: #f5f1eb;
}

.topbar-right .username-logout {
    color: #f5f1eb;
}

/* ------------------------------------------------------------
   Layout - Main Container
   Applied to: all pages (via base.html)
   ------------------------------------------------------------ */
.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: #f8f5f0;
    padding: 32px;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 2px 8px rgba(61, 50, 41, 0.08);
}

/* ------------------------------------------------------------
   Typography - Headings
   Applied to: all pages
   ------------------------------------------------------------ */
h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #2d241c;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #2d241c;
}

hr {
    border: none;
    border-top: 1px solid #d9cfc2;
    margin: 30px 0;
}

/* ------------------------------------------------------------
   Alerts - Error & Success Messages
   Applied to: login, submit, edit, detail, profile pages
   ------------------------------------------------------------ */
.error {
    background-color: #f4e8e0;
    color: #8b4513;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #d9c3b0;
    white-space: pre-wrap;
}

.message {
    background-color: #e8f0e0;
    color: #556b2f;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c9d9b6;
}

/* ------------------------------------------------------------
   Forms - Inputs, Labels, Textareas, Buttons
   Applied to: login, submit, edit, profile, detail (comment form)
   ------------------------------------------------------------ */
.form-group {
    margin-bottom: 15px;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #5c5041;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9cfc2;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    margin: 0;
    display: block;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #a89176;
    box-shadow: 0 0 0 2px rgba(168, 145, 118, 0.2);
}

.form-hint {
    font-size: 0.85rem;
    color: #9b8977;
    margin-top: 3px;
}

.form-group input[type="checkbox"] {
    width: auto;
    display: inline;
    margin: 0;
}

.form-group-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

button[type="submit"],
button[type="button"],
.btn {
    background-color: #e9e3d9;
    color: #3d3229;
    border: 1px solid #c9bfb0;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
}

button[type="submit"]:hover,
button[type="button"]:hover,
.btn:hover {
    background-color: #d9cfc2;
    border-color: #a89176;
}

form button[type="submit"],
form button[type="button"] {
    margin-top: 5px;
}

/* ------------------------------------------------------------
   News List
   Applied to: index, profile pages
   ------------------------------------------------------------ */
.news-list {
    margin-top: 0;
}

/* ------------------------------------------------------------
   News Item (shared component)
   Applied to: index, detail, profile pages (via news-item.html)
   ------------------------------------------------------------ */
.news-item {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #d9cfc2;
}

.news-item:last-child {
    border-bottom: none;
}

.news-title {
    font-size: 1.05rem;
    color: #2d241c;
    margin-bottom: 6px;
    font-weight: 600;
}

.news-title a {
    color: #4a3f34;
    text-decoration: none;
}

.news-title a:hover {
    color: #6b5d4f;
    text-decoration: underline;
}

.news-title .domain {
    color: #9b8977;
    font-size: 0.85rem;
    font-weight: normal;
}

.news-title .deleted-prefix {
    color: #9b8977;
}

/* ------------------------------------------------------------
   News Meta (points, author, time, comments link)
   Applied to: index, detail, profile pages (via news-item.html)
   ------------------------------------------------------------ */
.news-meta {
    font-size: 0.85rem;
    color: #7a6b5c;
}

.news-meta a {
    color: #7a6b5c;
    text-decoration: none;
}

.news-meta a:hover {
    color: #5c5041;
    text-decoration: underline;
}

.news-meta button {
    background: none;
    border: none;
    color: #7a6b5c;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    text-decoration: none;
    font-family: inherit;
}

.news-meta button:hover {
    color: #5c5041;
    text-decoration: underline;
}

.news-meta form {
    display: inline;
}

/* ------------------------------------------------------------
   News Actions (edit, delete, vote buttons)
   Applied to: index, detail, profile pages (via news-item.html)
   ------------------------------------------------------------ */
.news-actions {
    display: inline;
}

.news-actions a {
    color: #7a6b5c;
    text-decoration: none;
}

.news-actions a:hover {
    color: #5c5041;
    text-decoration: underline;
}

.news-actions form {
    display: inline;
}

.news-actions button,
.news-actions button[type="submit"] {
    background: none !important;
    border: none;
    color: #7a6b5c;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    text-decoration: none;
    font-family: inherit;
}

.news-actions button:hover,
.news-actions button[type="submit"]:hover {
    background: none !important;
    color: #5c5041;
}

/* ------------------------------------------------------------
   Pagination
   Applied to: index page
   ------------------------------------------------------------ */
.pagination-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #d9cfc2;
    text-align: center;
}

.pagination-link {
    color: #7a6b5c;
    text-decoration: none;
    font-size: 0.95rem;
}

.pagination-link:hover {
    color: #5c5041;
    text-decoration: underline;
}

/* ------------------------------------------------------------
   News Detail
   Applied to: detail page
   ------------------------------------------------------------ */
.news-detail {
    margin-top: 0;
}

.news-detail .news-item {
    margin-bottom: 20px;
    padding-bottom: 0;
    border-bottom: none;
}

/* Shared description box styling */
.news-description,
.profile-description {
    margin-top: 20px;
    padding: 15px;
    background-color: #ede9e2;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #3d3229;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ------------------------------------------------------------
   Comments
   Applied to: detail page
   ------------------------------------------------------------ */
.comment-section {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #d9cfc2;
}

.comment-form {
    margin-bottom: 20px;
}

.comment-form textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #d9cfc2;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.comment-form button {
    margin-top: 8px;
}

.comment-form-hidden {
    display: none;
    margin-top: 10px;
}

.comments-list {
    margin-top: 15px;
}

.comment-item {
    margin-bottom: 8px;
}

.comment-header {
    font-size: 0.85rem;
    color: #7a6b5c;
    display: block;
}

.comment-header a {
    color: #7a6b5c;
    text-decoration: none;
}

.comment-header a:hover {
    color: #5c5041;
    text-decoration: underline;
}

.comment-header form {
    display: inline;
}

.comment-header button {
    background: none;
    border: none;
    color: #7a6b5c;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    text-decoration: none;
    font-family: inherit;
}

.comment-header button:hover {
    color: #5c5041;
    text-decoration: underline;
}

.comment-header button.vote-active,
.vote-btn.vote-active {
    color: #a89176;
}

.comment-content {
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    margin: 0;
    padding: 0;
}

.comment-deleted {
    color: #9b8977;
    font-style: italic;
}

.comment-nested {
    margin-left: 25px;
    margin-top: 8px;
    border-left: 1px solid #d9cfc2;
    padding-left: 10px;
}

.comment-quote-line {
    display: inline;
    color: #7a6b5c;
    font-style: italic;
    font-size: 0.85rem;
}

.comment-reply-link {
    color: #7a6b5c;
    text-decoration: none;
    font-size: 0.85rem;
}

.comment-reply-link:hover {
    color: #5c5041;
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Load More / Show Replies
   Applied to: detail page
   ------------------------------------------------------------ */
.load-more-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #d9cfc2;
    text-align: center;
}

.load-more-link {
    color: #7a6b5c;
    text-decoration: none;
    font-size: 0.9rem;
}

.load-more-link:hover {
    color: #5c5041;
    text-decoration: underline;
}

.show-all-replies {
    margin-top: 8px;
    margin-left: 25px;
    font-size: 0.85rem;
}

.show-all-replies a {
    color: #7a6b5c;
    text-decoration: none;
}

.show-all-replies a:hover {
    color: #5c5041;
    text-decoration: underline;
}

.collapse-replies {
    margin-top: 8px;
    margin-left: 25px;
    font-size: 0.85rem;
}

.collapse-replies a {
    color: #7a6b5c;
    text-decoration: none;
}

.collapse-replies a:hover {
    color: #5c5041;
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Edit Page
   Applied to: edit page
   ------------------------------------------------------------ */
.url-display {
    background-color: #ede9e2;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #d9cfc2;
}

.url-display label {
    display: block;
    font-weight: 600;
    color: #5c5041;
    margin-bottom: 5px;
}

.url-display a {
    color: #a89176;
    word-break: break-all;
}

.button-group {
    display: flex;
    gap: 10px;
}

.cancel-link {
    display: inline-block;
    padding: 10px 20px;
    color: #5c5041;
    text-decoration: none;
    border: 1px solid #d9cfc2;
    border-radius: 4px;
    font-weight: 600;
}

.cancel-link:hover {
    background-color: #ede9e2;
}

/* ------------------------------------------------------------
   Profile Page
   Applied to: profile page
   ------------------------------------------------------------ */
.profile-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #d9cfc2;
}

.profile-header h1 {
    margin-bottom: 10px;
}

.profile-meta {
    font-size: 0.9rem;
    color: #7a6b5c;
    margin-bottom: 15px;
}

.profile-meta a {
    color: #7a6b5c;
    text-decoration: none;
}

.profile-meta a:hover {
    color: #5c5041;
    text-decoration: underline;
}

.profile-description.empty {
    color: #9b8977;
    font-style: italic;
}

.edit-description-form {
    margin-top: 15px;
}

.edit-description-form textarea {
    min-height: 100px;
}

.profile-section {
    margin-top: 30px;
    margin-bottom: 10px;
}

.profile-section:first-of-type {
    margin-top: 15px;
}

.other-actions h3 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: #5c5041;
}

.news-section {
    margin-top: 30px;
}

.news-section h2 {
    margin-bottom: 20px;
}

/* ------------------------------------------------------------
   Utility Classes
   Applied to: various pages
   ------------------------------------------------------------ */
.page-title {
    margin-bottom: 20px;
}

.empty-state {
    color: #9b8977;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.no-comments {
    color: #9b8977;
    font-size: 0.9rem;
}

/* ------------------------------------------------------------
   Footer
   Applied to: all pages (via base.html)
   ------------------------------------------------------------ */
.footer {
    max-width: 800px;
    margin: 20px auto 0;
    padding: 15px 0;
    text-align: center;
    font-size: 0.85rem;
}

.footer a {
    color: #7a6b5c;
    text-decoration: none;
}

.footer a:hover {
    color: #5c5041;
    text-decoration: underline;
}

.footer-separator {
    color: #9b8977;
    margin: 0 8px;
}

/* ------------------------------------------------------------
   Static Pages (Terms, Contact)
   Applied to: terms, contact pages
   ------------------------------------------------------------ */
.static-page {
    max-width: 700px;
    margin: 0 auto;
}

.static-page h1 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #2d241c;
}

.static-page h2 {
    font-size: 1.2rem;
    margin-top: 25px;
    margin-bottom: 12px;
    color: #3d3229;
}

.static-page p {
    margin-bottom: 15px;
    line-height: 1.7;
}

.static-page ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.static-page ol li {
    margin-bottom: 12px;
    line-height: 1.7;
}

/* ------------------------------------------------------------
   Responsive - Mobile
   Applied to: all pages
   ------------------------------------------------------------ */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 20px;
    }
    h1 {
        font-size: 1.5rem;
    }
    .footer {
        font-size: 0.8rem;
    }
    /* Hide site name when logged in on mobile */
    .topbar.logged-in .site-name {
        display: none;
    }
}

/* ------------------------------------------------------------
   Moderation Scores (Admin Only)
   Applied to: news items and comments (when user is admin)
   ------------------------------------------------------------ */
.moderation-score {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

.moderation-score.mod-medium {
    background-color: #f9e79f;
    color: #7d6608;
}

.moderation-score.mod-high {
    background-color: #f5b7b1;
    color: #922b21;
}
