/* ============================================================
   Communities — Vadibe
   ============================================================ */

/* ── Variables ── */
:root {
    --comm-primary:     #6c5ce7;
    --comm-primary-dark:#5a4bd1;
    --comm-secondary:   #fd79a8;
    --comm-surface:     #ffffff;
    --comm-bg:          #f0f2f5;
    --comm-text:        #1c1e21;
    --comm-muted:       #65676b;
    --comm-border:      #dddfe2;
    --comm-radius:      12px;
    --comm-radius-lg:   20px;
    --comm-shadow:      0 2px 12px rgba(0,0,0,.08);
    --comm-shadow-hover:0 8px 30px rgba(108,92,231,.18);
}

/* ── Page layout ── */
.comm-page { background: var(--comm-bg); min-height: 100vh; }

/* ── Hero banner ── */
.comm-hero {
    background: linear-gradient(135deg, var(--comm-primary) 0%, #a29bfe 50%, var(--comm-secondary) 100%);
    padding: 60px 20px 48px;
    text-align: center;
    color: #fff;
}
.comm-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; margin: 0 0 12px; }
.comm-hero p  { font-size: 1.1rem; opacity: .88; margin: 0 0 28px; }
.comm-hero-search {
    max-width: 500px; margin: 0 auto;
    display: flex; gap: 8px;
}
.comm-hero-search input {
    flex: 1;
    padding: 12px 18px;
    border: none; border-radius: 50px;
    font-size: 1rem; outline: none;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.comm-hero-search button {
    padding: 12px 22px;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.4);
    color: #fff; border-radius: 50px;
    font-weight: 600; cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background .2s;
}
.comm-hero-search button:hover { background: rgba(255,255,255,.35); }

/* ── Stats bar ── */
.comm-stats-bar {
    display: flex; justify-content: center; gap: 40px;
    padding: 18px 20px 0;
    flex-wrap: wrap;
}
.comm-stat { text-align: center; color: rgba(255,255,255,.9); }
.comm-stat-num { font-size: 1.6rem; font-weight: 800; display: block; }
.comm-stat-lbl { font-size: .78rem; opacity: .75; }

/* ── Filter tabs ── */
.comm-filters {
    display: flex; gap: 8px; padding: 20px 0 4px;
    flex-wrap: wrap;
}
.comm-filter-btn {
    padding: 7px 18px; border-radius: 50px;
    border: 1px solid var(--comm-border);
    background: #fff; color: var(--comm-muted);
    font-size: .9rem; cursor: pointer;
    transition: all .18s;
    text-decoration: none; display: inline-block;
}
.comm-filter-btn:hover,
.comm-filter-btn.active {
    background: var(--comm-primary); border-color: var(--comm-primary);
    color: #fff;
}

/* ── Section title ── */
.comm-section-title {
    font-size: 1.25rem; font-weight: 700;
    color: var(--comm-text); margin: 0 0 16px;
    display: flex; align-items: center; gap: 8px;
}
.comm-section-title::after {
    content: ''; flex: 1; height: 1px; background: var(--comm-border);
}

/* ── Community card ── */
.comm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.comm-card {
    background: var(--comm-surface);
    border-radius: var(--comm-radius-lg);
    overflow: hidden;
    box-shadow: var(--comm-shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex; flex-direction: column;
    text-decoration: none; color: inherit;
}
.comm-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--comm-shadow-hover);
}
.comm-card-cover {
    height: 110px; position: relative;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    overflow: hidden;
}
.comm-card-cover img {
    width: 100%; height: 100%; object-fit: cover;
}
.comm-card-cover-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.35));
}
.comm-card-icon {
    position: absolute; bottom: -22px; left: 18px;
    width: 48px; height: 48px; border-radius: 14px;
    border: 3px solid #fff;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.comm-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.comm-card-badge {
    position: absolute; top: 10px; right: 10px;
    background: rgba(255,255,255,.92);
    border-radius: 50px; padding: 3px 10px;
    font-size: .72rem; font-weight: 700; color: var(--comm-primary);
}
.comm-card-body {
    padding: 30px 18px 16px;
    flex: 1; display: flex; flex-direction: column;
}
.comm-card-name {
    font-size: 1rem; font-weight: 700;
    color: var(--comm-text); margin: 0 0 6px;
}
.comm-card-desc {
    font-size: .85rem; color: var(--comm-muted);
    line-height: 1.45; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.comm-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--comm-border);
    font-size: .82rem; color: var(--comm-muted);
}
.comm-card-members { display: flex; align-items: center; gap: 5px; }
.comm-btn-join {
    padding: 6px 16px; border-radius: 50px;
    border: none; cursor: pointer; font-size: .82rem; font-weight: 600;
    transition: all .18s;
}
.comm-btn-join.join {
    background: var(--comm-primary); color: #fff;
}
.comm-btn-join.join:hover { background: var(--comm-primary-dark); }
.comm-btn-join.joined {
    background: #e8e4ff; color: var(--comm-primary);
}
.comm-btn-join.joined:hover { background: #fee2e2; color: #e53e3e; }

/* ── Community detail ── */
.comm-detail-cover {
    height: 240px; position: relative;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    overflow: hidden;
}
.comm-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.comm-detail-cover-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.55));
}
.comm-detail-header {
    background: var(--comm-surface);
    border-bottom: 1px solid var(--comm-border);
    padding: 0 0 16px;
}
.comm-detail-info-bar {
    display: flex; align-items: flex-end; gap: 16px;
    padding: 0 20px; margin-top: -36px; flex-wrap: wrap;
}
.comm-detail-icon {
    width: 80px; height: 80px; border-radius: 20px;
    border: 4px solid #fff;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    flex-shrink: 0;
}
.comm-detail-icon img { width: 100%; height: 100%; object-fit: cover; }
.comm-detail-meta { flex: 1; padding-top: 40px; }
.comm-detail-meta h1 {
    font-size: 1.6rem; font-weight: 800; color: var(--comm-text); margin: 0 0 4px;
}
.comm-detail-meta .meta-row {
    display: flex; gap: 16px; flex-wrap: wrap;
    font-size: .85rem; color: var(--comm-muted); align-items: center;
}
.comm-detail-actions { padding-top: 40px; flex-shrink: 0; }
.comm-btn-lg {
    padding: 10px 26px; border-radius: 50px;
    font-size: 1rem; font-weight: 700; cursor: pointer; border: none;
    transition: all .18s;
}
.comm-btn-lg.join    { background: var(--comm-primary); color: #fff; }
.comm-btn-lg.join:hover { background: var(--comm-primary-dark); }
.comm-btn-lg.joined  { background: #e8e4ff; color: var(--comm-primary); }
.comm-btn-lg.joined:hover { background: #fee2e2; color: #e53e3e; }

/* ── Post composer ── */
.comm-composer {
    background: var(--comm-surface);
    border-radius: var(--comm-radius); padding: 16px;
    box-shadow: var(--comm-shadow); margin-bottom: 16px;
}
.comm-composer-top {
    display: flex; gap: 10px; align-items: flex-start;
}
.comm-composer-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    flex-shrink: 0; overflow: hidden; display: flex;
    align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 1rem;
}
.comm-composer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comm-composer textarea {
    flex: 1; border: 1px solid var(--comm-border); border-radius: 20px;
    padding: 10px 16px; resize: none; font-size: .95rem; outline: none;
    font-family: inherit; line-height: 1.45; min-height: 46px;
    transition: border-color .2s;
}
.comm-composer textarea:focus { border-color: var(--comm-primary); }
.comm-composer-actions {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--comm-border);
    flex-wrap: wrap; gap: 8px;
}
.comm-composer-tools { display: flex; gap: 6px; }
.comm-composer-tool {
    padding: 6px 12px; border-radius: 8px; border: none;
    background: #f0f2f5; cursor: pointer; font-size: .85rem; color: var(--comm-muted);
    display: flex; align-items: center; gap: 5px; transition: background .15s;
}
.comm-composer-tool:hover { background: var(--comm-border); }
.comm-btn-submit {
    padding: 8px 22px; border-radius: 50px; border: none;
    background: var(--comm-primary); color: #fff; font-weight: 600;
    cursor: pointer; font-size: .9rem; transition: background .18s;
}
.comm-btn-submit:hover   { background: var(--comm-primary-dark); }
.comm-btn-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ── Post image preview ── */
.comm-img-preview {
    margin-top: 10px; position: relative; display: none;
}
.comm-img-preview img {
    max-height: 200px; border-radius: 10px;
    border: 1px solid var(--comm-border);
}
.comm-img-preview-remove {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px; background: rgba(0,0,0,.5);
    border-radius: 50%; color: #fff; border: none; cursor: pointer;
    font-size: 14px; line-height: 1; display: flex;
    align-items: center; justify-content: center;
}

/* ── Feed post ── */
.comm-post {
    background: var(--comm-surface); border-radius: var(--comm-radius);
    box-shadow: var(--comm-shadow); margin-bottom: 16px; overflow: hidden;
}
.comm-post-header {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px 0;
}
.comm-post-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    flex-shrink: 0; overflow: hidden; display: flex;
    align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 1rem;
}
.comm-post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comm-post-meta { flex: 1; }
.comm-post-author {
    font-weight: 700; color: var(--comm-text); font-size: .95rem;
    text-decoration: none;
}
.comm-post-author:hover { text-decoration: underline; }
.comm-post-time { font-size: .78rem; color: var(--comm-muted); }
.comm-post-menu {
    background: none; border: none; color: var(--comm-muted);
    cursor: pointer; font-size: 1.2rem; padding: 4px 8px; border-radius: 6px;
    transition: background .15s;
}
.comm-post-menu:hover { background: var(--comm-bg); }
.comm-post-content { padding: 12px 16px; font-size: .95rem; line-height: 1.55; color: var(--comm-text); }
.comm-post-image { width: 100%; max-height: 400px; object-fit: cover; display: block; }
.comm-post-actions {
    display: flex; gap: 4px; padding: 8px 12px;
    border-top: 1px solid var(--comm-border);
}
.comm-post-action {
    flex: 1; padding: 8px; border: none; background: none;
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: .88rem; color: var(--comm-muted); font-weight: 600;
    transition: background .15s, color .15s;
}
.comm-post-action:hover { background: var(--comm-bg); color: var(--comm-text); }
.comm-post-action.liked { color: var(--comm-primary); }
.comm-post-action.liked:hover { background: #eee8ff; }

/* ── Comments ── */
.comm-comments { padding: 0 16px 14px; }
.comm-comment {
    display: flex; gap: 8px; margin-top: 10px;
}
.comm-comment-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    flex-shrink: 0; overflow: hidden; display: flex;
    align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .8rem;
}
.comm-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comm-comment-bubble {
    background: var(--comm-bg); border-radius: 14px; padding: 8px 12px;
    flex: 1;
}
.comm-comment-author { font-weight: 700; font-size: .82rem; color: var(--comm-text); }
.comm-comment-text   { font-size: .88rem; color: var(--comm-text); margin-top: 2px; }
.comm-comment-time   { font-size: .72rem; color: var(--comm-muted); margin-top: 4px; }
.comm-comment-form {
    display: flex; gap: 8px; margin-top: 10px; align-items: center;
}
.comm-comment-input {
    flex: 1; border: 1px solid var(--comm-border); border-radius: 50px;
    padding: 8px 14px; font-size: .88rem; outline: none; font-family: inherit;
    transition: border-color .2s;
}
.comm-comment-input:focus { border-color: var(--comm-primary); }
.comm-comment-send {
    width: 34px; height: 34px; border-radius: 50%; border: none;
    background: var(--comm-primary); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: background .18s;
}
.comm-comment-send:hover { background: var(--comm-primary-dark); }

/* ── Sidebar widgets ── */
.comm-widget {
    background: var(--comm-surface); border-radius: var(--comm-radius);
    box-shadow: var(--comm-shadow); padding: 18px; margin-bottom: 16px;
}
.comm-widget-title {
    font-size: .95rem; font-weight: 700; color: var(--comm-text);
    margin: 0 0 14px;
}
.comm-widget-member {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.comm-widget-member-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    overflow: hidden; display: flex; align-items: center;
    justify-content: center; color: #fff; font-weight: 700; font-size: .8rem;
    flex-shrink: 0;
}
.comm-widget-member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comm-widget-member-name { font-size: .88rem; font-weight: 600; color: var(--comm-text); }
.comm-widget-member-date { font-size: .75rem; color: var(--comm-muted); }

/* ── My communities (profile section) ── */
.comm-my-list { list-style: none; padding: 0; margin: 0; }
.comm-my-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--comm-border);
    text-decoration: none; color: inherit;
}
.comm-my-item:last-child { border-bottom: none; }
.comm-my-item:hover .comm-my-name { color: var(--comm-primary); }
.comm-my-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--comm-primary), #a29bfe);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; overflow: hidden; flex-shrink: 0;
}
.comm-my-icon img { width: 100%; height: 100%; object-fit: cover; }
.comm-my-name  { font-weight: 600; font-size: .92rem; color: var(--comm-text); }
.comm-my-count { font-size: .78rem; color: var(--comm-muted); }

/* ── Empty state ── */
.comm-empty {
    text-align: center; padding: 60px 20px;
    color: var(--comm-muted);
}
.comm-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.comm-empty h3   { font-size: 1.1rem; font-weight: 700; color: var(--comm-text); margin: 0 0 8px; }
.comm-empty p    { font-size: .9rem; }

/* ── Homepage popular communities strip ── */
.home-comm-strip { padding: 32px 0; }
.home-comm-strip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.home-comm-mini {
    background: #fff; border-radius: 14px;
    overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.07);
    text-decoration: none; color: inherit;
    transition: transform .2s, box-shadow .2s;
    display: block;
}
.home-comm-mini:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(108,92,231,.15); }
.home-comm-mini-cover {
    height: 70px; background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    overflow: hidden; position: relative;
}
.home-comm-mini-cover img { width: 100%; height: 100%; object-fit: cover; }
.home-comm-mini-icon {
    position: absolute; bottom: -16px; left: 12px;
    width: 36px; height: 36px; border-radius: 10px;
    border: 2px solid #fff; background: #6c5ce7;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; overflow: hidden;
}
.home-comm-mini-icon img { width: 100%; height: 100%; object-fit: cover; }
.home-comm-mini-body { padding: 22px 12px 12px; }
.home-comm-mini-name { font-size: .88rem; font-weight: 700; margin: 0 0 4px; }
.home-comm-mini-count { font-size: .75rem; color: #65676b; }

/* ── Toast notification ── */
.comm-toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #1c1e21; color: #fff;
    padding: 12px 20px; border-radius: 10px;
    font-size: .9rem; z-index: 9999; opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}
.comm-toast.show { opacity: 1; transform: translateY(0); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .comm-hero { padding: 36px 16px 32px; }
    .comm-detail-cover { height: 160px; }
    .comm-detail-icon  { width: 60px; height: 60px; }
    .comm-detail-meta h1 { font-size: 1.3rem; }
    .comm-grid { grid-template-columns: 1fr; }
    .home-comm-strip-grid { grid-template-columns: repeat(2, 1fr); }
    .comm-stats-bar { gap: 20px; }
}
@media (max-width: 480px) {
    .home-comm-strip-grid { grid-template-columns: 1fr 1fr; }
}
