/* ==========================================================
   1. ROOT VARIABLES
========================================================== */

:root {
    --brand: var(--theme-primary);
    --brand-l: rgba(var(--theme-primary-rgb), .08);
    --bg: var(--theme-light-gray);
    --border: rgba(var(--theme-gray-rgb), .20);
    --muted: var(--theme-gray);
    --danger: var(--theme-saffron);
    --success: var(--theme-green);
    --gold: var(--theme-gold);
}

/* ==========================================================
   2. GLOBAL / UTILITY STYLES
========================================================== */

.brand-text {
    color: var(--brand);
}

.brand-bg {
    background: linear-gradient(135deg, var(--brand), #00A3E0);
}

.avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--brand), var(--theme-accent-blue));
    color: #ffffff;
}

.line-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.filter.active {
    color: #fff !important;
    background: var(--brand) !important;
    border-color: var(--brand) !important;
}

.item.hide {
    display: none;
}

/* Status Badges */

.status-published {
    color: var(--theme-green);
    background: rgba(19, 136, 8, 0.12);
}

.status-draft {
    color: #8a5a00;
    background: rgba(245, 158, 11, 0.2);
}

.status-trending {
    color: var(--theme-saffron);
    background: rgba(165, 42, 42, 0.12);
}

/* ==========================================================
   3. POST BUILDER
========================================================== */

.post-builder-page {
    min-height: calc(100vh - 80px);
    background: radial-gradient(circle at top center, rgba(37, 99, 235, 0.08), transparent 22%), linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
}

.post-builder-page__title {
    font-size: 1rem;
    font-weight: 800;
    color: #17203a;
}

.post-builder-page__subtitle {
    color: #5f6c87;
    font-size: 1rem;
}

.post-builder__publish-btn {
    min-height: 50px;
    padding-inline: 22px;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

.post-builder-card {
    border: 1px solid #dbe3f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.post-builder-card--side {
    position: sticky;
    top: 24px;
}

.post-builder-card__tabs {
    display: flex;
    gap: 12px;
    padding: 20px 20px 8px;
    border-bottom: 1px solid #e8edf5;
}

.post-builder-tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    border: 1px solid #dbe3f0;
    border-radius: 12px;
    background: #fff;
    color: #1d2438;
    font-size: 1.05rem;
    font-weight: 700;
}

.post-builder-tab i {
    font-size: 1.25rem;
}

.post-builder-tab.is-active {
    color: #2563eb;
    box-shadow: inset 0 -2px 0 #2563eb;
}

.post-builder-card__body {
    padding: 22px 22px 24px;
}

.post-builder-section-title,
.post-builder-label {
    color: #111827;
    font-weight: 800;
}

.post-builder-count {
    color: #596780;
    font-weight: 700;
}

.post-builder-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    border-radius: 10px;
    background: #fff1f2;
    color: #b91c1c;
    font-weight: 700;
}

.post-builder-gallery {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.post-builder-gallery__item {
    position: relative;
    flex: 0 0 158px;
    height: 150px;
    border: 2px solid transparent;
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
    cursor: grab;
}

.post-builder-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-builder-gallery__item.is-cover {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.18);
}

.post-builder-gallery__cover,
.post-builder-gallery__remove {
    position: absolute;
    top: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.post-builder-gallery__cover {
    left: 8px;
    background: rgba(255, 255, 255, 0.88);
    color: #475569;
}

.post-builder-gallery__item.is-cover .post-builder-gallery__cover {
    background: #fbbf24;
    color: #ffffff;
}

.post-builder-gallery__remove {
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
}

.post-builder-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-height: 120px;
    border: 2px dashed #cfd8e6;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: 0.2s ease;
}

.post-builder-upload.is-dragging,
.post-builder-upload:hover {
    border-color: #94b8ff;
    background: #f8fbff;
}

.post-builder-upload__icon {
    font-size: 2.2rem;
    color: #7a8ca9;
}

.post-builder-upload__title {
    color: #334155;
    font-size: 1.05rem;
    font-weight: 700;
}

.post-builder-upload__meta {
    color: #7c8799;
    font-size: 0.98rem;
}

.post-builder-input {
    min-height: 48px;
    border: 1px solid #d7dfec;
    border-radius: 12px;
    background: #fff;
    color: #111827;
}

.post-builder-input:focus {
    border-color: #9ab8ff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.post-builder-input-icon {
    position: relative;
}

.post-builder-input--icon {
    padding-right: 44px;
}

.post-builder-input-icon i {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #334155;
}

.post-builder-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.post-builder-editor {
    border-radius: 12px;
    overflow: hidden;
}

.post-builder-editor__footer {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 10px 14px;
    color: #4b5563;
    font-weight: 500;
    background: var(--theme-card-bg);
}

.post-builder-tags__heading {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.post-builder-tags__list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.post-builder-tag-chip {
    padding: 8px 14px;
    border: 0;
    border-radius: 10px;
    background: #e9f1ff;
    color: #2563eb;
    font-weight: 700;
}

.post-builder__alert {
    border-radius: 14px;
}

.post-builder-video-box {
    border: 1px dashed #d7dfec;
    border-radius: 14px;
    padding: 18px;
    background: #fbfdff;
}

/* ==========================================================
   4. POST LIST & CARDS
========================================================== */

.post-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.12) !important;
}

.collage {
    display: grid;
    gap: 3px;
}

.c2 {
    grid-template-columns: repeat(2, 1fr);
}

.c3 {
    grid-template: 1fr 1fr / 1.35fr 1fr;
}

.c3>div:first-child {
    grid-row: 1 / 3;
}

.c4 {
    grid-template: repeat(2, 1fr) / repeat(2, 1fr);
}

.tile {
    position: relative;
    overflow: hidden;
}

.tile img {
    transition: transform 0.4s ease;
}

.post-card:hover .tile img {
    transform: scale(1.04);
}

.more {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(11, 18, 32, 0.7);
    color: #ffffff;
    font-size: 1.7rem;
    font-weight: 800;
}

.provider {
    position: absolute;
    z-index: 2;
    top: 0.75rem;
    left: 0.75rem;
}

/* ==========================================================
   5. POST DETAIL
========================================================== */

.media {
    aspect-ratio: 1 / 1;
    width: 100%;
    background: #111827;
    overflow: hidden;
}

.media img,
.media iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
}

/* ==========================================================
   6. DARK MODE
========================================================== */

[data-theme="dark"] .post-builder-page {
    background: radial-gradient(circle at top center, rgba(59, 130, 246, 0.18), transparent 26%), linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

[data-theme="dark"] .post-builder-page__title,
[data-theme="dark"] .post-builder-section-title,
[data-theme="dark"] .post-builder-label,
[data-theme="dark"] .post-builder-tags__heading {
    color: #f8fafc;
}

[data-theme="dark"] .post-builder-page__subtitle,
[data-theme="dark"] .post-builder-count,
[data-theme="dark"] .post-builder-editor__footer,
[data-theme="dark"] .post-builder-upload__meta {
    color: #cbd5e1;
}

[data-theme="dark"] .post-builder-card,
[data-theme="dark"] .post-builder-editor,
[data-theme="dark"] .post-builder-video-box {
    background: #111827;
    border-color: #334155;
}

[data-theme="dark"] .post-builder-card__tabs,
[data-theme="dark"] .post-builder-editor__footer {
    border-color: #334155;
}

[data-theme="dark"] .post-builder-tab,
[data-theme="dark"] .post-builder-input,
[data-theme="dark"] .post-builder-upload,
[data-theme="dark"] .hashtag-input {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .post-builder-tab.is-active {
    color: #60a5fa;
    box-shadow: inset 0 -2px 0 #60a5fa;
}

/* ==========================================================
   7. RESPONSIVE MEDIA QUERIES
========================================================== */

@media (max-width: 991.98px) {
    .post-builder-card--side {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .post-builder-card__tabs {
        flex-wrap: wrap;
    }
    .post-builder-gallery__item {
        flex-basis: 138px;
        height: 132px;
    }
    .post-builder-upload {
        flex-direction: column;
        padding: 16px;
        text-align: center;
    }
}