/* ==================== Глобальні стилі ==================== */
@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap');

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

:root {
    --accent-color: #2563eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.auth-page {
    background: #f5f7fb;
    color: #111827;
}

.auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
    background: transparent;
}

body.auth-page .auth-bg::before,
body.auth-page .auth-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #c7d2fe, #4f46e5);
    opacity: 0.12;
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
}

body.auth-page .auth-bg::before {
    width: 180px;
    height: 180px;
    top: 15%;
    left: 15%;
}

body.auth-page .auth-bg::after {
    width: 240px;
    height: 240px;
    right: 10%;
    bottom: 10%;
    animation-delay: 1s;
}

body.auth-page .auth-bg .particle {
    display: none;
}

.auth-bg .particle:nth-child(1) {
    width: 110px;
    height: 110px;
    top: 8%;
    left: 6%;
    animation-duration: 20s;
}

.auth-bg .particle:nth-child(2) {
    width: 72px;
    height: 72px;
    top: 16%;
    right: 10%;
    animation-duration: 16s;
    animation-delay: 2s;
}

.auth-bg .particle:nth-child(3) {
    width: 96px;
    height: 96px;
    top: 50%;
    left: 10%;
    animation-duration: 22s;
    animation-delay: 1s;
}

.auth-bg .particle:nth-child(4) {
    width: 58px;
    height: 58px;
    bottom: 18%;
    right: 18%;
    animation-duration: 18s;
    animation-delay: 3s;
}

.auth-bg .particle:nth-child(5) {
    width: 84px;
    height: 84px;
    bottom: 6%;
    left: 20%;
    animation-duration: 24s;
    animation-delay: 4s;
}

.auth-bg .particle:nth-child(6) {
    width: 42px;
    height: 42px;
    top: 40%;
    right: 30%;
    animation-duration: 14s;
    animation-delay: 5s;
}

.auth-bg .particle:nth-child(7) {
    width: 54px;
    height: 54px;
    top: 68%;
    right: 14%;
    animation-duration: 20s;
    animation-delay: 2s;
}

.auth-bg .particle:nth-child(8) {
    width: 32px;
    height: 32px;
    bottom: 32%;
    left: 60%;
    animation-duration: 16s;
    animation-delay: 6s;
}

.auth-bg .particle:nth-child(9) {
    width: 38px;
    height: 38px;
    top: 32%;
    left: 70%;
    animation-duration: 18s;
    animation-delay: 1.5s;
}

.auth-bg .particle:nth-child(10) {
    width: 72px;
    height: 72px;
    bottom: 12%;
    right: 40%;
    animation-duration: 22s;
    animation-delay: 2.5s;
}

@keyframes floatParticle {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.65; }
    20% { transform: translate3d(18px, -12px, 0) scale(1.04); opacity: 0.85; }
    40% { transform: translate3d(-18px, 22px, 0) scale(0.96); opacity: 0.72; }
    60% { transform: translate3d(12px, 14px, 0) scale(1.02); opacity: 0.82; }
    80% { transform: translate3d(-10px, -18px, 0) scale(0.98); opacity: 0.7; }
    100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.65; }
}

.auth-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
    padding: 2rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.2);
}

.auth-card h1, .auth-card h2 {
    text-align: center;
}

.auth-card h1 {
    color: #111827;
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    color: #4b5563;
    margin-bottom: 1.5rem;
}

body.auth-page .auth-card h1 {
    color: #0f172a;
}

body.auth-page .auth-card h2 {
    color: #475569;
}

body.auth-page label,
body.auth-page .auth-link,
body.auth-page .form-group input,
body.auth-page .form-group textarea,
body.auth-page .form-group select {
    color: #0f172a;
}

body.auth-page .form-group input,
body.auth-page .form-group textarea,
body.auth-page .form-group select {
    background: #fff;
}

main {
    flex: 1;
}

/* ==================== Навігація ==================== */
.site-header {
    background: #ffffff;
    color: #111827;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.02em;
    position: relative;
}

.hero-banner {
    padding: 1.2rem 0 1rem;
    background: #f8fafc;
    background-size: cover;
    background-position: center;
    color: #0f172a;
    position: relative;
}

.hero-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1rem;
    line-height: 1.05;
}

.hero-content p {
    max-width: 760px;
    margin: 0 auto 1.5rem;
    color: #334155;
    font-size: 1.05rem;
    line-height: 1.75;
}

.homepage-sections {
    padding: 1.5rem 0;
}

.section-cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-card {
    padding: 1.5rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid rgba(59, 130, 246, 0.12);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.18);
}

.section-card-image {
    width: 100%;
    display: block;
    border-radius: 0.85rem;
    margin-bottom: 1rem;
    object-fit: cover;
    max-height: 220px;
}

.section-card h2 {
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.section-card p {
    color: #4b5563;
    margin-bottom: 1rem;
    line-height: 1.7;
}

@media (max-width: 980px) {
    .section-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .section-cards {
        grid-template-columns: 1fr;
    }
}

.logo-icon-wrap {
    width: 2.15rem;
    height: 2.15rem;
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
}

.logo-icon-ring {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    filter: blur(0.3px);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 6px 14px rgba(37, 99, 235, 0.12);
    animation: spinSlow 10s linear infinite;
}

.logo-icon-core {
    position: absolute;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 0.38rem;
    background: #eff6ff;
    transform: rotate(45deg);
    box-shadow:
        inset 0 0 0 1px rgba(37, 99, 235, 0.06),
        0 0 8px rgba(96, 165, 250, 0.1);
}

.logo-icon-core::before,
.logo-icon-core::after {
    content: '';
    position: absolute;
    background: #2563eb;
    border-radius: 999px;
}

.logo-icon-core::before {
    width: 0.18rem;
    height: 0.68rem;
    left: 0.5rem;
    top: 0.26rem;
}

.logo-icon-core::after {
    width: 0.68rem;
    height: 0.18rem;
    left: 0.26rem;
    top: 0.5rem;
}

.logo-icon-spark {
    position: absolute;
    width: 0.35rem;
    height: 0.35rem;
    background: #fff;
    border-radius: 50%;
    right: 0.1rem;
    top: 0.12rem;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text {
    font-size: 2rem;
    color: #0f172a;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    font-family: 'Permanent Marker', cursive;
    line-height: 1;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 45%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.logo-image {
    width: 2.4rem;
    height: 2.4rem;
    object-fit: contain;
    border-radius: 0.8rem;
    border: 1px solid rgba(37, 99, 235, 0.12);
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.footer-logo-image {
    width: 2rem;
    height: 2rem;
    margin-right: 0.65rem;
}

.logo-badge {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    color: #312e81;
    background: rgba(192, 132, 252, 0.12);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link, .btn-logout {
    text-decoration: none;
    color: #111827;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    cursor: pointer;
}

.nav-link:hover,
.btn-logout:hover {
    background: rgba(37, 99, 235, 0.06);
    color: #0f172a;
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.14);
}

/* ==================== Контейнери ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-footer {
    background: #f8fafc;
    color: #0f172a;
    border-top: 1px solid rgba(59, 130, 246, 0.12);
    margin-top: 2rem;
    padding: 3rem 0 1rem;
}

.footer-bottom {
    background: #f1f5f9;
    padding: 1rem 0;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.footer-brand {
    max-width: 420px;
}

.footer-logo {
    margin-bottom: 0.9rem;
}

.footer-logo-icon {
    transform: scale(0.92);
}

.footer-logo .logo-text {
    color: #0f172a;
    background: linear-gradient(90deg, #0f172a, #1d4ed8, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-text {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-socials {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

.footer-socials a {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.footer-socials a:hover {
    background: #eef2ff;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.footer-columns h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4f46e5;
    margin-bottom: 0.8rem;
}

.footer-columns a {
    display: block;
    color: #475569;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 0.45rem;
    transition: color 0.2s ease;
}

.footer-columns a:hover {
    color: #1d4ed8;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.footer-bottom-links {
    display: flex;
    gap: 1rem;
}

.footer-bottom-links a {
    color: #64748b;
    text-decoration: none;
}

.footer-bottom-links a:hover {
    color: #1d4ed8;
}

.legal-page {
    padding: 3rem 0;
}

.legal-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.legal-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4f46e5;
    background: #eef2ff;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    margin-bottom: 0.9rem;
}

.legal-card h1 {
    font-size: 2rem;
    margin-bottom: 0.7rem;
    color: #0f172a;
}

.legal-card > p {
    color: #475569;
    margin-bottom: 1.5rem;
}

.legal-content h2 {
    font-size: 1rem;
    margin: 1.2rem 0 0.4rem;
    color: #0f172a;
}

.legal-content p {
    color: #475569;
    line-height: 1.75;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    40% { transform: translateX(100%); }
    100% { transform: translateX(100%); }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.auth-card h1, .auth-card h2 {
    text-align: center;
}

.auth-card h1 {
    color: #111827;
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    color: #4b5563;
    margin-bottom: 1.5rem;
}

/* ==================== Форми ==================== */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.45rem;
    color: #374151;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: #111827;
    transition: all 0.2s ease;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    font-weight: 600;
}

.form-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

textarea {
    resize: vertical;
    min-height: 130px;
}

/* ==================== Кнопки ==================== */
.btn {
    padding: 0.8rem 1.1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    background: #2563eb;
    color: #ffffff;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.16);
}

.btn-secondary:hover {
    background: #2563eb;
}

.btn-danger {
    background: #1d4ed8;
    color: #fff;
}

.btn-danger:hover {
    background: #1e40af;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ==================== Повідомлення ==================== */
.alert {
    padding: 0.95rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-left-color: #dc2626;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border-left-color: #16a34a;
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-left-color: #2563eb;
}

/* ==================== Головна сторінка ==================== */
.home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1rem;
    align-items: start;
    padding: 1.5rem 0 3rem;
}

#postsFeed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.feed-panel {
    width: 100%;
    min-width: 0;
}

.sidebar-panel {
    position: sticky;
    top: 5.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.sidebar-card {
    background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
    border: 1px solid rgba(59, 130, 246, 0.16);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.08);
}

.sidebar-card h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: #0f172a;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.stats-grid div {
    background: linear-gradient(180deg, #eff6ff 0%, #ecfeff 100%);
    border-radius: 10px;
    padding: 0.7rem;
}

.stats-grid strong {
    display: block;
    font-size: 1rem;
    color: #111827;
}

.stats-grid span {
    color: #6b7280;
    font-size: 0.85rem;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    text-decoration: none;
    color: #374151;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: #f9fafb;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover {
    background: #eef2ff;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.sidebar-link-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(37, 99, 235, 0.12);
    background: #ffffff;
}

.sidebar-link-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-link-content span {
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-link small {
    color: #6b7280;
    font-size: 0.84rem;
}

.feed-toolbar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.search-box input {
    width: 100%;
    background: #f9fafb;
}

.sort-toolbar {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: center;
}

.sort-btn {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid #d1d5eb;
    background: #f8fafc;
    color: #344054;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn.active,
.sort-btn:hover {
    background: #e0e7ff;
    color: #1d4ed8;
    border-color: #c7d2fe;
}

.category-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.category-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn.active,
.category-btn:hover {
    background: #e0e7ff;
    color: #1d4ed8;
    border-color: #c7d2fe;
}

.info-banner,
.post-create {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.info-banner a {
    color: #1d4ed8;
    text-decoration: none;
}

.post-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.9rem;
    margin-bottom: 0;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.post-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.post-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.post-category {
    display: inline-block;
    background: #eef2ff;
    color: #1d4ed8;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    margin-bottom: 0.3rem;
}

.author-block {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.post-author {
    color: #111827;
    font-weight: 600;
    text-decoration: none;
}

.post-date {
    color: #6b7280;
    font-size: 0.88rem;
}

.post-image,
.post-detail-image {
    width: 100%;
    height: 210px;
    max-height: 210px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.9rem;
}

.post-card-body {
    margin-bottom: 0.9rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-title {
    display: block;
    color: #111827;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 0.4rem;
}

.post-title:hover {
    color: #1d4ed8;
}

.post-description {
    color: #111827;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-content-preview {
    color: #4b5563;
    line-height: 1.5;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.7rem;
}

.read-more-btn {
    align-self: flex-start;
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}

.read-more-btn:hover {
    text-decoration: underline;
}

.post-footer {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid #eef2f7;
    padding-top: 0.75rem;
}

.post-stat,
.post-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6b7280;
    font-size: 0.88rem;
    font-weight: 600;
}

.post-stat-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: inherit;
}

.post-action {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #111827;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
}

.post-action.liked {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ==================== Сторінка публікації ==================== */
.post-page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.back-link {
    margin: 1rem 0;
}

.post-detail {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.post-detail-header {
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.post-detail-title {
    font-size: 2rem;
    color: #111827;
    margin-top: 0.4rem;
}

.post-detail-meta {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 0.9rem;
    align-items: center;
}

.post-author-block {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.2rem;
}

.post-author-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.post-author-name {
    color: #111827;
    font-weight: 700;
}

.post-detail-description {
    color: #111827;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.post-detail-content {
    color: #374151;
    line-height: 1.8;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.post-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ==================== Коментарі ==================== */
.comments-section {
    margin-top: 1.5rem;
}

.comments-title {
    font-size: 1.2rem;
    color: #111827;
    margin-bottom: 1rem;
}

.comment-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.comment {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #4f46e5;
    border-radius: 10px;
    padding: 0.9rem;
    margin-bottom: 0.8rem;
}

.comment--nested {
    margin-left: 1.5rem;
    border-left-color: #7c3aed;
}

.comment-author {
    color: #111827;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.comment-time {
    color: #6b7280;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.comment-content {
    color: #374151;
    line-height: 1.6;
}

.comment-actions {
    margin-top: 0.5rem;
}

.comment-reply-btn {
    background: none;
    border: none;
    color: #4f46e5;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.related-posts-section {
    margin-top: 2rem;
}

.related-posts-title {
    font-size: 1.2rem;
    color: #111827;
    margin-bottom: 1rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.related-post-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.1);
}

.related-post-card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f8fafc;
}

.related-post-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.related-post-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: #111827;
}

.related-post-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: #6b7280;
}

@media (max-width: 900px) {
    .related-posts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}

.reply-form-container {
    margin-top: 0.6rem;
}

.reply-form {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.7rem;
}

.reply-textarea {
    width: 100%;
    min-height: 90px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.7rem;
    resize: vertical;
}

.reply-form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
}

.notifications-page {
    padding: 2rem 0 3rem;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.notification-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
}

.notification-item.unread {
    border-left: 4px solid #4f46e5;
}

.notification-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.3rem;
}

.notification-meta small {
    color: #6b7280;
}

/* ==================== Профіль ==================== */
.profile-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 1.5rem;
    padding: 2rem 0 3rem;
    align-items: start;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.35rem;
    margin-left: 0.3rem;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.profile-card,
.profile-posts {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.profile-card {
    padding: 1.5rem;
}

.profile-form .form-group {
    margin-bottom: 1rem;
}

.form-hint {
    display: block;
    margin-top: 0.3rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.profile-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.profile-header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
}

.profile-header p {
    color: #4b5563;
    margin-bottom: 0.2rem;
}

.profile-header span {
    color: #6b7280;
    font-size: 0.9rem;
}

.profile-form {
    margin-top: 1rem;
}

.profile-posts {
    padding: 1.5rem;
}

.profile-posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile-posts-header h3 {
    font-size: 1.2rem;
}

.profile-posts .post-card {
    margin-bottom: 0.9rem;
}

/* ==================== Адмінка ==================== */
.admin-users-page {
    padding: 2rem 0 3rem;
}

.admin-users-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-users-header h1 {
    font-size: 1.8rem;
    margin-top: 0.4rem;
}

.admin-users-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-users-table th,
.admin-users-table td {
    text-align: left;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #eef2f7;
}

.admin-users-table th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-active {
    background: #ecfdf3;
    color: #15803d;
}

.status-restricted {
    background: #fff7ed;
    color: #c2410c;
}

.status-blocked {
    background: #fef2f2;
    color: #b91c1c;
}

.admin-actions-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-action-select {
    width: auto;
    min-width: 140px;
}

/* ==================== Пагінація ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(14px);
}

.cookie-banner-content {
    flex: 1;
    min-width: 220px;
}

.cookie-banner-content strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
    color: #0f172a;
}

.cookie-banner-content p {
    margin: 0;
    line-height: 1.6;
    color: #1f2937;
    font-size: 1rem;
}

.cookie-banner-link {
    display: inline-block;
    margin-top: 0.6rem;
    color: #1d4ed8;
    text-decoration: underline;
    font-size: 1rem;
}

.cookie-banner-link:hover {
    color: #0f172a;
}

#cookieBannerAccept {
    white-space: nowrap;
}

.cookie-banner.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .cookie-banner {
        padding: 0.85rem 0.9rem;
        text-align: center;
    }

    .cookie-banner-content {
        width: 100%;
    }

    .cookie-banner button {
        width: 100%;
    }
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    min-width: 2.2rem;
}

.pagination-item.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.pagination-nav {
    font-weight: 700;
}

/* ==================== Завантаження ==================== */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== 404 сторінка ==================== */
.error-page {
    position: relative;
    min-height: 70vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 3rem 0;
}

.error-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 3rem 2rem;
    max-width: 560px;
    text-align: center;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    animation: fadeUp 0.7s ease both;
}

.error-tag {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 700;
    margin-bottom: 1rem;
}

.error-card h1 {
    font-size: 3rem;
    color: #111827;
    margin-bottom: 0.8rem;
}

.error-card p {
    color: #4b5563;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.error-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #c7d2fe, #4f46e5);
    opacity: 0.12;
    animation: float 6s ease-in-out infinite;
}

.orb-one {
    width: 180px;
    height: 180px;
    top: 15%;
    left: 15%;
}

.orb-two {
    width: 240px;
    height: 240px;
    right: 10%;
    bottom: 10%;
    animation-delay: 1s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-18px) scale(1.05);
    }
}

/* ==================== Утиліти ==================== */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

.no-posts {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
}

.auth-link a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.create-post-wrapper {
    max-width: 760px;
    margin: 2rem auto;
}

@media (max-width: 1100px) {
    #postsFeed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sidebar-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    nav {
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    #postsFeed {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-posts-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-detail-title {
        font-size: 1.6rem;
    }

    .post-card-top {
        flex-direction: column;
        align-items: flex-start;
    }
}

.messages-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    min-height: 560px;
}

.messages-sidebar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 1rem;
}

.messages-sidebar h3 {
    margin: 0 0 0.9rem;
    font-size: 1rem;
}

.messages-search {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    margin-bottom: 0.8rem;
    font: inherit;
}

.message-user-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.message-user-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem;
    border-radius: 12px;
    color: #111827;
    text-decoration: none;
    transition: background 0.2s ease;
}

.message-user-link:hover,
.message-user-link.active {
    background: #f8fafc;
}

.message-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.messages-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #eef2ff;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
}

.messages-list {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    background: #f8fafc;
}

.message-item {
    display: flex;
    justify-content: flex-start;
}

.message-item.me {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 75%;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    background: #e5e7eb;
    color: #111827;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-item.me .message-bubble {
    background: #2563eb;
    color: #fff;
}

.message-meta {
    display: block;
    font-size: 0.78rem;
    opacity: 0.72;
    margin-top: 0.3rem;
}

.message-form {
    display: flex;
    gap: 0.6rem;
    padding: 1rem;
    border-top: 1px solid #eef2ff;
}

.message-form textarea {
    flex: 1;
    min-height: 52px;
    max-height: 140px;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 0.75rem;
    font: inherit;
}

.message-empty {
    color: #6b7280;
    text-align: center;
    padding: 2rem 1rem;
}

@media (max-width: 900px) {
    .messages-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-right {
        width: 100%;
        justify-content: space-between;
    }

    .post-detail {
        padding: 1rem;
    }
}

/* ==================== Мобільна адаптація ==================== */
html {
    overflow-x: hidden;
}

img,
video,
iframe,
embed,
object,
svg {
    max-width: 100%;
    height: auto;
}

* {
    word-break: break-word;
}

@media (max-width: 1024px) {
    .site-nav {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.9rem 1rem;
    }

    .site-nav .logo {
        width: 100%;
        justify-content: center;
    }

    .nav-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .nav-right .nav-link,
    .nav-right .btn-logout,
    .nav-right .btn-primary {
        flex: 1 1 160px;
        min-width: 120px;
    }

    .footer-top {
        grid-template-columns: 1fr;
    }

    .footer-socials {
        justify-content: center;
    }
}

@media (max-width: 820px) {
    .hero-content {
        padding: 0 1rem;
    }

    .section-card {
        padding: 1.25rem;
    }
}

@media (max-width: 680px) {
    .site-nav {
        align-items: center;
    }

    .logo {
        justify-content: center;
        text-align: center;
    }

    .nav-right {
        justify-content: center;
    }

    .nav-right .nav-link,
    .nav-right .btn-logout,
    .nav-right .btn-primary {
        width: auto;
        flex: 1 1 100%;
        text-align: center;
    }

    .footer-top {
        padding-bottom: 1.5rem;
    }

    .footer-socials {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .messages-sidebar,
    .messages-panel,
    .profile-card,
    .profile-posts,
    .post-detail,
    .create-post-wrapper,
    .auth-card {
        width: 100%;
    }

    .message-bubble {
        max-width: 100%;
    }

    .notification-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .notification-item,
    .message-user-link {
        padding: 0.85rem;
    }

    .footer-bottom,
    .site-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
