/* www/blog/style.css */
/* Dark Mode Class (applied via JS) */
body.dark-mode,
html.dark-mode {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --sidebar-bg: #1e293b;
    --card-bg: #1e293b;
    --border-color: #334155;
    --input-bg: #334155;
    --input-text: #f1f5f9;
    --header-bg: #2d2f34;
}

/* Namuwiki Dark Mode adjustments */
body.dark-mode,
html.dark-mode {
    --primary-color: #00A495;
    --bg-color: #1f2023;
    --text-color: #ddd;
    --sidebar-bg: #2b2b2b;
    --card-bg: #2b2b2b;
    --border-color: #444;
}

/* Default Light Mode Variables (Namuwiki Theme) */
:root {
    --primary-color: #00A495;
    /* Namuwiki Green */
    --primary-hover: #008f82;
    --bg-color: #f0f0f0;
    /* Light gray background */
    --text-color: #373a3c;
    --sidebar-bg: #ffffff;
    /* Dark sidebar like Namu live/wiki tools often have, or keep light? Let's go dark for contrast */
    --card-bg: #ffffff;
    --border-color: #ccc;
    /* Distinct borders */
    --font-main: 'Open Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Namu uses Open Sans often */
    --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.1);
    /* Flatter look */
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --input-text: #373a3c;
    --header-bg: #ffffff;
}

/* Auto Dark Mode (System Preference) - ONLY if no user preference override */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-color: #0f172a;
        --text-color: #f1f5f9;
        --sidebar-bg: #1e293b;
        --card-bg: #1e293b;
        --border-color: #334155;
        --input-bg: #334155;
        --input-text: #f1f5f9;
        color-scheme: dark;
        /* Helps with scrollbars etc */
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: var(--bg-color);
    /* Apply to html for FOUC fix */
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    line-height: 1.6;
    font-size: 15px;
    /* Reduced from browser default (16px) */
    display: block;
    /* Prepare for custom layout container */
    min-height: 100vh;
}

/* 3-Column Layout Wrapper */
.layout-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-color);
}

/* Sidebar (Dark Theme Style) */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.25rem;
    /* Reduced from 1.5rem */
    position: sticky;
    /* Sticky instead of fixed for better layout flow */
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-gutter: stable;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: margin-left 0.3s ease;
    z-index: 50;
}

.sidebar.hidden {
    margin-left: -300px;
}

/* Adjust links in sidebar for dark background */
/* Adjust links in sidebar for dark background */
.sidebar a {
    color: var(--text-color);
}

.sidebar a:hover {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.05);
    /* Subtle dark hover */
}

/* Dark mode override for hover */
body.dark-mode .sidebar a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Removed redundant .nav-link rule here, it is defined correctly below */

.logo {
    color: #fff;
    /* White logo on dark sidebar */
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: block;
    color: var(--primary-color);
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.1rem;
    /* Reduced from 0.5rem */
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    /* Reduced from 0.75rem 1rem */
    border-radius: 0.25rem;
    /* Slightly sharper */
    color: var(--text-color);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1rem;
    /* Compact padding */
    max-width: 100%;
    /* No margin-left needed with flexbox flow */
    min-width: 0;
    /* Important for flex wrapping text */
}

/* Right Sidebar */
.right-sidebar {
    width: 300px;
    padding: 1rem;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-banner {
    margin-bottom: 1rem;
    overflow: hidden;
    /* rounded corners if desired */
    border-radius: 0.5rem;
}

.sidebar-banner img {
    width: 100%;
    height: auto;
    display: block;
}

.desktop-toggle-btn {
    display: none;
    /* Hidden by default (sidebar usually open) */
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;

    /* Fixed position when visible */
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 40;
    /* Below sidebar (50) but above content */
    box-shadow: var(--shadow-sm);
}

/* Show only when sidebar is hidden */
body.sidebar-hidden .desktop-toggle-btn {
    display: flex;
}

.desktop-toggle-btn:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.container {
    max-width: 900px;
    /* Restored/Standard width */
    margin: 0 auto;
}

/* Header (Mobile) */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    /* Reset padding here, handled inline or via inner elements */
    background: var(--header-bg);
    /* Use header-bg for better semantic matching */
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    height: auto;
    /* Allow expansion */
    min-height: 60px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    /* Remove duplicate color line */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

/* Posts */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    /* Square corners usually */
    padding: 1rem;
    /* Very compact */
    margin-bottom: 0.5rem;
    /* Very tight spacing */
    box-shadow: none;
    /* Flatter */
}

.post-card:hover {
    transform: none;
    background: var(--bg-color);
    /* Slight darken on hover maybe? or just border change */
    border-color: var(--primary-color);
}

.post-meta {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.post-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    line-height: 1.4;
}

.post-excerpt {
    color: var(--text-color);
    opacity: 0.9;
}

.read-more {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Single Post */
.post-content {
    background: var(--card-bg);
    padding: 1.25rem;
    /* Compact reading area */
    border-radius: 0.5rem;
    /* Reduced radius */
    border: 1px solid var(--border-color);
}

.post-content h1 {
    font-size: 1.4rem;
    /* Reduced to match standard document title */
    margin-bottom: 0.5rem;
    /* Reduced from 0.75rem */
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.25rem;
    color: var(--text-color);
    line-height: 1.4;
}

.post-content h2 {
    font-size: 1.25rem;
    /* Standard sub-section size */
    margin-top: 1.2rem;
    /* Reduced from 1.5rem */
    margin-bottom: 0.3rem;
    /* Reduced from 0.5rem */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.2rem;
    display: block;
    width: 100%;
    line-height: 1.4;
}

.post-content h3 {
    font-size: 1.1rem;
    margin-top: 1rem;
    /* Reduced from 1.25rem */
    margin-bottom: 0.25rem;
    /* Reduced from 0.5rem */
    font-weight: bold;
    line-height: 1.4;
}

/* Namuwiki-style links in content */
.post-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.post-content a:hover {
    text-decoration: underline;
}

.post-content img {
    max-width: 100%;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: #64748b;
}

/* Responsive */
@media (max-width: 1280px) {
    .layout-container {
        flex-direction: column;
    }

    .main-content {
        padding: 1rem;
        padding-top: 1rem;
        /* Added padding top for content gap */
        margin-top: 0;
        /* Sticky header is 60px, ensure content is safe */
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
        height: 100%;
        margin-left: 0;
        /* Reset desktop negative margin logic */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .right-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        height: auto;
        position: static;
        order: 3;
        /* Ensure it's at the bottom */
        padding: 2rem 1rem;
    }

    .desktop-toggle-btn {
        display: none;
        /* Hide desktop toggle on mobile */
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Language Selector */
    .header-lang-selector {
        display: flex;
        align-items: center;
        background: var(--bg-color);
        padding: 0.2rem 0.5rem;
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
    }

    .header-lang-selector select {
        background: transparent;
        border: none;
        color: var(--text-color);
        font-size: 0.9rem;
        font-weight: 600;
        margin-left: 0.5rem;
        font-family: inherit;
        outline: none;
        width: auto;
        cursor: pointer;
    }

    /* Menu Toggle Button */
    .menu-toggle {
        color: var(--text-color);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        border-radius: 0.5rem;
        transition: background-color 0.2s;
        margin-left: auto;
    }

    .menu-toggle:active {
        background-color: var(--border-color);
    }

    .post-content {
        padding: 1.5rem;
    }

    /* Mobile Post List Title Adjustment */
    .post-card .post-title {
        font-size: 1.0rem;
        /* Reduced from 1.4rem (~70%) as requested */
        font-weight: 700;
        margin-bottom: 0.3rem;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 95;
        /* Behind sidebar (100), above header (90) */
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Close Button */
    .sidebar-close-btn {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-color);
        position: absolute;
        top: 1rem;
        right: 1rem;
        cursor: pointer;
    }
}

/* Sidebar Close Button on Desktop */
@media (min-width: 1281px) {
    .sidebar-close-btn {
        display: block;
        /* Show close button */
        font-size: 1.2rem;
        top: 0.5rem;
        right: 0.5rem;
        opacity: 0.7;
    }

    .sidebar-close-btn:hover {
        opacity: 1;
        color: var(--primary-color);
    }
}

/* Language Toggle */
.lang-toggle {
    display: flex;
    background: var(--border-color);
    border-radius: 0.5rem;
    padding: 0.25rem;
    margin-top: 2rem;
}

.lang-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    /* Ensure no underline */
    color: #64748b;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: var(--text-color);
}

.lang-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

/* Admin Panel (Global) */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.25rem;
    /* Reduced from 2rem */
    flex-shrink: 0;
    color: var(--text-color);
}

/* Ensure headings in sidebar inherit color */
.admin-sidebar h3,
.admin-sidebar h4 {
    color: var(--text-color) !important;
}

.admin-nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    /* Reduced vertical padding */
    color: var(--text-color);
    margin-bottom: 0.25rem;
    /* Reduced from 0.5rem */
    border-radius: 0.35rem;
    text-decoration: none;
    transition: all 0.2s;
}

.admin-nav-link:hover,
.admin-nav-link.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Admin Tables */
.admin-content table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-content th,
.admin-content td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-content th {
    background: var(--header-bg);
    font-weight: 600;
}

.admin-content .btn {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
}

.admin-content .btn-primary {
    background: var(--primary-color);
    color: white;
}

.admin-content .btn-edit {
    background: #64748b;
    color: white;
}

.admin-content .btn-delete {
    background: #ef4444;
    color: white;
}

.admin-content .form-input,
.admin-content .form-textarea,
.admin-content .form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: var(--font-main);
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--input-text);
}

/* Comments */
.comment-form {
    margin-bottom: 2rem;
}

.comment-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.comment-item.admin-comment {
    border-left: 3px solid var(--primary-color);
}

.comment-author {
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.comment-date {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.comment-body {
    color: var(--text-color);
    line-height: 1.6;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Comment Form specific fixes */
input,
textarea,
select,
.form-input {
    background: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--border-color);
}

/* Ensure placeholder text is visible but distinct */
::placeholder {
    color: var(--text-color);
    opacity: 0.5;
}

/* Admin Modal */
.admin-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.admin-modal-overlay.active {
    display: flex;
}

.admin-modal {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.admin-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.modal-content-preview img {
    max-width: 100%;
    height: auto;
}

/* Admin Responsive */
@media (max-width: 1024px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    /* Overlay for mobile sidebar */
    .admin-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 900;
        display: none;
    }

    .admin-overlay.active {
        display: block;
    }

    .admin-content {
        padding: 10px !important;
        /* Slight gap from edges */
        padding-top: 100px !important;
        /* More space from header */
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Mobile Table -> Card Transformation (Namuwiki Style) */
    .admin-content table,
    .admin-content tbody,
    .admin-content tr,
    .admin-content td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .admin-content table {
        border-top: 1px solid #ccc;
        margin-top: 0;
        background: var(--bg-color);
        /* Match background */
        box-shadow: none;
        border-radius: 0;
    }

    /* Hide Table Header */
    .admin-content thead {
        display: none;
    }

    /* Card Style for Rows (Namuwiki Flat Style) */
    .admin-content tr {
        background: var(--card-bg);
        margin-bottom: 5px;
        /* Slight separation */
        border: 1px solid #ccc;
        /* Border on all sides for box look */
        border-radius: 4px;
        /* Slight rounding */
        padding: 0.5rem;
        /* Reduced internal padding */
        box-shadow: none;
    }

    /* Cell Styles */
    .admin-content td {
        padding: 0.2rem 0;
        border: none;
        text-align: left;
    }

    /* Specific Column Targeting (assuming standard order: Date, Title, Category, Actions) */

    /* 1. Date (Small & Gray) */
    .admin-content td:nth-child(1) {
        font-size: 0.75rem;
        color: #888;
        margin-bottom: 0.2rem;
    }

    /* 2. Title (Large & Bold) */
    .admin-content td:nth-child(2) {
        font-size: 1.1rem;
        font-weight: bold;
        margin-bottom: 0.5rem;
    }

    .admin-content td:nth-child(2) a {
        display: block;
        /* Make whole title clickable */
    }

    /* 3. Category (Full Width) */
    .admin-content td:nth-child(3) {
        margin-bottom: 0.5rem;
    }

    .admin-content td:nth-child(3) select {
        width: 100%;
        padding: 0.5rem;
        border: 1px solid var(--border-color);
        border-radius: 0.3rem;
    }

    /* 4. Actions (Flex Buttons) */
    .admin-content td:nth-child(4) {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--border-color);
    }

    .admin-content td:nth-child(4) .btn {
        flex: 1;
        text-align: center;
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .admin-content h1 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .admin-content .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Compact Forms */
    .form-group {
        margin-bottom: 0.8rem;
    }

    .form-input,
    .form-select,
    textarea {
        font-size: 16px;
        /* Prevent IOS zoom */
        padding: 0.5rem;
    }

    /* Mobile Header Toggle */
    .admin-mobile-header {
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
        background: var(--sidebar-bg);
        border-bottom: 1px solid var(--border-color);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 9999;
        /* Max Z-Index */
    }

    .admin-toggle-btn {
        background: none;
        border: none;
        color: var(--text-color);
        font-size: 1.5rem;
        cursor: pointer;
        margin-right: 1rem;
    }

    .admin-page-title {
        font-size: 1.1rem;
        font-weight: bold;
        color: var(--text-color);
    }

    .voice-blog-btn {
        background: var(--primary-color);
        border: none;
        color: white;
        font-size: 2rem;
        /* Larger icon */
        width: 60px;
        /* Larger button */
        height: 60px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        margin-left: auto;
        box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
        animation: mobile-pulse 2s infinite;
        z-index: 1001;
        /* Ensure it's on top */
    }

    .voice-blog-btn:active {
        transform: scale(0.95);
    }
}



@keyframes mobile-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 99, 235, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

@media (max-width: 1024px) {

    /* Settings Card Optimization for Mobile */
    .settings-card {
        padding: 0.8rem !important;
        margin-bottom: 0.5rem !important;
        border-radius: 4px !important;
        /* Sharper */
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }

    .settings-card h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0.8rem !important;
        padding-bottom: 0.3rem !important;
        border-bottom: 2px solid var(--border-color) !important;
    }

    .form-group {
        margin-bottom: 0.8rem !important;
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: 0.5rem !important;
        font-size: 14px !important;
    }

    /* Categories Mobile Styles (Namuwiki Compact) */
    .add-box {
        padding: 0.8rem !important;
        margin-bottom: 1rem !important;
        border-radius: 4px !important;
        border: 1px solid #ccc !important;
        background: var(--card-bg) !important;
    }

    .add-box h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .add-box form {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
    }

    .add-box form div {
        width: 100% !important;
    }

    .add-box .form-input {
        width: 100% !important;
    }

    .cat-head {
        display: none !important;
        /* Hide header on mobile */
    }

    .cat-item {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem !important;
        padding: 0.8rem !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
        margin-bottom: 0.5rem !important;
        background: var(--card-bg) !important;
    }

    .cat-item div {
        width: 100% !important;
    }

    .cat-item .form-input {
        width: 100% !important;
    }

    .cat-item .btn-delete {
        width: 100% !important;
        padding: 0.5rem !important;
        margin-top: 0.5rem;
    }
}

@media (min-width: 1025px) {

    .admin-mobile-header,
    .admin-overlay {
        display: none;
    }
}

/* =========================================
   Markdown Content Styling (Added for Better Contrast)
   ========================================= */

/* Blockquote */
blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 5px solid var(--primary-color);
    background-color: #f8fafc;
    /* Light mode bg (Slate 50) */
    color: #334155;
    /* Slate 700 - Darker for better contrast */
    font-style: normal;
    /* Modern look */
    border-radius: 0 0.5rem 0.5rem 0;
    line-height: 1.7;
    border: 1px solid #e2e8f0;
    /* Slight border for definition in light mode */
}

blockquote p {
    margin-bottom: 0.5rem;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* Code Blocks */
pre {
    background-color: #f1f5f9;
    /* Slate 100 */
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    line-height: 1.5;
    color: #334155;
    white-space: pre-wrap;
    /* Wrap long lines */
}

/* Inline Code */
/* Ensure generic code elements are styled */
code,
.entry-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    color: #d63384;
    /* Standard pinkish for code */
    border: 1px solid #e2e8f0;
}

/* Reset for code inside pre */
pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    border: none;
    font-size: inherit;
}

/* Tables in Content */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.entry-content th,
.entry-content td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.entry-content th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #334155;
}

/* Lists */
.entry-content ul,
.entry-content ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
    /* Reduced vertical margin */
    padding-left: 1rem;
}

.entry-content li {
    margin-bottom: 0.25rem;
    /* Tighter list items */
}

/* Remove paragraph margins inside lists to prevent huge gaps */
.entry-content li p {
    margin-bottom: 0;
    display: inline-block;
    /* Helps with alignment */
}


/* Horizontal Rule */
hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
    opacity: 0.6;
}

/* =========================================
   Dark Mode Overrides for Markdown
   ========================================= */

body.dark-mode blockquote {
    background-color: rgba(0, 0, 0, 0.3) !important;
    /* Darker than card */
    color: #ffffff !important;
    /* Pure white text */
    border-left-color: var(--primary-color);
    box-shadow: none;
    border: 1px solid #334155;
    /* Add border for definition */
}

body.dark-mode blockquote p,
body.dark-mode blockquote span,
body.dark-mode blockquote div,
body.dark-mode blockquote li {
    color: #ffffff !important;
    /* Force inheritance */
}

body.dark-mode pre {
    background-color: #0f172a !important;
    /* Darker bg */
    border-color: #334155;
    color: #e2e8f0 !important;
}

body.dark-mode code,
body.dark-mode .entry-content code {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #67e8f9 !important;
    /* Cyan 300 - Very distinct */
}

body.dark-mode pre code {
    background-color: transparent !important;
    color: inherit !important;
}

body.dark-mode .entry-content th {
    background-color: #334155;
    color: #ffffff !important;
    border-color: #475569;
}

body.dark-mode .entry-content td {
    border-color: #475569;
    color: #e2e8f0 !important;
}

body.dark-mode .entry-content tr:hover td {
    background-color: rgba(255, 255, 255, 0.05);
}

/* =========================================
   Admin Settings & Layout Fixes
   ========================================= */

/* Admin Layout (ensure sidebar doesn't shrink) */
.admin-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
    padding: 2rem;
    overflow-x: hidden;
}

/* Settings Card */
.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
}

/* Save Button */
.btn-save {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

.btn-save:hover {
    opacity: 0.9;
}

/* Banner Configuration Items */
.banner-item {
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    background: var(--bg-color);
}

.banner-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    align-items: center;
}

.btn-move {
    background: #64748b;
    color: white;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    margin-right: 0.2rem;
}


/* =========================================
   Editor Layout Force Fix
   ========================================= */
.editor-textarea-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 60vh;
    /* Minimum height for the wrapper */
}

/* Specific selector to override any potential conflicts */
.editor-textarea-wrapper textarea,
textarea#content_ko {
    flex: 1;
    width: 100%;
    height: 100% !important;
    /* Force height to fill wrapper */
    min-height: 60vh !important;
    /* Force minimum height */
    box-sizing: border-box;
    display: block;
}

/* =========================================
   Tag Cloud Styles
   ========================================= */
.tag-cloud-wrapper {
    margin-bottom: 2rem;
}

.tag-cloud-3d {
    width: 100%;
    min-height: 250px;
    /* Reserve space */
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    font-weight: 600;
}

/* Tag Cloud Items (created by JS) */
.tagcloud--item {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: color 0.2s;
}

.tagcloud--item:hover {
    color: var(--primary-color) !important;
    text-shadow: 0 0 5px rgba(0, 164, 149, 0.4);
}

/* Dark Mode Overrides */
html.dark-mode .tagcloud--item {
    color: #cbd5e1;
}

html.dark-mode .tagcloud--item:hover {
    color: var(--primary-color) !important;
}

/* Responsive Video Container (YouTube) */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Admin Translation Status Cell */
.trans-status-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

/* Standardized Translation Buttons & Badges */
.trans-status-cell .btn-trans-retry,
.trans-status-cell .badge,
.guide-section .btn-trans-retry,
.guide-section .badge {
    min-width: 85px;
    /* Fixed width for consistency */
    max-width: 85px;
    height: 30px;
    /* Fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 0 4px;
    /* Internal padding */
    box-sizing: border-box;
    border-radius: 4px;
}

.trans-status-cell .btn-trans-retry,
.guide-section .btn-trans-retry {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
}

.trans-status-cell .btn-trans-retry:hover,
.guide-section .btn-trans-retry:hover {
    background-color: var(--border-color);
}


/* Tag Cloud Container */
.tag-cloud-3d {
    position: relative;
    z-index: 1;
    /* Keep below dropdowns */
    width: 100%;
}

/* Speed Control Buttons */
.tag-speed-controls {
    position: relative;
    z-index: 2;
    /* Above cloud but below dropdown */
}

.speed-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.6;
    transition: all 0.2s;
}

.speed-btn:hover {
    opacity: 1;
    background: var(--card-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Sidebar Collapse Button (Inside Sidebar) */
.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
    opacity: 0.7;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
    color: var(--primary-color);
}

/* Custom Dropup Language Menu */
.custom-dropup {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
}

.dropup-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    border-radius: 0.35rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.dropup-btn:hover {
    border-color: var(--primary-color);
}

.dropup-content {
    display: none;
    position: absolute;
    bottom: 100%;
    /* Open Upwards */
    left: 0;
    width: 100%;
    background-color: #2b2b2b;
    /* Dark bg for menu */
    min-width: 160px;
    box-shadow: 0px -8px 16px 0px rgba(0, 0, 0, 0.5);
    /* Stronger shadow */
    z-index: 99999;
    /* Ensure it's above everything including TagCloud */
    border-radius: 0.35rem;
    border: 1px solid #444;
    margin-bottom: 5px;
    max-height: 300px;
    overflow-y: auto;
}

.dropup-content a {
    color: #ddd;
    padding: 10px 14px;
    text-decoration: none;
    display: flex;
    /* Use flexbox for alignment */
    align-items: center;
    font-size: 0.8rem;
    /* Smaller font as requested */
    border-bottom: 1px solid #333;
    white-space: nowrap;
    /* Prevent wrapping */
}

.dropup-content a:last-child {
    border-bottom: none;
}

.dropup-content a:hover {
    background-color: #444;
    color: var(--primary-color);
}

.dropup-content a.active {
    background-color: #333;
    font-weight: bold;
    color: var(--primary-color);
}

.custom-dropup.active .dropup-content {
    display: block;
}

.theme-btn-sidebar {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.35rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.theme-btn-sidebar:hover {
    border-color: var(--primary-color);
}

/* =========================================
   Direct Fix for Comment Visibility in Dark Mode
   ========================================= */
html.dark-mode .comment-body,
html.dark-mode .comment-content,
html.dark-mode .comment-text,
html.dark-mode .comment-item p {
    color: #e2e8f0 !important;
    /* Slate 200 - High Contrast */
}

html.dark-mode .comment-author {
    color: #f8fafc !important;
    /* Slate 50 - Brightest */
}

html.dark-mode .comment-date {
    color: #94a3b8 !important;
    /* Slate 400 - Readable reduced contrast */
}

html.dark-mode .comment-item {
    border-color: #334155;
    /* Ensure border is visible but subtle */
}

/* Sidebar Subscription Buttons (Graphic Style) */
.sidebar-sub-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    color: white !important;
    transition: opacity 0.2s, transform 0.1s;
    font-family: var(--font-main);
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-sub-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.sidebar-sub-btn:active {
    transform: translateY(0);
}

/* Follow Button (Green) */
.btn-follow {
    background-color: #00d084;
    /* Vibrant Green */
}

/* RSS Button (Orange) */
.btn-rss {
    background: linear-gradient(135deg, #f7b731 0%, #fc5c7d 100%);
    /* Orange-ish Gradient */
    background-color: #ff9f43;
    /* Fallback */
}

.sub-icon {
    font-size: 1.1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: var(--card-bg);
}

.pagination-link:hover {
    background: var(--border-color);
    border-color: var(--text-color);
}

.pagination-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: bold;
    pointer-events: none;
}

.pagination-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    border-color: transparent;
    background: transparent;
}

/* Tag Cloud Overlay & Modal */
.tag-cloud-wrapper {
    position: relative;
    /* Ensure overlay is positioned relative to this */
}

.tag-cloud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.02);
    /* Slight hint it's clickable */
    border-radius: 8px;

}

.tag-cloud-overlay:hover {
    background: rgba(0, 0, 0, 0.05);

}

.tag-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    /* High z-index */
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);

}

.tag-modal-overlay.active {
    display: flex;

}

.tag-modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);

}

@keyframes popIn {
    from {
        transform: scale(0.9);
        opacity: 0;

    }

    to {
        transform: scale(1);
        opacity: 1;

    }


}

.tag-modal-content h3 {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.tag-modal-content .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;

}

.tag-modal-content .close-btn:hover {
    background: var(--bg-color);

}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

}

.tag-item {
    background: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;

}

.tag-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);

}

.tag-item .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;

}


/* =========================================
   Admin Mobile UI Refinements (Added 2026-02-18)
   ========================================= */

/* Default: Hide Mobile Elements on Desktop */
.mobile-only {
    display: none !important;
}

/* Desktop Only: Visible by default, hidden on mobile below */

@media (max-width: 768px) {

    /* 1. Visibility Toggles */
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* 2. Admin Table - Stacked Layout */
    .admin-content table,
    .admin-content thead,
    .admin-content tbody,
    .admin-content tr,
    .admin-content td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .admin-content thead {
        display: none;
    }

    .admin-content tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--card-bg);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        padding: 0.5rem;
    }

    .admin-content td {
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
    }

    .admin-content td:last-child {
        border-bottom: none;
    }

    /* 3. Mobile Date Info */
    .mobile-info {
        font-size: 0.85rem;
        color: #64748b;
        margin-top: 0.2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 4. Actions & Category Row */
    .actions-cell {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
    }

    .actions-cell .btn-group {
        flex-shrink: 0;
    }

    .mobile-category {
        flex-grow: 1;
        min-width: 0;
    }

    .mobile-category select {
        width: 100%;
        max-width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        font-size: 0.85rem;
        padding: 0.3rem;
    }

    /* 5. Translation Status Row */
    .trans-status-cell {
        display: flex !important;
        flex-direction: row !important;
        gap: 6px;
        max-width: 170px;
        margin: 0 auto;
        width: 100%;
    }

    .trans-status-cell .badge,
    .trans-status-cell .btn-trans-retry {
        flex: 1;
        width: auto !important;
        max-width: none !important;
        justify-content: center;
        padding: 0.4rem 0.2rem;
        font-size: 0.75rem;
        height: 28px;
        display: flex;
        align-items: center;
    }
}

/* Desktop Admin Action Buttons Fix */
@media (min-width: 769px) {
    .admin-content td .btn-group {
        display: flex;
        gap: 4px;
        justify-content: center;
    }

    .admin-content td .btn {
        padding: 4px 8px;
        font-size: 0.85rem;
        white-space: nowrap;
        min-width: auto;
    }
}

/* Fix Table Header Alignment & Layout */
.admin-content th {
    text-align: center;
    vertical-align: middle;
}

.admin-content td {
    vertical-align: middle;
}

/* Comment Actions */
.comment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

.comment-actions .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 0.25rem;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    /* Fixed height for consistency */
    font-weight: 500;
}

.comment-actions .btn-reply {
    background-color: var(--card-bg);
    /* Use card bg or neutral */
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.comment-actions .btn-reply:hover {
    background-color: var(--border-color);
}

.comment-actions .btn-delete {
    background-color: #ef4444;
    color: white;
}

.comment-actions .btn-delete:hover {
    background-color: #dc2626;
}

.comment-actions .btn-hide {
    background-color: #f59e0b;
    /* Amber */
    color: white;
}

.comment-actions .btn-hide:hover {
    background-color: #d97706;
}

.comment-actions .btn-show {
    background-color: #10b981;
    /* Emerald */
    color: white;
}

.comment-actions .btn-show:hover {
    background-color: #059669;
}

/* Instagram Embed Responsiveness */
.instagram-media {
    min-width: auto !important; /* Allow shrinking below 326px */
    margin: 0 auto !important; /* Center align when smaller than container */
}