:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #0f1115;
    --text-muted: #5e6c84;
    --border-color: #e2e8f0;
    --primary-color: #fc3f1d;
    --upvote-color: #ff4500;
    --downvote-color: #5a73e8;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.dark {
    --bg-color: #0b0c0e;
    --card-bg: #14161a;
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #24272c;
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.25s, color 0.25s;
    padding-bottom: 30px;
}

.container {
    max-width: 650px;
    margin: 0 auto;
    padding: 0 12px;
}

/* Material Navbar */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 54px;
}
.logo {
    font-size: 1.2rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-color);
}
.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.btn {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s ease-in-out;
}
.btn-submit {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-submit:hover {
    opacity: 0.9;
}
.btn-admin {
    background-color: transparent;
    color: var(--text-color);
    border-color: var(--border-color);
}
.btn-admin:hover {
    background-color: var(--bg-color);
}
.btn-theme {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: inline-flex;
}
.btn-theme:hover {
    background-color: var(--bg-color);
}

/* Tag Pill Badges */
.tag-navigation {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 16px 0 8px 0;
    scrollbar-width: none;
}
.tag-navigation::-webkit-scrollbar {
    display: none;
}
.tag-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 9999px;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: transform 0.1s ease;
}
.tag-pill:active {
    transform: scale(0.95);
}

.sorting-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* Material Feed & Post Cards */
.feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.post-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column; /* Изменено с row на column */
    padding: 16px;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.post-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.empty-card {
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Horizontal Vote Section at the bottom */
.vote-section-horizontal {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-color);
    border-radius: 9999px;
    padding: 4px 12px;
    gap: 10px;
    width: fit-content;
}
.vote-btn {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.1s;
    outline: none;
    padding: 2px;
    display: inline-flex;
    align-items: center;
}
.vote-btn.active-up { color: var(--upvote-color); }
.vote-btn.active-down { color: var(--downvote-color); }
.score {
    font-size: 0.85rem;
    font-weight: 800;
}

.post-content-area {
    width: 100%;
}
.post-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.post-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 10px;
    display: block;
    line-height: 1.4;
}
.post-link-wrapper {
    font-size: 0.85rem;
    margin-bottom: 10px;
}
.post-link-wrapper a {
    color: var(--primary-color);
    word-break: break-all;
    text-decoration: none;
    font-weight: 600;
}
.post-body {
    font-size: 0.95rem;
    margin-bottom: 12px;
    word-wrap: break-word;
    color: var(--text-color);
}
.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9rem;
}
.post-body th, .post-body td {
    padding: 6px;
    border: 1px solid var(--border-color);
}

/* Media Resizing Fixes */
.post-media {
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
    display: flex;
    justify-content: center;
    background-color: rgba(0,0,0,0.02);
}
.post-media img, .post-media video {
    max-width: 100% !important;
    height: auto !important;
    max-height: 480px;
    object-fit: contain; /* Предотвращает обрезание и деформацию медиафайлов */
    display: block;
    border-radius: 12px;
}
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    width: 100%;
    border-radius: 12px;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Post Actions Footer Line */
.post-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
}
.comments-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.comments-link:hover {
    color: var(--primary-color);
}

/* Detailed Post Layout */
.detailed-post h1 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    font-weight: 800;
    line-height: 1.3;
}

/* Comments section */
.comments-section {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    margin-top: 14px;
    box-shadow: var(--card-shadow);
}
.comments-section h2 {
    font-size: 1.15rem;
    margin-bottom: 14px;
    font-weight: 700;
}
.comment-form {
    margin-bottom: 24px;
}
.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-muted);
}
.form-control {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}
.form-alert {
    padding: 10px;
    font-size: 0.85rem;
    margin-bottom: 14px;
    border-radius: 8px;
    font-weight: 700;
}
.alert-success { background-color: rgba(46,125,50,0.1); color: #2e7d32; }
.alert-error { background-color: rgba(198,40,40,0.1); color: #c62828; }
.comment {
    border-top: 1px solid var(--border-color);
    padding: 12px 0;
}
.comment-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.comment-body {
    font-size: 0.92rem;
    color: var(--text-color);
}
.no-comments {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

/* Submission forms page details */
.submit-form-wrapper h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
    font-weight: 800;
}
.submit-notice {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.warn-text { color: var(--primary-color); }
.required { color: red; }
.tags-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    max-height: 140px;
    overflow-y: auto;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.w-100 { width: 100%; padding: 12px; font-size: 1rem; border-radius: 8px; }

/* Admin dashboard styling */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.admin-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
}
.admin-section h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary-color);
    padding-left: 8px;
}
.pending-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pending-item {
    background: var(--bg-color);
    padding: 12px;
    border-radius: 8px;
}
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.danger-btn {
    color: red !important;
    border-color: red !important;
}
.tag-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}
.admin-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-remove {
    text-decoration: none;
    color: red;
    font-weight: 800;
}
.live-table-scroll {
    max-height: 250px;
    overflow-y: auto;
}
.live-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.live-table th, .live-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}
.table-delete {
    color: red;
    text-decoration: none;
}

/* Sitemap elements */
.sitemap-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}
.sitemap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}
.sitemap-box h2 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}
.sitemap-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sitemap-list a {
    font-size: 0.85rem;
    color: var(--text-color);
    text-decoration: none;
}
.sitemap-posts h2 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}
.sitemap-posts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sitemap-posts-list li {
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}
.sitemap-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}
.sitemap-posts-list a {
    font-size: 0.9rem;
    color: var(--text-color);
    text-decoration: none;
}

/* Footer info */
.footer {
    padding: 24px 0;
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-muted);
    margin-top: 30px;
}
.footer-links a {
    color: var(--text-muted);
    text-decoration: underline;
}

@media(max-width: 500px) {
    .sitemap-grid {
        grid-template-columns: 1fr;
    }
}







.post-media img {
    max-width: 100% !important;
    height: auto !important;
    max-height: 480px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}
.post-media video {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    background-color: #000;
    border-radius: 12px;
    display: block;
    object-fit: cover; 
}
.post-link-wrapper a,
.post-body a {
    color: #90a9fd !important;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.15s ease-in-out;
}
.post-link-wrapper a:hover,
.post-body a:hover {
    text-decoration: underline;
    opacity: 0.8;
}
.post-title:hover {
    color: #90a9fd;
}
.post-title:hover {
    color: var(--primary-color);
}
