/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Source+Sans+3:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&display=swap');

/* --- Global Styles & Color/Font Variables --- */
:root {
    --primary-color: #4a69bd; /* A stylish slate blue */
    --primary-hover: #3c5699;
    --accent-color: #f0ad4e;  /* A warm gold for stars/accents */
    --danger-color: #d9534f;
    --danger-hover: #c9302c;
    --text-color: #212529;
    --text-muted: #6c757d;
    --bg-color: #f4f6f9;      /* A very light, cool gray */
    --container-bg: #ffffff;
    --border-color: #e9ecef;
    --border-radius: 8px;
    --font-family-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: 'Playfair Display', Georgia, 'Times New Roman', Times, serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-body); /* <-- Use the new body font */
    line-height: 1.7; /* <-- Increase line-height slightly for better readability */
    font-size: 16px;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

p {
  margin-bottom: 1.2em;
}
/* --- Sticky Footer Layout --- */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex-grow: 1; }

/* --- New Header & Navigation System --- */
header {
    background-color: var(--container-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 999;
}
nav {
    max-width: 1200px; /* Wider for a more modern feel */
    margin: 0 auto;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nav-link-special {
    color: var(--accent-color); /* Use the gold accent color */
    font-weight: 600; /* Make it a bit bolder */
}

.nav-link-special:hover {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color) !important; /* Keep the accent color for the underline on hover */
}

.site-branding { margin-right: 20px; }
.site-title { font-size: 1.5em; font-weight: 700; color: var(--text-color); font-family: var(--font-family-heading);}
.site-tagline { font-size: 0.9em; font-style: italic; color: var(--text-muted); margin: -5px 0 0 0; padding: 0; font-family: var(--font-family-heading);}
.nav-links { display: flex; gap: 20px; }
.nav-links a { font-weight: 500; padding: 5px 0; border-bottom: 2px solid transparent; transition: all 0.2s; }
.nav-links a:hover { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.auth-links { display: flex; align-items: center; gap: 10px; }

/* --- Typography & Links --- */
h1, h2, h3 {
  font-family: var(--font-family-heading);
  line-height: 1.3;
  font-weight: 700;
  }/* <-- Use a bolder weight for the serif font */
a { color: var(--primary-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

/* --- Forms & Dynamic Buttons --- */
/* --- Forms & Professional Button System --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 12px; box-sizing: border-box; border: 1px solid var(--border-color);
    background-color: #fff; font-size: 1em; border-radius: var(--border-radius);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-family-body);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.25);
}
.form-actions { display: flex; gap: 15px; align-items: center; margin-top: 20px; }


/* 1. Base .btn class: Defines SIZE, SHAPE, and INTERACTION for ALL buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
    user-select: none;
    font-family: var(--font-family-body); /* <-- ADD THIS LINE */
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 2. Color Modifier Classes */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn-secondary {
    background-color: var(--bg-color); /* A light gray, almost white */
    border-color: var(--border-color);
    color: var(--text-color);
}
.btn-secondary:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: var(--text-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}
.btn-danger:hover {
    background-color: var(--danger-hover);
    border-color: var(--danger-hover);
    color: #fff;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: #fff;
}

/* 3. Size Modifier Classes */
.btn-small {
    padding: 5px 12px;
    font-size: 0.8em;

    /* --- THESE ARE THE FIXES --- */
    /* 1. Ensure both <a> and <button> use the same box model */
    box-sizing: border-box;

    /* 2. Set a line-height to normalize vertical alignment */
    line-height: 1.5;

    /* 3. Ensure the font is explicitly inherited and consistent */
    font-family: var(--font-family);
}

/* --- Post Actions (Report/Feature Buttons) --- */
.post-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
}
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    width: 100%; /* Make it match the width of the other sidebar buttons */
    box-sizing: border-box;
    justify-content: center;
    color: var(--text-color);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.btn-share:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.btn-share svg {
    stroke-width: 2.5;
}

/* Dark mode hover state */
body.dark-mode .btn-share:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--container-bg);
}
.btn-report {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 5px 10px;
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: background-color 0.2s, color 0.2s;
}

.btn-report:hover {
    background-color: #f8d7da; /* A light, danger-associated red */
    color: var(--danger-color);
}

.btn-report svg {
    /* The SVG will inherit the color from the button's text color */
    stroke-width: 2.5;
}

/* Dark mode specific hover state for the report button */
body.dark-mode .btn-report:hover {
    background-color: #4a1d1f;
    color: #f8b4b7;
}
/* --- Component Specific Styles --- */
/* --- New Post Card Design (replaces old .post style) --- */
.post-card {
    display: flex;
    gap: 20px;
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.2s ease-in-out;
}
.post-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}
.post-card-author {
    flex-shrink: 0;
}
.post-card-content {
    flex-grow: 1;
}
.post-card-content .post-meta {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.post-card-content .author-name-link {
    font-weight: 600;
    color: var(--text-color);
}
.post-card-content .meta-divider {
    color: var(--text-muted);
}
.post-card-title {
    margin: 0 0 10px 0;
    font-size: 1.4em;
}
.post-card-title a {
    color: var(--text-color);
    text-decoration: none;
}
.post-card-title a:hover {
    color: var(--primary-color);
}
.post-card-tags {
    margin-bottom: 10px;
}
.post-card-tags .tag-link {
    background-color: #e9ecef;
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    margin-right: 5px;
    display: inline-block;
    margin-bottom: 5px;
}
.post-card-tags .tag-link:hover {
    background-color: #d1d9e2;
    color: var(--text-color);
}
.post-card-snippet {
    font-size: 0.95em;
    color: var(--text-muted);
    margin: 0;
}

/* Dark Mode Adjustments */
body.dark-mode .post-card-content .author-name-link,
body.dark-mode .post-card-title a {
    color: var(--text-color);
}
body.dark-mode .post-card-tags .tag-link {
    background-color: #21262d;
    color: var(--primary-color);
}
body.dark-mode .post-card-tags .tag-link:hover {
    background-color: #30363d;
}

/* Main Content Container */
main .container {
    max-width: 800px; margin: 30px auto; padding: 20px;
    background-color: var(--container-bg);
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
}

/* Flash Messages */
.flash { padding: 15px; margin-bottom: 20px; border-left: 4px solid #333; border-radius: var(--border-radius); }
.flash.success { border-color: #28a745; background-color: #e9f7ec; }
.flash.danger { border-color: var(--danger-color); background-color: #fdf5f5; }

/* Posts & Tags */
.post { border-bottom: 1px solid var(--border-color); padding-bottom: 20px; margin-bottom: 20px; }
.post:last-child { border-bottom: none; }
.post-meta { font-size: 0.9em; color: var(--text-muted); }
.post-content { white-space: pre-wrap; }
.post-content img { max-width: 100%; height: auto; display: block; margin: 25px auto; box-shadow: var(--box-shadow); border-radius: var(--border-radius); border: 1px solid var(--border-color); }
/* The Lobotomized Owl Selector for clean paragraph spacing */
/* 1. Reset the margins on ALL paragraphs inside a post */
.post-content p {
    margin-top: 0;
    margin-bottom: 0;
}

/* 3. Handle spacing for other elements, like lists or headers, to ensure consistency */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content ul,
.post-content ol,
.post-content blockquote {
    margin-bottom: 1.6em;
}
.category-list { padding: 15px; margin-bottom: 25px; background-color: #fbfbfb; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.post-meta a[href*="/tag/"] {
    background-color: #e9ecef; color: var(--text-muted); padding: 3px 8px;
    border-radius: 4px; font-size: 0.9em; font-weight: 500; margin: 0 2px;
}
.post-meta a[href*="/tag/"]:hover { background-color: #d1d9e2; color: var(--text-color); }
/* --- Post Header Grid Layout --- */
.post-header-grid {
    display: flex;
    flex-direction: column; /* Stack the items vertically */
    gap: 15px; /* Create consistent space between title, notice, and date */
    margin-bottom: 20px; /* Space below the date/border */
    border-bottom: 1px solid var(--border-color); /* The main separator */
    padding-bottom: 20px;
}

/* Remove individual margins now that the grid handles spacing */
.post-header-grid h1,
.post-header-grid .reported-notice,
.post-header-grid .post-publication-date {
    margin: 0;
    padding: 0;
}
.post-publication-date {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-muted);
    margin: -30px 0 20px 0; /* Use negative top margin to pull it closer to the title */
    padding-bottom: 20px;
}

.comments-section { margin-top: 40px; border-top: 1px solid var(--border-color); padding-top: 20px; }
.comment { border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 15px; margin-bottom: 15px; background-color: #fbfbfb; }
.comment-meta { font-size: 0.9em; color: var(--text-muted); margin: 0 0 10px 0; }
.comment p { margin: 0; }
.comment-body { display: flex; gap: 15px; align-items: flex-start; }
.comment-list {
    margin-top: 20px;
}

/* Search Bar */
.search-form { margin: 0; }
.search-form form { display: flex; align-items: center; background-color: #f1f1f1; border-radius: var(--border-radius); padding: 4px; border: 1px solid transparent; transition: all 0.2s; }
.search-form form:focus-within { border: 1px solid var(--primary-color); background-color: #fff; }
.search-form input[type="search"] {
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 0.9em;
    width: 180px;
    font-family: var(--font-family-body); /* <-- ADD THIS LINE */
}
.search-form input[type="search"]:focus { outline: none; }
.search-form button { background: none; border: none; padding: 8px 12px; cursor: pointer; color: var(--text-muted); }
.search-form button:hover { color: var(--primary-color); }
.search-form button svg { display: block; }

/* User Menu Dropdown */
.user-menu { position: relative; }
.user-menu-summary { list-style: none; cursor: pointer; display: block; position: relative; }
.user-menu-summary::-webkit-details-marker { display: none; }
.user-menu-summary img, .user-avatar-text { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid transparent; transition: border-color 0.2s; }
.user-menu-summary:hover img, .user-menu-summary:hover .user-avatar-text { border-color: var(--primary-color); }
.notification-indicator { position: absolute; top: 0; right: 0; width: 12px; height: 12px; background-color: var(--danger-color); border-radius: 50%; border: 2px solid var(--container-bg); }
.user-menu-dropdown {
    position: absolute; top: calc(100% + 10px); right: 0; background-color: var(--container-bg);
    border: 1px solid var(--border-color); border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    width: 240px; z-index: 1000; padding: 8px 0; opacity: 0; transform: translateY(-10px);
    visibility: hidden; transition: all 0.2s ease-in-out;
}
.user-menu[open] > .user-menu-dropdown { opacity: 1; transform: translateY(0); visibility: visible; }
.dropdown-header { padding: 8px 16px; font-size: 0.9em; color: var(--text-muted); }
.dropdown-divider { height: 1px; background-color: var(--border-color); margin: 8px 0; }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; color: var(--text-color); text-decoration: none; font-size: 0.9em; font-weight: 500; }
.dropdown-item:hover { background-color: var(--bg-color); color: var(--primary-color); }
.notification-count-badge { background-color: var(--primary-color); color: white; font-size: 0.8em; font-weight: bold; padding: 2px 6px; border-radius: 10px; }
.user-avatar-text { background-color: var(--primary-color); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.2em; font-weight: 600; user-select: none; }
/* --- User Pronouns (Profile Page) --- */
.user-pronouns {
    font-style: italic;
    font-size: 0.9em;
    color: var(--text-muted);
    /* We changed the -10px to a positive value to add space */
    margin: 8px 0 15px 0;
}
/* 1. Main Grid Container for the Footer */
footer {
    background-color: #343a40;
    color: #f8f9fa;
    padding: 40px 20px;
    margin-top: 0;
}

/* --- Main Grid Container for the Footer --- */
.footer-content {
    max-width: 1200px; /* Allow it to be a bit wider for 4 columns */
    margin: 0 auto;
    display: grid;
    /* On small screens, it's a single column */
    grid-template-columns: 1fr;
    gap: 30px;
}

/* --- On medium screens and up, switch to multiple columns --- */
@media (min-width: 768px) {
    .footer-content {
        /* On tablets, a 2x2 grid looks good */
        grid-template-columns: 1fr 1fr;
    }
}

/* --- On large screens, switch to the full 4-column layout --- */
@media (min-width: 1024px) {
    .footer-content {
        /* Explicitly create 4 columns and let them share space */
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 2. General Styles for ALL link sections */
.footer-links h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #f8f9fa;
    border-bottom: 1px solid #495057;
    padding-bottom: 10px;
}
.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-links ul li {
    margin-bottom: 10px;
}
.footer-links ul li a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.2s;
}
.footer-links ul li a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* 3. Specific Grid for the TWO-COLUMN Navigation section */
.footer-nav-links .footer-links-grid {
    display: grid;
    /* Create two equal-width columns INSIDE this section */
    grid-template-columns: 1fr 1fr;
    gap: 15px 30px;
}

/* 4. Styles for the Info/Branding section */
.footer-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #f8f9fa;
    border-bottom: 1px solid #495057;
    padding-bottom: 10px;
}
.footer-tagline {
    font-style: italic;
    color: #e9ecef;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #495057;
}
.footer-info p:last-child {
    font-size: 0.9em;
    color: #adb5bd;
}
.footer-action h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #f8f9fa;
    border-bottom: 1px solid #495057;
    padding-bottom: 10px;
}

.footer-action p {
    font-size: 0.9em;
    color: #adb5bd;
    margin-bottom: 15px;
}

.footer-action .btn {
    text-align: center;
}

/* Cookie Banner */
#cookie-consent-banner { position: fixed; bottom: 0; left: 0; width: 100%; background-color: rgba(33, 37, 41, 0.95); color: #f8f9fa; padding: 15px 20px; box-sizing: border-box; display: none; align-items: center; justify-content: space-between; gap: 20px; z-index: 1000; opacity: 1; transition: opacity 0.5s; }
#cookie-consent-banner .cookie-text { margin: 0; font-size: 0.9em; }
#cookie-consent-banner #cookie-accept-btn { background-color: var(--container-bg); color: var(--text-color); padding: 8px 15px; flex-shrink: 0; }
#cookie-consent-banner #cookie-accept-btn:hover { background-color: #e2e6ea; }

/* Account Page Tabs */
.stats-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; margin-bottom: 40px; text-align: center; }
.stat-card { background-color: #fbfbfb; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 20px; }
.stat-card h3 { margin: 0 0 10px 0; font-size: 1em; color: var(--text-muted); font-weight: 500; }
.stat-card p { margin: 0; font-size: 2em; font-weight: 700; color: var(--primary-color); }
/* --- Stat Card Subtext --- */
.stat-subtext {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}
/* --- Account Page Tab Styles --- */
.tabs-container {
    margin-top: 40px;
}
/* Style the tab links container */
.account-tabs {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    flex-wrap: wrap; /* This allows tabs to drop to a new row */
}
/* Style the individual tab buttons */
.account-tabs button.tab-link {
    background-color: #f1f1f1;
    border: none;
    border-right: 1px solid var(--border-color);
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: all 0.3s;
    font-size: 1em;
    font-weight: 500;

    flex-grow: 1;
    flex-basis: 0; /* Allows them to grow from a base of 0 */
    text-align: center;

    border-bottom: 3px solid transparent;
}
/* Remove the border from the very last button to avoid a double line */
.account-tabs button.tab-link:last-child {
    border-right: none;
}
.account-tabs button.tab-link:hover { background-color: #e9ecef; }
.account-tabs button.tab-link.active { background-color: var(--container-bg); border-bottom: 3px solid var(--primary-color); color: var(--primary-color); }
.account-tab-content { display: none; padding: 20px; border: 1px solid var(--border-color); border-radius: 0 0 var(--border-radius) var(--border-radius); }
.account-tab-content#danger-zone { border-color: var(--danger-color); background-color: #fdf5f5; }
.account-tab-content#danger-zone h2 { color: var(--danger-color); margin-top: 0; }

/* Account Page Navigation */
.account-nav { display: flex; gap: 20px; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.account-nav a { font-weight: bold; color: var(--text-muted); }
.account-nav a:hover { color: var(--text-color); }

/* Link Management */
.link-management { margin-bottom: 40px; }
.link-add-form { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.link-add-form input { flex-grow: 1; }
.user-links-list { margin-top: 20px; }
.user-link-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 10px; }
.user-link-item span { word-break: break-all; }
/* --- Link Display (Profile Page) --- */
.user-links {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Increase the gap for more breathing room */
    justify-content: center;
}

/* Style the container for each link */
.user-link-item-profile {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
}
.user-link-item-profile:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
    border-color: var(--primary-color);
}

/* The link itself now just inherits styles */
.user-link-item-profile .btn-link {
    display: flex; /* <-- CHANGE to flex */
    align-items: center; /* <-- ADD this */
    gap: 10px;           /* <-- ADD this */
    padding: 10px 18px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9em;
}

/* Add a style for the icon container */
.link-icon {
    display: inline-flex;
    align-items: center;
}

/* Dark Mode Adjustments */
body.dark-mode .user-link-item-profile {
    background-color: #21262d;
}
body.dark-mode .user-link-item-profile:hover {
    border-color: var(--primary-color);
}

/* Collapsible Image Uploader */
.image-uploader-details {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    background-color: var(--bg-color); /* <-- Use the theme-aware variable */
}
.image-uploader-details summary { font-weight: 600; padding: 12px 15px; cursor: pointer; outline: none; }
.image-uploader-details summary::marker { color: var(--primary-color); }
.image-uploader-details[open] > summary { border-bottom: 1px solid var(--border-color); }
.image-upload-form-content { padding: 15px; }
.image-upload-form-content p { font-size: 0.9em; color: var(--text-muted); margin-top: 0; }
#upload-status { margin-left: 15px; font-weight: bold; }

/* User List (Followers/Following Pages) */
.user-list { margin-top: 20px; }
.user-list-item { display: flex; align-items: center; justify-content: space-between; padding: 15px; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 10px; }
.user-list-item .user-info a { display: flex; align-items: center; gap: 15px; font-weight: bold; color: var(--text-color); }
.user-list-item .user-info a:hover { text-decoration: underline; }
.profile-pic-small { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }

/* General Table Styles (Admin, Account, etc.) */
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid var(--border-color); padding: 12px; text-align: left; vertical-align: middle; }
th { background-color: #f8f9fa; font-weight: 600; }
.action-buttons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.action-buttons form { margin: 0; }
.action-buttons a, .action-buttons button { min-width: 80px; text-align: center; flex-shrink: 0; }

/* Misc & Pages */
.site-statement { background-color: var(--container-bg); padding: 30px; margin-bottom: 30px; border: 1px solid var(--border-color); border-radius: var(--border-radius); text-align: center; }
.spinner { border: 4px solid rgba(0, 0, 0, 0.1); width: 36px; height: 36px; border-radius: 50%; border-left-color: var(--primary-color); animation: spin 1s ease infinite; margin: 0 auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.btn-feature { background:none; border:1px solid var(--accent-color); color:var(--accent-color); padding: 5px 10px; cursor:pointer; border-radius:var(--border-radius); font-weight:500; }
.featured-post-section { padding:20px; border:2px solid var(--accent-color); border-radius:var(--border-radius); margin-bottom:30px; }
.featured-post-section h2 { margin-top:0; color:var(--accent-color); }
.btn-theme-toggle { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-color); padding: 8px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.btn-theme-toggle:hover { background-color: #f1f1f1; }
.btn-theme-toggle .moon-icon { display: none; }
.btn-theme-toggle .sun-icon { display: block; }
.drafts-management, .posts-management { margin-top: 20px; }

/* --- Dark Mode Theme (Accessibility Focused) --- */
body.dark-mode {
    /* 1. New Color Palette: High contrast, low eye strain */
    --primary-color: #6ea8ff;      /* A brighter, more accessible blue for links */
    --primary-hover: #8bbaff;
    --text-color: #e0e0e0;          /* Off-white for reduced eye strain */
    --text-muted: #8b949e;          /* A muted gray for secondary text */
    --bg-color: #0d1117;            /* Off-black, GitHub-style background */
    --container-bg: #161b22;        /* A slightly lighter container background */
    --border-color: #30363d;        /* A subtle border color */
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* 2. Component-Specific Overrides for Readability */

/* Headers and Links */
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: #c9d1d9; /* A slightly brighter white for headers */
}

/* Dark Mode: Forms and Inputs (Corrected and Expanded) */
body.dark-mode .search-form input[type="search"]::-webkit-input-placeholder { color: var(--text-color); }
body.dark-mode .search-form input[type="search"]:-moz-placeholder { color: var(--text-color); opacity: 1; }
body.dark-mode .search-form input[type="search"]::-moz-placeholder { color: var(--text-color); opacity: 1; }
body.dark-mode .search-form input[type="search"]:-ms-input-placeholder { color: var(--text-color); }
body.dark-mode .search-form input[type="search"]::-ms-input-placeholder { color: var(--text-color); }
body.dark-mode .search-form input[type="search"]::placeholder { color: var(--text-color); }
body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .form-group select,
body.dark-mode .message-form textarea,
body.dark-mode .reply-form textarea,
body.dark-mode .link-add-form input {
    background-color: var(--bg-color); /* The dark page background */
    border-color: var(--border-color); /* The dark border color */
    color: var(--text-color);          /* The light text color */

    /* Add a subtle placeholder color for dark mode */
    --placeholder-color: #8b949e;
}
body.dark-mode #tag-search-input {
    color: var(--text-color); /* The light text color */
}

/* Style the placeholder text color for all relevant browsers */
body.dark-mode ::-webkit-input-placeholder { /* Chrome, Safari, Edge */
   color: var(--placeholder-color);
}
body.dark-mode :-moz-placeholder { /* Firefox 18- */
   color: var(--placeholder-color);
   opacity: 1;
}
body.dark-mode ::-moz-placeholder { /* Firefox 19+ */
   color: var(--placeholder-color);
   opacity: 1;
}
body.dark-mode :-ms-input-placeholder { /* Internet Explorer 10-11 */
   color: var(--placeholder-color);
}
body.dark-mode ::-ms-input-placeholder { /* Microsoft Edge */
   color: var(--placeholder-color);
}
body.dark-mode ::placeholder { /* Standard */
  color: var(--placeholder-color);
}

/* --- THIS IS THE CRITICAL ADDITION for browser autofill --- */
/* Target the WebKit (Chrome, Safari, Edge) autofill pseudo-element */
body.dark-mode input:-webkit-autofill,
body.dark-mode input:-webkit-autofill:hover,
body.dark-mode input:-webkit-autofill:focus,
body.dark-mode textarea:-webkit-autofill,
body.dark-mode textarea:-webkit-autofill:hover,
body.dark-mode textarea:-webkit-autofill:focus {
    /* We use a box-shadow to "paint" over the browser's default autofill background color */
    -webkit-box-shadow: 0 0 0 30px var(--bg-color) inset !important;
    /* And we force the text color to be our light theme color */
    -webkit-text-fill-color: var(--text-color) !important;
}

/* Buttons */
body.dark-mode .btn {
    background-color: #238636; /* A high-contrast green for primary actions */
    border-color: #2ea043;
}
body.dark-mode .btn:hover {
    background-color: #2ea043;
}
body.dark-mode .btn-secondary {
    background-color: #373b41;
}
body.dark-mode .btn-secondary:hover {
    background-color: #444a51;
}
body.dark-mode .btn-danger {
    background-color: #da3633;
}
body.dark-mode .btn-danger:hover {
    background-color: #f85149;
}

/* Flash Messages */
body.dark-mode .flash.success { background-color: #1a3c26; color: #a7f3d0; border-color: #28a745; }
body.dark-mode .flash.danger { background-color: #4a1d1f; color: #f8b4b7; border-color: var(--danger-color); }

/* Tags and Badges */
body.dark-mode .post-meta a[href*="/tag/"] {
    background-color: #21262d;
    color: var(--primary-color);
}
body.dark-mode .post-meta a[href*="/tag/"]:hover {
    background-color: #30363d;
}
body.dark-mode .role-badge.admin-badge {
    background-color: var(--primary-color);
    color: var(--bg-color); /* High contrast text */
}
body.dark-mode .role-badge.mod-badge {
    background-color: var(--accent-color);
    color: var(--bg-color); /* High contrast text */
}

/* Search and Theme Toggle Buttons */
body.dark-mode .search-form form { background-color: #0d1117; border: 1px solid var(--border-color); }
body.dark-mode .search-form form:focus-within { background-color: var(--container-bg); }
body.dark-mode .btn-theme-toggle:hover { background-color: #30363d; }
body.dark-mode .btn-theme-toggle .moon-icon { display: block; }
body.dark-mode .btn-theme-toggle .sun-icon { display: none; }

/* Tabs and Lists */
/* Tabs and Lists */
body.dark-mode .account-tabs button.tab-link {
    background-color: #0d1117;
    border-color: var(--border-color);
    color: var(--text-color); /* <-- ADD THIS LINE */
}
body.dark-mode .account-tabs button.tab-link:hover { background-color: #161b22; }
body.dark-mode .account-tabs button.tab-link.active { border-bottom-color: var(--primary-color); }
body.dark-mode .notification-item { background-color: #161b22; }
body.dark-mode .notification-item:hover { background-color: #21262d; }
body.dark-mode .comment,
body.dark-mode .category-list,
body.dark-mode .stat-card {
    background-color: #161b22;
}

/* Tables */
body.dark-mode th {
    background-color: #21262d;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .search-form { display: none; }
    .site-tagline { display: none; }
}
@media (max-width: 600px) {
    main .container { margin-top: 15px; box-shadow: none; border-radius: 0; }
    nav { justify-content: space-between; }
    .site-branding { margin-right: 0; }

    /* === NEW: Mobile Messaging Styles === */

    /* Make the thread container take up more vertical space */
    .thread-container {
        /* Remove the shadow and border to make it feel more integrated */
        box-shadow: none;
        border: none;
        /* Remove the margin so it touches the edges of the screen */
        margin-bottom: 0;
    }
    .message-thread {
        /* Let the thread take up a more significant portion of the screen height */
        min-height: 70vh;
        max-height: 70vh;
        padding: 10px; /* Reduce padding on the sides */
    }

    /* Make the message bubbles slightly smaller */
    .message-bubble {
        max-width: 80%; /* Allow bubbles to be a bit wider on mobile */
        font-size: 0.95em;
    }

    /* Make the message input form stick to the bottom of the screen */
    .message-form {
        position: sticky;
        bottom: 0;
        background-color: var(--container-bg);
        padding: 10px;
        margin: 0 -15px; /* Use negative margin to break out of the .container padding */
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    /* Dark mode adjustment for the sticky form */
    body.dark-mode .message-form {
        box-shadow: 0 -2px 10px rgba(0,0,0,0.4);
    }
}

/* --- Search Results Page Sorting --- */
.results-header h2 {
    margin: 0;
}

.sort-options {
    font-size: 0.9em;
}

.sort-options span {
    color: var(--text-muted);
    margin-right: 10px;
}

.sort-options a {
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s, color 0.2s;
}

.sort-options a.active {
    background-color: var(--primary-color);
    color: white;
}

.sort-options a:not(.active):hover {
    background-color: #f1f1f1;
    color: var(--text-color);
}

/* --- Feed Header and Sorting Styles --- */
.feed-header {
    display: flex;
    justify-content: space-between; /* Pushes title to the left and sort to the right */
    align-items: baseline;        /* Aligns the text on the same baseline */
    flex-wrap: wrap;              /* Allows wrapping on small screens */
    gap: 20px;
    margin-bottom: 20px;          /* Space between header and the first post card */
    padding-bottom: 15px;         /* Space between the text and the border */
    border-bottom: 1px solid var(--border-color);
}
.feed-header h1 {
    margin: 0; /* Remove default h1 margin */
}

/* The .sort-options styles can remain largely the same */
.sort-options {
    font-size: 0.9em;
}
.sort-options span {
    color: var(--text-muted);
    margin-right: 10px;
}
.sort-options a {
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s, color 0.2s;
}
.sort-options a.active {
    background-color: var(--primary-color);
    color: white;
}
.sort-options a:not(.active):hover {
    background-color: #f1f1f1;
    color: var(--text-color);
}

/* Dark mode adjustment for the non-active hover state */
body.dark-mode .sort-options a:not(.active):hover {
    background-color: #30363d;
}

/* --- Toggle Switch Styles --- */
.form-group-toggle {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}
.form-group-toggle label {
    margin-bottom: 0; /* Override default form label margin */
    font-weight: 500; /* Use a slightly lighter weight for toggle text */
}
.form-group-toggle small {
    display: block;
    color: var(--text-muted);
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin-right: 15px; /* Increase space between switch and text */
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 28px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* Add a subtle shadow to the knob */
}
input:checked + .toggle-slider {
    background-color: var(--primary-color);
}
input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--primary-color);
}
input:checked + .toggle-slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

/* --- User Role Badges (Profile Page) --- */

/* Add a class to the h1 to make it a flex container for alignment */
/* This is the new container for the title and badge */
.profile-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px; /* Adds space between username and badge */
    flex-wrap: wrap; /* Allows badge to wrap below on small screens */
}

/* Make sure the h1 inside it has no extra margin */
.profile-title-container h1 {
    margin: 0;
}

/* Base style for all badges (this rule is likely unchanged) */
.role-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.6em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--border-radius);
    vertical-align: middle;
    user-select: none;
}

/* Specific colors for the Admin badge */
.admin-badge {
    background-color: var(--primary-color);
    color: white;
}

/* Specific colors for the Moderator badge */
.mod-badge {
    background-color: var(--accent-color);
    color: var(--text-color);
}

/* --- User Bio (Profile Page) --- */
.user-bio {
    font-style: italic;
    color: var(--text-muted);
    max-width: 600px; /* Constrain width for readability */
    margin: 20px auto 0 auto; /* Add space and center it */
}
/* --- Profile Picture Styles (Circular Avatars) --- */

/* For the large picture on the Account page */
.profile-pic-large {
    width: 150px;
    height: 150px;
    border-radius: 50%; /* This makes it a circle */
    object-fit: cover;    /* This prevents the image from being stretched */
    margin-bottom: 20px;
    border: 3px solid var(--border-color);
}

/* For the medium picture in the public User Profile header */
.profile-pic-header {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid var(--border-color);
}

/* For the small picture on the Following/Followers pages */
.profile-pic-small {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

/* For the extra-small picture next to comments */
.profile-pic-comment {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

/* Helper styles for file inputs */
.profile-pic-section {
    margin-bottom: 40px;
}
.form-control-file {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: block;
    width: 100%;
}

/* --- Custom File Upload Button Styles --- */
.file-upload-wrapper {
    /* Styles for the container if needed */
}
.file-upload-wrapper .file-input {
    /* Hide the default input completely */
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}
.file-upload-wrapper .btn-secondary {
    /* Style the label to look like a button */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px; /* Adjust padding for a better fit */
}
.file-upload-wrapper .file-name {
    margin-left: 15px;
    font-style: italic;
    color: var(--text-muted);
}
/* Dark mode styles for the filename text */
body.dark-mode .file-upload-wrapper .file-name {
    color: var(--text-muted);
}

/* --- Engagement Metrics (Trending Page) --- */
.engagement-metrics {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 15px 0 10px 0;
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 500;
}
.engagement-metrics span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.engagement-metrics svg {
    stroke-width: 2.5; /* Make the icons a little bolder */
}
.diamond-metric {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #00BFFF; /* Deep sky blue */
    font-weight: 700;
}

/* --- Custom Error Page (404) Styles --- */
.error-page-container {
    text-align: center;
    padding: 60px 20px; /* Add significant padding to center it vertically */
}

.error-code {
    font-size: 6em; /* Make the 404 text huge */
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.error-message {
    font-size: 1.8em;
    margin: 10px 0;
    color: var(--text-color);
}

.error-description {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 30px auto; /* Center the description text block */
}

/* --- Markdown Guide Page Styles --- */
.markdown-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.markdown-section:last-child {
    border-bottom: none;
}
.markdown-section h3 {
    margin-bottom: 15px;
}
/* Style for code examples */
.markdown-section pre {
    background-color: #f6f8fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    font-family: monospace;
    font-size: 0.9em;
    overflow-x: auto; /* Allow horizontal scrolling for long code lines */
}
/* Style for the rendered output */
.example-output {
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    background-color: #fbfbfb;
}
body.dark-mode .markdown-section pre {
    background-color: #161b22;
    border-color: var(--border-color);
}
body.dark-mode .example-output {
    background-color: #21262d;
    border-color: var(--border-color);
}

/* Style for the helper link on the post form */
.label-helper {
    font-weight: 400;
    font-size: 0.8em;
    color: var(--text-muted);
}
.label-helper a {
    text-decoration: underline;
}

/* --- Comment Action & Reply Styles --- */
.comment-actions { display: flex; align-items: center; gap: 15px; margin-top: 10px; }
.btn-comment-action {
    display: inline-flex; align-items: center; gap: 6px; background: none; border: none;
    padding: 5px; color: var(--text-muted); font-size: 0.8em; font-weight: 500;
    cursor: pointer; border-radius: var(--border-radius); transition: all 0.2s;
}
.btn-comment-action:hover { background-color: #f1f1f1; color: var(--text-color); }
body.dark-mode .btn-comment-action:hover { background-color: #30363d; }
.btn-comment-action.starred { color: var(--accent-color); }
.btn-comment-action.starred svg { fill: var(--accent-color); }

.reply-form { margin-top: 15px; }
.reply-form textarea { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 0.9em; }
.reply-form button { margin-top: 10px; }
.comment-replies {
    margin-left: 30px;
    padding-left: 30px;
    border-left: 2px solid var(--border-color);
}

/* --- Post Page Two-Column Layout --- */
.post-layout-container {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column for mobile */
    gap: 40px;
    align-items: start; /* <-- ADD THIS LINE */
}

/* On larger screens, switch to two columns */
@media (min-width: 992px) {
    .post-layout-container {
        /* The main content takes up most of the space, sidebar takes up the rest */
        grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    }
}

/* --- Post Main Content Styles --- */
.post-main-content h1 {
    font-size: 2.5em;
    margin-top: 0;
}
/* The main <article> tag inside this column */
.post-main-content .post {
    border-bottom: none; /* Remove the old separator */
    padding-bottom: 0;
    margin-bottom: 0;
}

/* --- Post Page Sidebar Styles (Consolidated) --- */
.post-sidebar {
    /* No styles needed on the main container */
}
.sidebar-sticky-content {
    position: sticky;
    top: 100px; /* Offset from the top (accounts for the sticky header) */
    background-color: #fbfbfb;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}
.post-sidebar h3 {
    margin-top: 0;
    font-size: 1.1em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 25px 0;
}

/* Author Card in Sidebar */
.author-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}
.author-info {
    display: flex;
    flex-direction: column; /* Stack children vertically */
    align-items: flex-start; /* Align children to the left */
    min-width: 0; /* Flexbox fix for wrapping */
}
.profile-pic-sidebar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0; /* Prevent the image from shrinking */
}
/* 1. The main container is a CSS Grid */
.profile-actions {
    display: grid;
    /* Create a grid with 3 equal-width columns */
    grid-template-columns: repeat(3, 1fr);
    /* Add a consistent gap between the columns */
    gap: 15px;
    /* Add space above the button group */
    margin-top: 20px;
}

/* 2. Target ALL direct children of the container (the <form> and <a> tags) */
.profile-actions > * {
    /* This makes the form/a-tag a flex container... */
    display: flex;
    /* ...which allows the button inside to be stretched */
    margin: 0; /* Remove any default form margins */
}

/* 3. Target the actual visible button/link elements */
.profile-actions .btn {
    /* Make the button fill 100% of the width of its parent grid cell */
    width: 100%;
    /* Standardize padding for a uniform look */
    padding: 10px 15px;
    box-sizing: border-box; /* Ensure padding is included in the width calculation */
}
.author-name {
    font-weight: 600;
    color: var(--text-color);
    word-break: break-all; /* Force long usernames to wrap */
}
.author-post-count {
    display: block;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
}
.author-bio {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 8px; /* Give it a bit more space */
}

/* --- Sidebar Action Bar & Star Button --- */
.sidebar-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 15px;
    margin-bottom: 25px;
}
/* This is the new container for the buttons */
.sidebar-author-actions {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap if needed */
    gap: 10px;
    margin-top: 12px;
    width: 100%;
}
.sidebar-author-actions form,
.sidebar-author-actions a {
    flex-grow: 1; /* Make buttons share space */
}
.sidebar-author-actions button,
.sidebar-author-actions a {
    width: 100%;
    text-align: center;
}
.star-section-sidebar form {
    margin: 0;
}
.btn-star {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
}
.btn-star:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-star.starred {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #121212; /* Use dark text for contrast on the gold background */
}
.btn-star.starred:hover {
    background-color: #e69c3c;
    border-color: #e69c3c;
}
.btn-star svg {
    stroke-width: 2.5;
    transition: all 0.2s;
}
.btn-star.starred svg {
    fill: #121212;
}
.star-count-sidebar {
    font-size: 0.9em;
    color: var(--text-muted);
}
.star-count-sidebar strong {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-color);
}

/* Other Actions in Sidebar */
.post-sidebar .post-actions {
    flex-direction: column; /* Stack the buttons vertically */
    align-items: stretch; /* Make buttons full width of the container */
}
.post-sidebar .post-actions form {
    width: 100%;
}
.post-sidebar .btn-feature, .post-sidebar .btn-report {
    width: 100%;
    box-sizing: border-box; /* Ensure padding is included in width */
    text-align: center;
}

/* --- Dark Mode Adjustments for Sidebar --- */
body.dark-mode .sidebar-sticky-content {
    background-color: #161b22;
}
body.dark-mode .author-name {
    color: var(--text-color);
}
body.dark-mode .sidebar-action-bar {
    background-color: var(--bg-color);
}
body.dark-mode .btn-star {
    background-color: #2c2c2c;
    color: var(--text-color);
}
body.dark-mode .btn-star:hover {
    border-color: #444;
}
body.dark-mode .star-count-sidebar strong {
    color: var(--text-color);
}

/* This is the main container for the message bubbles */
.message-thread {
    padding: 20px;
    max-height: 60vh;
    min-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
}
.message-bubble.sent {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message-bubble.received {
    background-color: #e9ecef;
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.message-timestamp {
    font-size: 0.75em;
    color: rgba(0,0,0,0.5);
    display: block;
    margin-top: 5px;
}
.message-bubble.sent .message-timestamp { color: rgba(255,255,255,0.7); }
/* --- Message Input Form --- */
.message-form {
    margin-top: 20px; /* Add some space above the form */
}
.message-input-group {
    display: flex;
    align-items: flex-end; /* Align items to the bottom */
    gap: 10px;
    margin-bottom: 0; /* Override default .form-group margin */
}
.message-input-group textarea {
    flex-grow: 1; /* Allow the textarea to take up available space */
    resize: none; /* Disable manual resizing */
}
.message-input-group button {
    flex-shrink: 0; /* Prevent the button from shrinking */
}

/* Dark mode for messages */
body.dark-mode .message-bubble.received { background-color: #30363d; color: var(--text-color); }

/* --- FAQ and Help Request Styles --- */
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    background: var(--bg-color);
}
.faq-item summary {
    font-weight: 600;
    padding: 15px;
    cursor: pointer;
    outline: none;
}
.faq-item p {
    padding: 0 15px 15px;
    margin: 0;
    color: var(--text-muted);
}
.request-list { display: flex; flex-direction: column; gap: 10px; }
.request-item { border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.request-item[open] > summary { border-bottom: 1px solid var(--border-color); }
.request-item summary { padding: 15px; cursor: pointer; display: block; }
.request-summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.request-time { font-size: 0.9em; color: var(--text-muted); flex-shrink: 0; }
.request-body { padding: 15px; }

/* --- Support Ticket Styles --- */
.ticket-meta {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    color: var(--text-muted);
}
.ticket-thread {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.ticket-message {
    padding: 15px;
    border-radius: var(--border-radius);
}
.ticket-message p { margin: 0; }
.ticket-message .message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9em;
}
.message-timestamp {
    color: var(--text-muted);
}
.ticket-message.from-user {
    background-color: #f1f1f1;
}
.ticket-message.from-admin {
    background-color: #e3f2fd; /* A light, friendly blue */
    border-left: 3px solid var(--primary-color);
}
.resolved-notice {
    font-style: italic;
    color: var(--text-muted);
}
.status-badge {
    padding: 3px 8px;
    font-size: 0.8em;
    font-weight: 600;
    border-radius: 4px;
    text-transform: capitalize;
}
.status-open { background-color: #ffc107; color: #333; }
.status-awaiting_user { background-color: #17a2b8; color: white; }
.status-resolved { background-color: #28a745; color: white; }

/* --- Dark Mode for Support Ticket System --- */
body.dark-mode .ticket-meta {
    border-bottom-color: var(--border-color);
}
body.dark-mode .ticket-thread {
    border-color: var(--border-color);
}
body.dark-mode .ticket-message.from-user {
    background-color: #30363d; /* A dark gray for user messages */
}
body.dark-mode .ticket-message.from-admin {
    background-color: #1c3d5d; /* A dark, muted blue for admin replies */
    border-color: var(--primary-color);
}
body.dark-mode .message-timestamp {
    color: var(--text-muted);
}
body.dark-mode .status-badge.status-open {
    background-color: #b58900; /* Darker yellow */
    color: white;
}
body.dark-mode .status-badge.status-awaiting_user {
    background-color: #268bd2; /* Darker cyan */
    color: white;
}
body.dark-mode .status-badge.status-resolved {
    background-color: #6c71c4; /* Darker violet/purple */
    color: white;
}

/* --- Site-Wide Notification Box Styles --- */
.site-notice {
    padding: 20px;
    margin-bottom: 30px;
    border-left-width: 5px;
    border-left-style: solid;
    border-radius: var(--border-radius);
}
.site-notice p {
    margin: 0;
    font-weight: 500;
}
.site-notice p a {
    text-decoration: underline;
    font-weight: 600;
}

/* Color Variants */
.site-notice-info {
    background-color: #e3f2fd;
    border-color: var(--primary-color);
}
.site-notice-warning {
    background-color: #fff8e1;
    border-color: var(--accent-color);
}

/* Dark Mode Adjustments */
body.dark-mode .site-notice-info {
    background-color: #1c3d5d;
    border-color: var(--primary-color);
}
body.dark-mode .site-notice-warning {
    background-color: #4b3d1c;
    border-color: var(--accent-color);
}
body.dark-mode .site-notice p a {
    color: #ffffff;
}

/* --- Mindful Commenting Modal Styles --- */
#mindful-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black background */
    z-index: 2000; /* Ensure it's on top of everything */
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px); /* Modern blur effect */
}

#mindful-modal {
    background-color: var(--container-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 500px;
    text-align: center;
}

#mindful-modal h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.mindful-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    font-weight: 500;
}

#mindful-continue-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dark Mode adjustment for the disabled button */
body.dark-mode #mindful-continue-btn:disabled {
    background-color: #444a51;
}

/* --- The Diamond Button --- */
.btn-diamond {
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 1;
    padding: 0;
}
.btn-diamond:hover {
    transform: scale(1.2);
}
.diamonds-display {
    font-weight: 600; text-align: center;
    color: var(--danger-color); margin-bottom: 20px;
}

/* --- Post Sidebar Action Panel --- */
.sidebar-action-panel {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 25px;
}

/* Container for the buttons */
.engagement-actions {
    display: flex;
    flex-direction: column; /* <-- This is the key change: stack items vertically */
    align-items: center;    /* <-- Center the items horizontally */
    gap: 15px;              /* <-- Add space between the stacked items */
    padding: 15px;
}

/* Container for the text counts */
.engagement-counts {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-muted);
}
.count-item strong {
    display: block;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-color);
}

/* --- Tag Search Bar with Autocomplete --- */
.tag-search-container {
    margin-bottom: 30px;
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}
#tag-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}
.autocomplete-wrapper {
    position: relative;
    flex-grow: 1; /* Allow the input to take up available space */
}
#tag-search-input {
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't add to width */
    font-size: 1.1em;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
}
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 998; /* Just below the main header */
    background-color: var(--container-bg);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    display: none; /* Hidden by default */
}
.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
}
.autocomplete-item:hover {
    background-color: #f1f1f1;
}

/* Dark Mode Adjustments */
body.dark-mode .tag-search-container {
    background-color: var(--container-bg);
}
body.dark-mode .autocomplete-results {
    background-color: #2c2c2c;
}
body.dark-mode .autocomplete-item:hover {
    background-color: #30363d;
}

/* --- Support Page Styles --- */
.support-page-container {
    text-align: center;
    padding: 20px 0;
}
.support-subtitle {
    font-size: 1.2em;
    color: var(--text-muted);
    max-width: 600px;
    margin: 10px auto 40px auto;
}
.support-details {
    text-align: left;
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
}

/* "Buy Me a Coffee" Button */
.bmac-button-container {
    margin: 20px 0;
}
.btn-bmac {
    background-color: #FFDD00; /* Official Buy Me a Coffee yellow */
    color: #000000;
    font-weight: 700;
    padding: 15px 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
}
.btn-bmac:hover {
    background-color: #fbc531;
    color: #000000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Dark Mode Adjustments */
body.dark-mode .support-details {
    background-color: var(--container-bg);
}

/* --- Save to List Modal Styles --- */
#save-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

#save-modal {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column;
    gap: 15px; /* Space between elements */
}

#save-modal h3 {
    margin: 0;
    text-align: center;
}

#list-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
}

.list-checkbox-item {
    display: flex;
    align-items: center;
    padding: 5px;
}
.list-checkbox-item input {
    margin-right: 10px;
}

.create-new-list-form {
    display: flex;
    gap: 10px;
}
.create-new-list-form input {
    flex-grow: 1; /* Allow input to take up space */
}

/* Dark mode adjustments */
body.dark-mode #save-modal {
    background-color: #21262d;
}

/* --- Reading List Page Styles --- */
.reading-list-container {
    margin-bottom: 40px;
}
.reading-list-container h2 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.post-preview-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.post-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}
.post-preview-item:hover {
    border-color: var(--primary-color);
}
.post-preview-title {
    font-weight: 600;
    font-size: 1.1em;
}
.post-preview-author {
    font-size: 0.9em;
    color: var(--text-muted);
}
.post-preview-date {
    font-size: 0.9em;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 20px;
}

/* Dark Mode */
body.dark-mode .post-preview-item {
    background-color: var(--container-bg);
}

/* --- User Shoutout Section (Homepage) --- */
.user-shoutout-section {
    background: linear-gradient(135deg, #e3f2fd, #fff8e1); /* A soft gradient background */
    border: none;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    padding: 25px;
    text-align: center;
}
.shoutout-header {
    /* We don't need the header bar anymore */
}
.shoutout-header h3 {
    margin: 0 0 20px 0;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-color);
}
.shoutout-body {
    display: flex;
    flex-direction: column; /* Stack vertically for a centered look */
    align-items: center;
    gap: 15px;
}
.shoutout-message {
    font-style: italic;
    font-size: 1.1em;
    margin: 0;
    border-left: none; /* Remove the old border */
    padding-left: 0;
    max-width: 600px; /* Keep it readable */
}
.shoutout-congrats {
    font-weight: 500;
    margin: 10px 0 0 0;
}
/* We can reuse the profile pic style */
.shoutout-body .profile-pic-sidebar {
    margin-bottom: 0;
}

/* Dark Mode Adjustments */
body.dark-mode .user-shoutout-section {
    background: linear-gradient(135deg, #1c3d5d, #4b3d1c);
    border-color: var(--border-color);
}
body.dark-mode .shoutout-header h3 {
    color: var(--text-color);
}

/* --- Stat Card Highlight --- */
.stat-card.highlight {
    background-color: #e3f2fd; /* A light, celebratory blue */
    border-color: var(--primary-color);
}

.stat-card.highlight p {
    color: var(--primary-hover);
}

/* Dark Mode adjustment for the highlight */
body.dark-mode .stat-card.highlight {
    background-color: #1c3d5d;
    border-color: var(--primary-color);
}
body.dark-mode .stat-card.highlight p {
    color: #8bbaff; /* A lighter, more vibrant blue for dark mode */
}
/* --- Most Engaging Post Preview (Stats Page) --- */
.most-engaging-post-container {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.most-engaging-post-container h2 {
    margin-bottom: 20px;
    text-align: left;
}

/* Ensure the included article has no bottom border if it's the only one */
.most-engaging-post-container .post {
    border-bottom: none;
    margin-bottom: 0;
}

/* --- Writing Habit Stat Card --- */
.stat-card-habit {
    /* Optional: give it a slightly different look */
    background-color: #fbfbfb;
}

/* Style for the badge text itself */
.stat-badge {
    font-size: 1.6em; /* Make it slightly smaller than the number stats */
    font-weight: 600;
    color: var(--accent-color); /* Use the gold accent color */
    line-height: 1.2;
}

/* Dark mode adjustment */
body.dark-mode .stat-card-habit {
    background-color: #161b22;
}
body.dark-mode .stat-badge {
    color: var(--accent-color);
}

/* Style for archived comments */
.comment-archived {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
}
.comment-archived p {
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}
body.dark-mode .comment-archived {
    background-color: #21262d;
}

/* --- Mod View Page Styles --- */
.mod-view-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.content-history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; background-color: var(--bg-color); border-radius: var(--border-radius); }
.history-item-meta { font-weight: 500; }
.history-item-status { font-size: 0.8em; font-weight: 600; padding: 3px 8px; border-radius: 4px; margin-left: 10px; }
.history-item-status.status-0 { background-color: #6c757d; color: white; } /* Draft */
.history-item-status.status-1 { background-color: #28a745; color: white; } /* Published */
.history-item-status.status-2 { background-color: #ffc107; color: #333; } /* Reported */
.history-item-status.status-3 { background-color: #dc3545; color: white; } /* Archived */
.history-item-date { font-size: 0.9em; color: var(--text-muted); }
.mod-note { margin-top: 20px; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 15px; }
.mod-note p { margin: 0 0 10px 0; }
.mod-note-meta { font-size: 0.8em; color: var(--text-muted); }

/* --- Reported Content Notice --- */
.reported-notice {
    padding: 10px 15px;
    background-color: #fff8e1;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
body.dark-mode .reported-notice {
    background-color: #4b3d1c;
    border-color: var(--accent-color);
}

/* --- Tag Management Page Styles --- */
.admin-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.merge-form {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.merge-form span {
    font-weight: bold;
}
.blacklist-display {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: var(--border-radius);
    font-family: monospace;
    color: var(--text-muted);
}
/* Dark Mode */
body.dark-mode .blacklist-display {
    background-color: var(--container-bg);
}
.chart-container {
    position: relative;
    height: 400px; / Give the chart a fixed height */
    width: 100%;
    margin-bottom: 40px;
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* --- Dashboard Page Styles --- */
.dashboard-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.dashboard-section:last-child {
    border-bottom: none;
}
.dashboard-section h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
}
.view-all-link {
    display: inline-block;
    margin-top: 15px;
    font-weight: 600;
    text-decoration: none;
}
/* --- Dashboard Sub-Navigation Styles --- */
.sub-nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 15px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 25px;
}
.sub-nav-links span {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9em;
}
.sub-nav-links a {
    font-size: 0.9em;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
}
.sub-nav-links a:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.sub-header {
    font-size: 1.2em;
    color: var(--text-muted);
}

/* Dark Mode Adjustments */
body.dark-mode .sub-nav-links {
    background-color: var(--container-bg);
}
body.dark-mode .sub-nav-links a {
    background-color: var(--bg-color);
}
body.dark-mode .sub-nav-links a:hover {
    color: white;
}
/* --- Message Thread Header --- */
/* This is the new main wrapper for the header and the thread box */
.thread-container {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 20px; /* Space between the thread and the input form */
    box-shadow: var(--box-shadow);
}
.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px; /* Use padding for internal spacing */
    border-bottom: 1px solid var(--border-color); /* Separates header from messages */
}
.thread-header h2 {
    margin: 0;
}

.stats-group {
    margin-bottom: 40px;
}
.stats-group h2 {
    font-size: 1.5em;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* --- Creator Support Button Styles --- */
.btn-support {
    background-color: #FFDD00; /* Official Buy Me a Coffee yellow */
    color: #000000;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-color: #FFDD00;
}
.btn-support:hover {
    background-color: #fbc531;
    color: #000000;
    border-color: #fbc531;
}
.btn-full-width {
    width: 100%;
    box-sizing: border-box;
}

.edit-profile-link {
    display: block; /* Make it a block to control margin */
    text-align: center;
    font-weight: 500;
    font-size: 0.9em;
    color: var(--text-muted);
    text-decoration: underline;
    margin-top: 15px; /* Add some space above it */
    transition: color 0.2s;
}

.edit-profile-link:hover {
    color: var(--primary-color);
}

/* --- Welcome Page Styles --- */
.welcome-container {
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
}
/* --- Scroll to Top Button --- */
#to-top-btn {
    position: fixed; /* Keep it in a fixed position on the screen */
    bottom: 20px;
    right: 20px;
    z-index: 998; /* Just below the header */

    /* Appearance */
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%; /* Make it a circle */
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;

    /* Flexbox for centering the icon */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Animation for appearing/disappearing */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
}

#to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#to-top-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px); /* Lift effect on hover */
}

/* Dark mode adjustment for the shadow */
body.dark-mode #to-top-btn {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* --- Admin Dashboard Chart Grid --- */
.charts-grid {
    display: grid;
    /* On small screens, stack the charts in a single column */
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* On larger screens, switch to a two-column layout */
@media (min-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Update the chart container to include a title */
.chart-container h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
    color: var(--text-muted);
}
/* Add a focus ring to the toggle switch when its hidden checkbox is focused */
.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.25);
}
/* Add a focus ring to the file upload label when its hidden input is focused */
.file-upload-wrapper .file-input:focus + label {
    outline: 2px solid var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.25);
}
/* --- Empty State Styles --- */
.empty-state-container {
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    margin: 20px 0;
}
.empty-state-icon {
    /* The SVG icon will inherit this color */
    color: var(--text-muted);
    margin-bottom: 15px;
}
.empty-state-container h3 {
    margin: 0 0 10px 0;
    color: var(--text-color);
}
.empty-state-container p {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 20px auto;
}
.empty-state-container .btn {
    /* The standard button styles will apply */
}

/* Dark Mode Adjustments */
body.dark-mode .empty-state-container {
    background-color: var(--container-bg);
}
