@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0c0d12;
    --surface: #151720;
    --surface-hover: #1d202b;
    --border: #292d3a;
    --text: #f3f4f8;
    --muted: #9298a8;
    --red: #ef3340;
    --red-hover: #ff4d59;
    --green: #39c98a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 50% -20%, rgba(239, 51, 64, .13), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.65;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 22px max(calc((100% - 1100px) / 2), 24px);
    border-bottom: 1px solid var(--border);
    background: rgba(15, 16, 23, .9);
}

header h1 {
    margin: 0;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -1px;
}

header p {
    color: var(--muted);
    margin: 0;
}

header a,
nav a {
    color: var(--muted);
    text-decoration: none;
    margin-right: 14px;
    transition: color .2s;
}

header a:hover,
nav a:hover {
    color: var(--red-hover);
}

nav {
    max-width: 1100px;
    margin: 25px auto;
    padding: 0 24px;
}

main {
    width: min(100% - 40px, 1000px);
    margin: 45px auto;
    padding: 32px;
    background: rgba(21, 23, 32, .92);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .2);
}

h2 {
    margin-top: 0;
    font-size: 28px;
    letter-spacing: -.7px;
}

h3 {
    margin-top: 30px;
    font-size: 19px;
}

p {
    color: #c4c8d3;
}

small {
    color: var(--muted);
}

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

main > a,
button,
input[type="submit"] {
    display: inline-block;
    padding: 11px 18px;
    border: 0;
    border-radius: 9px;
    background: var(--red);
    color: white;
    font-family: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

button:hover,
input[type="submit"]:hover,
main > a:hover {
    background: var(--red-hover);
    transform: translateY(-1px);
}

input,
textarea,
select {
    width: 100%;
    margin: 7px 0 18px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #10121a;
    color: var(--text);
    font: inherit;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 51, 64, .12);
}

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

label {
    color: #e2e4eb;
    font-weight: 600;
}

form {
    margin-top: 20px;
}

form button {
    margin-top: 8px;
}

blockquote {
    margin: 20px 0;
    padding: 18px;
    border-left: 3px solid var(--red);
    border-radius: 8px;
    background: var(--surface-hover);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 25px 0;
}

li {
    margin: 12px 0;
    color: #d7d9e1;
}

ul {
    padding-left: 22px;
}

.errorlist {
    color: #ff6974;
}

@media (max-width: 650px) {
    header {
        padding: 18px 20px;
        align-items: flex-start;
    }

    header h1 {
        font-size: 22px;
    }

    main {
        width: calc(100% - 24px);
        margin: 20px auto;
        padding: 20px;
    }

    h2 {
        font-size: 23px;
    }
}
/* JABKO SOCIAL - DASHBOARD */

.dashboard-header {
    max-width: 100%;
    padding: 18px max(calc((100% - 1200px) / 2), 24px);
}

.brand {
    color: var(--text);
    font-size: 25px;
    font-weight: 800;
    text-decoration: none;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.user-nav form {
    margin: 0;
}

.user-nav button {
    padding: 9px 16px;
}

.dashboard {
    max-width: 1200px;
    width: calc(100% - 40px);
    margin: 35px auto;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 230px;
    padding: 42px;
    border: 1px solid #63303a;
    border-radius: 22px;
    background: linear-gradient(120deg, #351922, #211923 65%, #301a28);
    overflow: hidden;
}

.welcome-panel h1 {
    margin: 10px 0;
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -1.5px;
}

.welcome-panel p {
    max-width: 580px;
}

.eyebrow {
    color: #ff7b85;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

.welcome-emoji {
    font-size: 100px;
    filter: drop-shadow(0 10px 25px rgba(239, 51, 64, .3));
}

.dashboard-section {
    margin-top: 45px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 0;
    font-size: 25px;
}

.section-heading p {
    margin: 5px 0;
    color: var(--muted);
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
}

.social-tile {
    display: flex;
    flex-direction: column;
    min-height: 235px;
    padding: 23px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: transform .2s, border-color .2s, background .2s;
}

.social-tile:hover,
.category-tile:hover {
    transform: translateY(-5px);
    border-color: var(--red);
    background: var(--surface-hover);
}

.tile-icon {
    font-size: 34px;
    margin-bottom: 17px;
}

.social-tile h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.social-tile p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.tile-link {
    margin-top: auto;
    padding-top: 18px;
    color: #ff6974;
    font-size: 13px;
    font-weight: 700;
}

.tile-posts {
    background: linear-gradient(145deg, #35202a, #1b1922);
}

.tile-photos {
    background: linear-gradient(145deg, #202c38, #171b25);
}

.tile-chat {
    background: linear-gradient(145deg, #28243a, #191923);
}

.tile-community {
    background: linear-gradient(145deg, #20352f, #171e22);
}

.coming-soon {
    opacity: .8;
}

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

.category-tile {
    display: flex;
    flex-direction: column;
    min-height: 175px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: .2s;
}

.category-icon {
    font-size: 25px;
}

.category-tile h3 {
    margin: 10px 0 5px;
}

.category-tile p {
    margin: 0 0 15px;
    font-size: 13px;
    color: var(--muted);
}

.category-count {
    margin-top: auto;
    color: #ff6974;
    font-size: 12px;
    font-weight: 700;
}

.dashboard-footer {
    padding: 25px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

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

    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 550px) {
    .dashboard-header {
        padding: 16px;
    }

    .user-nav {
        flex-wrap: wrap;
        gap: 10px;
    }

    .welcome-panel {
        padding: 25px;
        min-height: 190px;
    }

    .welcome-emoji {
        font-size: 55px;
    }

    .tile-grid,
    .category-grid {
        grid-template-columns: 1fr;
    }

    .social-tile {
        min-height: 190px;
    }
}
/* =================================
   JABKO SOCIAL - CATEGORY REDESIGN
================================= */

.category-page {
    max-width: 1100px;
    width: calc(100% - 40px);
    margin: 45px auto;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.category-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 30px;
    min-height: 240px;
    padding: 42px;
    overflow: hidden;
    border: 1px solid rgba(239, 51, 64, .35);
    border-radius: 24px;
    background:
        radial-gradient(circle at 90% 20%, rgba(239,51,64,.25), transparent 35%),
        linear-gradient(120deg, #351922, #1c1924 70%, #271923);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.category-hero::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -100px;
    bottom: -180px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 50%;
    box-shadow: 0 0 0 30px rgba(255,255,255,.02),
                0 0 0 60px rgba(255,255,255,.02);
}

.category-hero-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 105px;
    height: 105px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 27px;
    background: rgba(255,255,255,.07);
    font-size: 55px;
    box-shadow: 0 12px 35px rgba(0,0,0,.2);
}

.category-hero-content {
    position: relative;
    z-index: 1;
}

.category-hero h1 {
    margin: 8px 0;
    font-size: clamp(30px, 5vw, 43px);
    letter-spacing: -1.5px;
}

.category-hero p {
    margin: 0;
    color: #c9c4ce;
    font-size: 15px;
}

.category-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.category-hero-meta span {
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 20px;
    background: rgba(0,0,0,.2);
    color: #e5dce1;
    font-size: 12px;
}

.category-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin: 42px 0 22px;
}

.category-toolbar h2 {
    margin: 0;
    font-size: 26px;
}

.category-toolbar p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.create-post-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 20px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    background: linear-gradient(135deg, #f04450, #c91e32);
    color: white;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(239,51,64,.2);
    transition: .2s ease;
}

.create-post-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(239,51,64,.35);
    background: linear-gradient(135deg, #ff5964, #df263c);
}

.social-post-list {
    display: grid;
    gap: 17px;
}

.social-post-card {
    padding: 25px 28px;
    border: 1px solid #2b2e3b;
    border-radius: 19px;
    background: linear-gradient(145deg, #191c27, #14161f);
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.social-post-card:hover {
    transform: translateY(-3px);
    border-color: rgba(239,51,64,.55);
    box-shadow: 0 16px 38px rgba(0,0,0,.25);
}

.post-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.post-avatar {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    flex-shrink: 0;
    border: 1px solid rgba(239,51,64,.3);
    border-radius: 14px;
    background: #30202a;
    font-size: 22px;
}

.post-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-author-info strong {
    color: #f5f5f8;
    font-size: 14px;
}

.post-author-info span {
    color: #858b9b;
    font-size: 12px;
}

.post-category-label {
    margin-left: auto;
    padding: 6px 10px;
    border: 1px solid rgba(239,51,64,.2);
    border-radius: 20px;
    background: rgba(239,51,64,.08);
    color: #ff7b85;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.post-card-title {
    display: inline-block;
    margin-bottom: 8px;
    color: #fff;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.35;
    text-decoration: none;
    letter-spacing: -.4px;
}

.post-card-title:hover {
    color: #ff6974;
}

.post-card-content {
    margin: 0;
    color: #b7bdca;
    font-size: 14px;
    line-height: 1.8;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
    padding-top: 17px;
    border-top: 1px solid #2a2d38;
    color: #9298a8;
    font-size: 12px;
}

.post-card-footer a {
    color: #ff6974;
    font-weight: 800;
    text-decoration: none;
}

.post-card-footer a:hover {
    color: white;
}

.empty-category {
    padding: 55px 25px;
    border: 1px dashed #414352;
    border-radius: 20px;
    background: rgba(21,23,32,.7);
    text-align: center;
}

.empty-category > div {
    font-size: 48px;
}

.empty-category h3 {
    margin: 15px 0 5px;
    font-size: 21px;
}

.empty-category p {
    margin-bottom: 22px;
    color: var(--muted);
}

@media (max-width: 600px) {
    .category-page {
        width: calc(100% - 24px);
        margin: 22px auto;
    }

    .category-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
        padding: 25px;
    }

    .category-hero-icon {
        width: 72px;
        height: 72px;
        border-radius: 20px;
        font-size: 38px;
    }

    .category-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .create-post-button {
        width: 100%;
    }

    .social-post-card {
        padding: 20px;
    }

    .post-card-title {
        font-size: 18px;
    }
}
/* =====================================
   JABKO SOCIAL - POST & COMMENTS REDESIGN
===================================== */

.post-page {
    max-width: 950px;
    width: calc(100% - 40px);
    margin: 35px auto 55px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.post-breadcrumb {
    margin-bottom: 20px;
    color: #777f91;
    font-size: 13px;
}

.post-breadcrumb a {
    color: #ff6974;
    text-decoration: none;
}

.post-breadcrumb a:hover {
    color: white;
}

.main-post-card {
    padding: 32px;
    border: 1px solid #34303d;
    border-radius: 23px;
    background:
        radial-gradient(ellipse at 100% 0%, rgba(239,51,64,.09), transparent 40%),
        linear-gradient(145deg, #1b1d29, #14161f);
    box-shadow: 0 18px 50px rgba(0,0,0,.2);
}

.main-post-top {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 27px;
}

.main-post-avatar {
    width: 52px;
    height: 52px;
    font-size: 26px;
}

.main-post-title {
    margin: 0 0 20px;
    color: #fff;
    font-size: clamp(26px, 4vw, 36px);
    line-height: 1.25;
    letter-spacing: -1px;
}

.main-post-content {
    color: #d1d4df;
    font-size: 16px;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.main-post-content p {
    color: inherit;
    margin: 0 0 15px;
}

.post-edited-note {
    margin-top: 20px;
    color: #858b9b;
    font-size: 12px;
}

.main-post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 25px;
}

.edit-action,
.delete-action {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #343746;
    border-radius: 9px;
    background: #222532;
    color: #cbd0dc;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: .2s;
}

.edit-action:hover {
    border-color: #6678c9;
    background: #292e42;
    color: #aab9ff;
}

.delete-action:hover {
    border-color: #a93642;
    background: #3a2029;
    color: #ff7b85;
}

.main-post-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #303340;
    color: #999faf;
    font-size: 13px;
}

.comments-section {
    margin-top: 42px;
}

.comments-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 23px;
}

.comments-heading h2 {
    margin: 5px 0;
    font-size: 27px;
}

.comments-heading p {
    margin: 0;
    color: #9298a8;
    font-size: 13px;
}

.comments-count {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(239,51,64,.35);
    border-radius: 15px;
    background: rgba(239,51,64,.12);
    color: #ff6974;
    font-size: 19px;
    font-weight: 800;
}

.comment-list {
    display: grid;
    gap: 14px;
}

.comment-card {
    display: flex;
    gap: 15px;
    padding: 22px;
    border: 1px solid #2d303d;
    border-radius: 17px;
    background: linear-gradient(145deg, #191c26, #151720);
    transition: border-color .2s, transform .2s;
}

.comment-card:hover {
    border-color: #48404b;
    transform: translateY(-2px);
}

.comment-card.my-comment {
    border-color: rgba(239,51,64,.32);
    background: linear-gradient(120deg, rgba(239,51,64,.09), #171923 70%);
}

.comment-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 43px;
    height: 43px;
    border: 1px solid #393343;
    border-radius: 14px;
    background: #292331;
    font-size: 20px;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 13px;
}

.comment-author-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.comment-author-info strong {
    color: #f3f4f8;
    font-size: 14px;
}

.comment-author-info span {
    color: #858b9b;
    font-size: 11px;
}

.comment-content {
    color: #c9cdd8;
    font-size: 14px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.comment-content p {
    color: inherit;
    margin: 0 0 9px;
}

.comment-actions {
    display: flex;
    gap: 7px;
}

.comment-actions .edit-action,
.comment-actions .delete-action {
    padding: 6px 9px;
    font-size: 11px;
}

.empty-comments {
    padding: 40px 20px;
    border: 1px dashed #414352;
    border-radius: 18px;
    background: rgba(21,23,32,.65);
    text-align: center;
}

.empty-comments > span {
    font-size: 42px;
}

.empty-comments h3 {
    margin: 12px 0 5px;
    font-size: 19px;
}

.empty-comments p {
    color: #9298a8;
    font-size: 13px;
}

.comment-form-section {
    margin-top: 38px;
    padding: 27px;
    border: 1px solid #34303d;
    border-radius: 21px;
    background:
        radial-gradient(ellipse at 100% 0%, rgba(239,51,64,.08), transparent 45%),
        #171923;
}

.comment-form-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 22px;
}

.comment-form-heading > span {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(239,51,64,.13);
    font-size: 23px;
}

.comment-form-heading h2 {
    margin: 0;
    font-size: 21px;
}

.comment-form-heading p {
    margin: 3px 0 0;
    color: #9298a8;
    font-size: 12px;
}

.social-comment-form {
    margin: 0;
}

.social-comment-form label {
    display: block;
    margin-bottom: 9px;
    color: #e2e4eb;
    font-size: 13px;
}

.social-comment-form textarea {
    min-height: 140px;
    margin: 0;
    padding: 16px;
    border: 1px solid #383b49;
    border-radius: 13px;
    background: #10121a;
    font-size: 14px;
    line-height: 1.7;
}

.social-comment-form textarea:focus {
    border-color: #ef3340;
    box-shadow: 0 0 0 4px rgba(239,51,64,.1);
}

.comment-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 17px;
}

.comment-submit-row > span {
    color: #858b9b;
    font-size: 12px;
}

.comment-submit-row button {
    margin: 0;
    padding: 12px 19px;
    border-radius: 11px;
    background: linear-gradient(135deg, #f04450, #c91e32);
}

.login-to-comment {
    text-align: center;
}

.login-to-comment p {
    margin-bottom: 17px;
    color: #b7bdca;
}

.login-to-comment .create-post-button {
    width: auto;
}

@media (max-width: 600px) {
    .post-page {
        width: calc(100% - 24px);
        margin: 20px auto 35px;
    }

    .main-post-card {
        padding: 21px;
    }

    .main-post-top {
        gap: 10px;
    }

    .main-post-top .post-category-label {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }

    .comment-card {
        gap: 10px;
        padding: 16px;
    }

    .comment-avatar {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .comment-form-section {
        padding: 20px;
    }

    .comment-submit-row {
        align-items: stretch;
        flex-direction: column;
    }

    .comment-submit-row button {
        width: 100%;
    }
}


/* Zdjecia w postach */
.main-post-image {
    margin-top: 22px;
    overflow: hidden;
    border-radius: 16px;
    text-align: center;
}

.main-post-image img {
    display: block;
    width: 100%;
    max-height: 650px;
    object-fit: contain;
    border-radius: 16px;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.main-post-image a:hover img {
    transform: scale(1.01);
}



/* Wlasny wybor zdjecia */
.image-upload-box { margin-top: 8px; }
.image-upload-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.image-upload-button { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 12px; background: var(--red); color: #fff; font-weight: 700; cursor: pointer; transition: background .2s, transform .2s; }
.image-upload-button:hover { background: var(--red-hover); transform: translateY(-1px); }
.image-upload-hint { color: var(--muted, #a5a5b0); font-size: 13px; margin: 9px 0 0; }
.image-preview { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px; max-width: 440px; border: 1px solid rgba(239,51,64,.35); border-radius: 14px; background: rgba(255,255,255,.03); }
.image-preview[hidden] { display: none; }
.image-preview img { width: 110px; height: 90px; object-fit: cover; border-radius: 9px; }
.image-preview-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.image-preview-info strong { overflow-wrap: anywhere; color: var(--text, #fff); font-size: 13px; }
.image-preview-info button { background: transparent; color: var(--red-hover); border: 1px solid var(--red); padding: 7px 10px; border-radius: 8px; cursor: pointer; }



/* Podglad zdjecia - lightbox */
.main-post-image-trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    border-radius: 16px;
    overflow: hidden;
}
.main-post-image-trigger img {
    display: block;
    width: 100%;
    max-height: 650px;
    object-fit: contain;
    border-radius: 16px;
    transition: transform .2s ease;
}
.main-post-image-trigger:hover img {
    transform: scale(1.01);
}
.image-lightbox[hidden] {
    display: none;
}
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 65px 24px 24px;
    background: rgba(5, 6, 10, .94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.image-lightbox-content {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 100px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 15px 70px rgba(0, 0, 0, .65);
}
.image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 51, 64, .65);
    border-radius: 13px;
    background: var(--red);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.image-lightbox-close:hover {
    background: var(--red-hover);
    transform: scale(1.06);
}
@media (max-width: 600px) {
    .image-lightbox {
        padding: 60px 10px 15px;
    }
    .image-lightbox-content {
        max-height: calc(100vh - 85px);
    }
    .image-lightbox-close {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
    }
}

/* JABKO SOCIAL - HOME FEED */
.home-feed .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.create-post-button {
    display: inline-flex;
    align-items: center;
    padding: 11px 17px;
    border-radius: 12px;
    background: var(--red);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    transition: .2s;
}

.create-post-button:hover {
    background: var(--red-hover);
    transform: translateY(-2px);
}

.home-feed-grid {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 18px;
}

.home-feed-panel {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
}

.home-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.home-panel-heading h3 {
    margin: 0;
    font-size: 17px;
}

.home-panel-heading span {
    color: var(--muted);
    font-size: 11px;
}

.home-post-list {
    display: flex;
    flex-direction: column;
}

.home-post-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: .2s;
}

.home-post-item:hover {
    padding-left: 6px;
    color: #ff6974;
}

.home-post-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(239, 51, 64, .12);
    font-size: 21px;
}

.home-post-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.home-post-info strong {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.home-post-info span,
.home-post-info small {
    color: var(--muted);
    font-size: 11px;
}

.home-post-arrow {
    margin-left: auto;
    color: var(--red);
}

.home-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.home-photo-item {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: var(--surface-hover);
}

.home-photo-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s;
}

.home-photo-item:hover img {
    transform: scale(1.06);
}

.home-photo-item span {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 22px 9px 9px;
    overflow: hidden;
    background: linear-gradient(transparent, rgba(0,0,0,.8));
    color: #fff;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-empty {
    padding: 18px 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 750px) {
    .home-feed-grid {
        grid-template-columns: 1fr;
    }
}


/* PROFILE */
.profile-page {
    max-width: 900px;
}
.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    padding: 10px 0 30px;
    border-bottom: 1px solid var(--border);
}
.profile-avatar {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    border: 3px solid var(--red);
    background: var(--surface-hover);
    font-size: 58px;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-main-info {
    min-width: 0;
}
.profile-main-info h1 {
    margin: 0;
    font-size: 30px;
    overflow-wrap: anywhere;
}
.profile-main-info > p {
    color: var(--muted);
    margin: 5px 0 14px;
}
.profile-bio {
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}
.profile-bio p {
    margin: 0 0 8px;
}
.profile-no-bio,
.profile-empty {
    color: var(--muted);
}
.profile-posts {
    padding-top: 20px;
}
.profile-posts h2 {
    margin-bottom: 20px;
}
.profile-post {
    padding: 20px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}
.profile-post h3 {
    margin: 0 0 8px;
}
.profile-post h3 a {
    color: var(--text);
    text-decoration: none;
}
.profile-post h3 a:hover {
    color: var(--red-hover);
}
.profile-post p {
    margin: 8px 0 14px;
}
.profile-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
}
@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-main-info {
        width: 100%;
    }
}


/* PROFILE EDIT */
.edit-profile-page {
    max-width: 760px;
}
.edit-profile-page > p {
    color: var(--muted);
}
.profile-edit-avatar {
    width: 130px;
    height: 130px;
    margin: 20px auto 28px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--red);
    border-radius: 50%;
    background: var(--surface-hover);
    font-size: 55px;
}
.profile-edit-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-form-field {
    margin-bottom: 20px;
}
.profile-form-field label {
    display: block;
}
.profile-form-field textarea {
    min-height: 150px;
}
.profile-form-error {
    color: var(--red-hover);
    margin-top: -12px;
}
.edit-profile-page .image-upload-box {
    margin-top: 10px;
}
.edit-profile-page .image-upload-input {
    display: none;
}
.edit-profile-page .image-upload-hint {
    color: var(--muted);
    font-size: 13px;
}


/* USER AVATARS */
.post-avatar,
.comment-avatar {
    overflow: hidden;
    border-radius: 50%;
}

.post-avatar img,
.comment-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.post-author-info a,
.comment-author-info a {
    color: inherit;
    text-decoration: none;
}

.post-author-info a:hover,
.comment-author-info a:hover {
    color: var(--red-hover);
}


/* HOMEPAGE PROFILE AVATARS */
.home-post-icon {
    overflow: hidden;
    border-radius: 50%;
}

.home-post-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.home-post-info a {
    color: inherit;
    text-decoration: none;
}

.home-post-info a:hover {
    color: var(--red-hover);
}


/* HEADER USER PROFILE */
.header-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.header-profile-link:hover {
    color: var(--red-hover);
}

.header-profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--red);
    border-radius: 50%;
    background: var(--surface-hover);
    font-size: 19px;
}

.header-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-profile-link small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}


/* PRIVATE MESSENGER */
.inbox-page,
.conversation-page {
    width: min(1200px, calc(100% - 40px));
    margin: 40px auto;
}

.inbox-hero {
    margin-bottom: 30px;
}

.inbox-hero h1 {
    margin: 8px 0;
    font-size: 32px;
}

.inbox-hero p,
.conversation-person small {
    color: var(--muted);
}

.inbox-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.inbox-panel,
.chat-window {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.inbox-panel-heading {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.inbox-panel-heading h2 {
    margin: 0;
    font-size: 19px;
}

.conversation-item,
.message-user-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 20px;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background .2s;
}

.conversation-item:hover,
.message-user-item:hover {
    background: var(--surface-hover);
}

.conversation-avatar,
.message-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-hover);
    font-size: 22px;
}

.message-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.conversation-info {
    min-width: 0;
    flex: 1;
}

.conversation-info strong {
    display: block;
}

.conversation-info p {
    margin: 5px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-arrow {
    color: var(--red);
}

.message-user-item strong {
    flex: 1;
}

.message-user-item > span:last-child {
    color: var(--red);
    font-size: 12px;
}

.inbox-empty {
    padding: 25px 20px;
    color: var(--muted);
    line-height: 1.6;
}

.conversation-topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.conversation-topbar > a {
    color: var(--red);
    text-decoration: none;
}

.conversation-person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversation-person img,
.conversation-person > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface);
    font-size: 22px;
}

.conversation-person small {
    display: block;
    margin-top: 3px;
}

.chat-window {
    display: flex;
    flex-direction: column;
    min-height: 550px;
}

.chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 15px;
    padding: 25px;
}

.chat-message {
    display: flex;
}

.chat-message-own {
    justify-content: flex-end;
}

.chat-message-other {
    justify-content: flex-start;
}

.chat-message-bubble {
    max-width: min(75%, 550px);
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface-hover);
    overflow-wrap: anywhere;
}

.chat-message-own .chat-message-bubble {
    border-color: var(--red);
    background: var(--red);
    color: white;
}

.chat-message-bubble p {
    margin: 0;
    line-height: 1.5;
}

.chat-message-bubble small {
    display: block;
    margin-top: 8px;
    font-size: 10px;
    opacity: .75;
    text-align: right;
}

.chat-empty {
    margin: auto;
    padding: 40px 15px;
    text-align: center;
}

.chat-empty > div {
    font-size: 45px;
}

.chat-empty p {
    color: var(--muted);
}

.chat-compose {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-top: 1px solid var(--border);
}

.chat-compose textarea {
    flex: 1;
    min-width: 0;
    resize: vertical;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    font: inherit;
}

.chat-compose button {
    padding: 13px 20px;
    border: 0;
    border-radius: 10px;
    background: var(--red);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.chat-compose button:hover {
    filter: brightness(1.12);
}

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

    .inbox-page,
    .conversation-page {
        width: calc(100% - 24px);
        margin: 25px auto;
    }

    .chat-window {
        min-height: 65vh;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-message-bubble {
        max-width: 88%;
    }

    .chat-compose {
        padding: 12px;
    }
}


/* UNREAD MESSAGE COUNTER */
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--red);
    color: white;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 12px rgba(220, 40, 55, .25);
}


/* Statusy aktywności użytkowników */
.user-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 5px;
    min-width: 0;
}

.user-meta strong {
    flex: none;
}

.user-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-radius: 50%;
}

.status-dot.online {
    background: #35c979;
    box-shadow: 0 0 8px rgba(53, 201, 121, .55);
}

.status-dot.offline {
    background: #858b96;
}


/* Formularz tworzenia grupy */
.group-create-form .group-form-field { margin-bottom: 24px; }
.group-create-form .group-form-field > label { display: block; margin-bottom: 8px; }
.group-create-form .group-form-help { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.group-create-form #id_participants { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.group-create-form #id_participants > div { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: #10121a; transition: border-color .2s, background .2s; }
.group-create-form #id_participants > div:hover { border-color: rgba(239, 51, 64, .65); background: var(--surface-hover); }
.group-create-form #id_participants > div:has(input:checked) { border-color: var(--red); background: rgba(239, 51, 64, .12); }
.group-create-form #id_participants label { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; margin: 0; padding: 12px 15px; cursor: pointer; font-weight: 500; overflow-wrap: anywhere; }
.group-create-form #id_participants input[type=checkbox] { appearance: auto; accent-color: var(--red); flex: 0 0 18px; width: 18px; height: 18px; margin: 0; padding: 0; cursor: pointer; }
.group-create-form .group-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 28px; }
.group-create-form .group-form-actions a { color: var(--muted); text-decoration: none; }
.group-create-form .group-form-actions a:hover { color: var(--red-hover); }
.group-create-form .errorlist, .group-create-form .group-form-errors { color: #ff7b83; }
@media (max-width: 520px) { .group-create-form #id_participants { grid-template-columns: 1fr; } }



 /* ZDJECIA W CZACIE */
.chat-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 10px;
    max-width: 420px;
}

.chat-image-button {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    background: transparent;
    cursor: zoom-in;
}

.chat-image-button img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    transition: transform .2s ease;
}

.chat-image-button:hover img {
    transform: scale(1.04);
}

.chat-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 48px;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

.chat-upload-label:hover {
    background: var(--red-hover);
    transform: translateY(-1px);
}

.chat-upload-label input { display: none; }

.chat-upload-hint {
    margin: 4px 18px 12px;
    color: var(--muted);
    font-size: 12px;
}

.chat-upload-error {
    margin: 10px 18px;
    padding: 10px 13px;
    border: 1px solid var(--red);
    border-radius: 9px;
    color: var(--red);
    font-size: 13px;
}

.chat-image-lightbox[hidden] {
    display: none;
}

.chat-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(0, 0, 0, .92);
}

.chat-image-lightbox img {
    display: block;
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
}

.chat-image-lightbox-close {
    position: absolute;
    top: 15px;
    right: 22px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: white;
    font-size: 30px;
    cursor: pointer;
}

@media (max-width: 750px) {
    .chat-compose {
        flex-wrap: wrap;
    }

    .chat-compose textarea {
        flex-basis: 100%;
    }

    .chat-upload-label {
        max-width: 100%;
    }

    .chat-upload-hint {
        margin-left: 12px;
        margin-right: 12px;
    }

    .chat-image-lightbox {
        padding: 12px;
    }
}

.chat-image-preview { margin: 0 18px 12px; padding: 12px; border: 1px solid rgba(239,51,64,.35); border-radius: 14px; background: rgba(255,255,255,.03); }
.chat-image-preview[hidden] { display: none; }
.chat-image-preview-heading { margin-bottom: 10px; color: var(--text); font-size: 13px; font-weight: 700; }
.chat-image-preview-list { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.chat-preview-item { position: relative; display: flex; flex: 0 0 125px; flex-direction: column; gap: 6px; min-width: 0; }
.chat-preview-item img { width: 125px; height: 88px; object-fit: cover; border-radius: 9px; cursor: zoom-in; }
.chat-preview-name { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview-remove { align-self: flex-start; padding: 5px 9px; border: 1px solid var(--red); border-radius: 8px; background: transparent; color: var(--red-hover); font-size: 11px; cursor: pointer; }
.chat-preview-remove:hover { background: var(--red); color: white; }

/* CHAT IMAGE PREVIEW FIX */
.chat-compose { align-items: center; }
.chat-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 8px;
    min-height: 48px;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.chat-upload-label:hover { background: var(--red-hover); transform: translateY(-1px); }
.chat-upload-label input { display: none; }
.chat-upload-hint { margin: 4px 18px 12px; color: var(--muted); font-size: 12px; }
.chat-image-preview { margin: 0 18px 12px; padding: 12px; border: 1px solid rgba(239,51,64,.35); border-radius: 14px; background: rgba(255,255,255,.03); }
.chat-image-preview[hidden] { display: none; }
.chat-image-preview-heading { margin-bottom: 10px; color: var(--text); font-size: 13px; font-weight: 700; }
.chat-image-preview-list { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.chat-preview-item { position: relative; display: flex; flex: 0 0 125px; flex-direction: column; gap: 6px; min-width: 0; }
.chat-preview-item img { width: 125px; height: 88px; object-fit: cover; border-radius: 9px; cursor: zoom-in; }
.chat-preview-name { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview-remove { align-self: flex-start; padding: 5px 9px; border: 1px solid var(--red); border-radius: 8px; background: transparent; color: var(--red); font-size: 11px; cursor: pointer; }
.chat-preview-remove:hover { background: var(--red); color: white; }
.chat-image-button { cursor: zoom-in; }


/* GALERIA ZDJEC W CZACIE */
.chat-image-lightbox-close {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
    line-height: 1;
    border: 2px solid rgba(255,255,255,.75);
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    box-shadow: 0 3px 18px rgba(0,0,0,.45);
    z-index: 3;
}
.chat-image-lightbox-close:hover {
    background: var(--red-hover);
    transform: scale(1.06);
}
.chat-image-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 64px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 14px;
    background: rgba(30,30,30,.72);
    color: white;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
}
.chat-image-lightbox-nav:hover { background: var(--red); }
.chat-image-lightbox-prev { left: 22px; }
.chat-image-lightbox-next { right: 22px; }
.chat-image-lightbox-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    z-index: 2;
    transform: translateX(-50%);
    padding: 7px 13px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 999px;
    background: rgba(0,0,0,.65);
    color: white;
    font-size: 13px;
    font-weight: 700;
}
.chat-image-lightbox-nav[hidden] { display: none; }
@media (max-width: 600px) {
    .chat-image-lightbox-prev { left: 8px; }
    .chat-image-lightbox-next { right: 8px; }
    .chat-image-lightbox-nav { width: 40px; height: 52px; font-size: 34px; }
    .chat-image-lightbox img { max-width: 82vw; max-height: 82vh; }
}


/* CHAT SCROLL WINDOW */
.conversation-page {
    height: calc(100dvh - 130px);
    min-height: 420px;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    margin-bottom: 20px;
}

.conversation-topbar {
    flex-shrink: 0;
}

.chat-window {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-anchor: none;
    scrollbar-gutter: stable;
}

.chat-compose {
    flex-shrink: 0;
}

.chat-upload-hint,
.chat-image-preview {
    flex-shrink: 0;
}

@media (max-width: 750px) {
    .conversation-page {
        height: calc(100dvh - 110px);
        min-height: 360px;
        margin-top: 15px;
        margin-bottom: 15px;
    }

    .chat-messages {
        padding: 15px;
    }
}


/* CHAT MENU PANEL */
.conversation-page { position: relative; width: min(1600px, calc(100% - 32px)); margin: 12px auto 16px; }
.conversation-topbar { position: relative; display: flex; align-items: center; gap: 16px; min-height: 58px; margin-bottom: 12px; }
.chat-back-link { flex: 0 0 auto; color: var(--red); text-decoration: none; font-weight: 650; }
.chat-heading { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.chat-heading > div:last-child { min-width: 0; }
.chat-heading strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-heading small { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); }
.chat-heading-avatar { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex: 0 0 42px; overflow: hidden; border-radius: 50%; background: var(--surface); font-size: 22px; }
.chat-heading-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-menu-toggle { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; }
.chat-menu-toggle:hover { border-color: var(--red); }
.chat-side-panel { position: absolute; z-index: 20; top: 62px; right: 0; width: min(370px, calc(100vw - 32px)); max-height: min(70dvh, 620px); overflow-y: auto; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 18px 55px rgba(0,0,0,.28); }
.chat-side-panel[hidden], .chat-panel-section[hidden] { display: none !important; }
.chat-side-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chat-side-panel-head button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--text); font-size: 22px; cursor: pointer; }
.chat-panel-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.chat-panel-tabs button { padding: 10px 8px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; }
.chat-panel-tabs button.active { border-color: var(--red); background: rgba(239,51,64,.12); }
.chat-panel-person { display: flex; align-items: center; gap: 11px; padding: 10px 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.chat-panel-person:hover { background: var(--surface-hover); }
.chat-panel-avatar { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; overflow: hidden; border-radius: 50%; background: var(--surface-hover); }
.chat-panel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-panel-person-info { min-width: 0; }
.chat-panel-person-info strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.chat-panel-person-info small { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); }
.chat-panel-footer { padding-top: 12px; color: var(--muted); }
.chat-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.chat-media-tile { aspect-ratio: 1; min-width: 0; overflow: hidden; padding: 0; border: 0; border-radius: 9px; background: var(--surface-hover); cursor: zoom-in; }
.chat-media-tile img { width: 100%; height: 100%; object-fit: cover; }
.chat-media-empty { color: var(--muted); font-size: 13px; }
.conversation-page { height: calc(100dvh - 112px); min-height: 400px; }
.chat-window { min-height: 0; }
.chat-compose { gap: 9px; padding: 11px 14px; }
.chat-compose textarea { min-height: 42px; max-height: 110px; padding: 10px 12px; resize: vertical; }
.chat-compose button, .chat-upload-label { min-height: 42px; padding: 10px 15px; }
.chat-upload-hint { margin-top: 3px; margin-bottom: 7px; }
@media (max-width: 750px) {
.conversation-page { width: calc(100% - 18px); height: calc(100dvh - 100px); min-height: 340px; margin: 8px auto 10px; }
.conversation-topbar { gap: 9px; min-height: 50px; }
.chat-back-link { font-size: 12px; }
.chat-heading { gap: 7px; }
.chat-heading-avatar { width: 36px; height: 36px; flex-basis: 36px; }
.chat-menu-toggle { padding: 9px 10px; }
.chat-menu-toggle span { display: none; }
.chat-side-panel { top: 54px; }
.chat-compose { flex-wrap: wrap; padding: 9px; }
.chat-compose textarea { flex-basis: 100%; }
.chat-compose button, .chat-upload-label { flex: 1; justify-content: center; }
}


/* CHAT MENU CLOSE FIX */
#chat-menu-close { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; min-width: 34px; height: 34px; padding: 0; margin: 0; line-height: 1; text-align: center; }

/* CHAT CONVERSATION NICKNAME */
.chat-nickname-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.chat-nickname-section h3 { margin: 0 0 7px; font-size: 15px; }
.chat-nickname-section p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.chat-nickname-section form { display: flex; flex-direction: column; gap: 8px; }
.chat-nickname-section label { font-size: 12px; color: var(--muted); }
.chat-nickname-section input { box-sizing: border-box; width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--background); color: var(--text); }
.chat-nickname-section button { padding: 10px 12px; border: 0; border-radius: 9px; background: var(--red); color: white; font-weight: 700; cursor: pointer; }
.chat-nickname-section > small { display: block; margin-top: 8px; color: var(--muted); }
/* CHAT MESSAGE SENDER DETAILS */
.chat-message { align-items: flex-end; gap: 9px; margin: 4px 0 10px; }
.chat-message-own { flex-direction: row-reverse; }
.chat-message-avatar { position: relative; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; overflow: visible; background: var(--surface-hover); }
.chat-message-avatar img { width: 32px; height: 32px; object-fit: cover; border-radius: 50%; }
.chat-message-avatar > span { display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; }
.chat-message-avatar i { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: #888; }
.chat-message-avatar i.online { background: #22c55e; }
.chat-message-content { display: flex; flex-direction: column; min-width: 0; max-width: min(75%, 550px); }
.chat-message-own .chat-message-content { align-items: flex-end; }
.chat-message-author { margin: 0 8px 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.chat-message-content .chat-message-bubble { box-sizing: border-box; width: fit-content; max-width: 100%; }
@media (max-width: 600px) { .chat-message-content { max-width: 88%; } }

/* Odpowiedzi i reakcje w czacie */
.chat-message-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin-top:5px; }
.chat-reply-button, .chat-reaction, .chat-reaction-add { border:1px solid var(--border-color, rgba(255,255,255,.14)); border-radius:14px; padding:4px 9px; background:rgba(255,255,255,.06); color:inherit; font:inherit; font-size:12px; cursor:pointer; }
.chat-reply-button:hover, .chat-reaction:hover, .chat-reaction-add:hover { background:rgba(255,255,255,.14); }
.chat-reactions { display:flex; flex-wrap:wrap; align-items:center; gap:4px; }
.chat-reaction.mine { border-color:var(--accent-color, #a78bfa); background:rgba(167,139,250,.18); }
.chat-reply-quote { display:flex; flex-direction:column; gap:3px; margin:4px 0 6px; padding:7px 10px; border-left:3px solid var(--accent-color, #a78bfa); border-radius:6px; background:rgba(255,255,255,.06); color:inherit; text-decoration:none; font-size:12px; }
.chat-reply-quote span:first-child { font-weight:700; }
.chat-reply-quote span:last-child { opacity:.8; overflow-wrap:anywhere; }
.chat-reply-preview { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 8px; padding:9px 12px; border-left:3px solid var(--accent-color, #a78bfa); border-radius:8px; background:rgba(255,255,255,.07); }
.chat-reply-preview[hidden] { display:none; }
.chat-reply-preview div { display:flex; flex-direction:column; gap:3px; min-width:0; overflow-wrap:anywhere; }
.chat-reply-preview strong { font-size:12px; }
.chat-reply-preview span { font-size:13px; opacity:.8; }
#chat-reply-cancel { border:0; background:transparent; color:inherit; font-size:22px; cursor:pointer; }
.chat-message-highlight .chat-message-bubble { outline:2px solid var(--accent-color, #a78bfa); outline-offset:3px; }

/* Dopasowanie paska reakcji do szerokosci wiadomosci */
.chat-message-actions { box-sizing:border-box; width:100%; max-width:100%; align-self:stretch; justify-content:flex-start; gap:5px; margin-top:4px; }
.chat-message-own .chat-message-actions { justify-content:flex-end; }
.chat-reactions { min-width:0; gap:3px; }
.chat-reply-button, .chat-reaction, .chat-reaction-add { padding:3px 7px; font-size:11px; }
.chat-reaction-add[hidden] { display:none !important; }

/* Korekta wyrównania własnych wiadomości */
.chat-message-own { justify-content: flex-start; }


/* Oznaczanie uczestnikow w wiadomosciach */
.chat-compose { position: relative; }
.chat-mention-suggestions {
    position: absolute;
    z-index: 40;
    left: 14px;
    bottom: calc(100% + 6px);
    display: flex;
    flex-direction: column;
    width: min(280px, calc(100% - 28px));
    max-height: 230px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 35px rgba(0,0,0,.25);
}
.chat-mention-suggestions[hidden] { display: none !important; }
.chat-mention-option {
    padding: 9px 11px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.chat-mention-option:hover { background: var(--surface-hover); }
.chat-mention {
    color: #9be7ff;
    font-weight: 750;
    text-decoration: none;
    background: rgba(30,144,255,.18);
    border-radius: 4px;
    padding: 0 3px;
    text-shadow: 0 0 8px rgba(80,190,255,.25);
}
.chat-mention:hover { text-decoration: underline; }

/* Przypiete wiadomosci */
.chat-panel-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chat-pinned-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    margin: 0 0 7px;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-hover);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.chat-pinned-item:hover { border-color: var(--red); }
.chat-pinned-item strong { font-size: 12px; }
.chat-pinned-item span { font-size: 13px; overflow-wrap: anywhere; }
.chat-pinned-item small { color: var(--muted); font-size: 10px; }
.chat-pin-button {
    border: 1px solid var(--border-color, rgba(255,255,255,.14));
    border-radius: 14px;
    padding: 3px 7px;
    background: rgba(255,255,255,.06);
    color: inherit;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}
.chat-pin-button:hover { background: rgba(255,255,255,.14); }
.chat-pin-button:disabled { opacity: .5; cursor: wait; }
.chat-message.is-pinned .chat-message-bubble {
    box-shadow: 0 0 0 1px rgba(239,51,64,.35);
}
