:root {
    --bg-main: #f3f6fb;
    --bg-soft: #ffffff;
    --text-main: #0f172a;
    --text-soft: #64748b;
    --brand: #0ea5e9;
    --brand-deep: #0284c7;
    --line: #dbe3ef;
}

body {
    background:
        radial-gradient(900px 450px at 0% -10%, rgba(14, 165, 233, .10), transparent 60%),
        radial-gradient(700px 360px at 100% 0%, rgba(16, 185, 129, .08), transparent 60%),
        var(--bg-main);
    color: var(--text-main);
}

.navbar.bg-dark {
    background: linear-gradient(120deg, #0f172a, #1e293b) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
}

.navbar .nav-link,
.navbar .navbar-brand {
    transition: opacity .2s ease, transform .2s ease;
}

.navbar .nav-link:hover,
.navbar .navbar-brand:hover {
    opacity: .92;
    transform: translateY(-1px);
}

.card {
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
    animation: fadeUp .35s ease;
}

textarea {
    resize: none;
}

.like-btn {
    cursor: pointer;
    transition: color .2s ease;
}

.like-btn.liked {
    color: #e0245e; /* twitter red */
}

/* ===== AUTH ===== */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1da1f2, #0d6efd);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(0,0,0,.15);
}

.auth-card h3 {
    font-weight: 700;
}

.auth-page-center {
    min-height: calc(100vh - 210px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-maintenance-notice {
    border-radius: 12px;
    border: 1px solid #facc15;
}

.maintenance-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.maintenance-card {
    width: 100%;
    max-width: 760px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 26px 24px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.maintenance-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fef9c3;
    color: #854d0e;
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 12px;
}

.maintenance-title {
    margin: 0 0 10px;
    font-size: 34px;
    font-weight: 800;
}

.maintenance-text {
    color: #334155;
    white-space: pre-line;
}

.maintenance-time {
    color: #64748b;
}

.site-cover-banner {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #dde5ef;
    background: #fff;
}

.site-cover-banner img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

/* ===== PROFILE ===== */
.profile-avatar {
    width: 130px;
    height: 130px;
    object-fit: cover;
    border: 3px solid rgba(15, 23, 42, 0.35);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.profile-card {
    border-radius: 18px;
}

.profile-cover-banner {
    border-bottom: 1px solid #e2e8f0;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
}

.profile-cover-banner img {
    width: 100%;
    height: clamp(160px, 24vw, 280px);
    object-fit: cover;
    display: block;
}

.profile-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.profile-tab-btn {
    border-radius: 999px;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease;
}

.profile-tab-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 14px rgba(2, 132, 199, .16);
}

.profile-tab-btn.active {
    background: linear-gradient(120deg, var(--brand), var(--brand-deep));
    color: #fff !important;
    border-color: transparent;
}

.profile-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.profile-media-item {
    position: relative;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dbe3ec;
    background: #0f172a;
    aspect-ratio: 1 / 1;
    text-decoration: none;
}

.profile-media-item img,
.profile-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-media-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.06));
}

.profile-achievements-placeholder {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    background: #fff;
    color: #475569;
}

.profile-achievements-placeholder i {
    font-size: 32px;
    color: #eab308;
}

.profile-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.profile-achievement-card {
    display: block;
    width: 100%;
    padding: 0;
    text-align: left;
    cursor: pointer;
    border: 1px solid #dbe3ec;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: transform .18s ease, box-shadow .18s ease;
}

.profile-achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 22px rgba(15, 23, 42, .14);
}

.profile-achievement-cover {
    position: relative;
    height: 120px;
    background: #0f172a;
}

.profile-achievement-cover > img:first-child {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-achievement-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    border-radius: 12px;
    border: 2px solid #fff;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.profile-achievement-body {
    padding: 10px 12px;
}

.profile-achievement-title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
}

.profile-achievement-meta {
    color: #64748b;
    font-size: 12px;
    margin-top: 4px;
}

.achievement-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    padding: 16px;
}

.achievement-modal-window {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    animation: popIn .22s ease;
}

.achievement-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, background-color .15s ease;
}

.achievement-modal-close:hover {
    background: rgba(15, 23, 42, 0.82);
    transform: scale(1.04);
}

.achievement-modal-cover-wrap {
    position: relative;
    height: 200px;
    background: #0f172a;
}

.achievement-modal-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.achievement-modal-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 16px;
    border: 2px solid #fff;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.achievement-modal-body {
    padding: 16px 18px 18px;
}

.achievement-modal-meta {
    color: #64748b;
    font-size: 13px;
}

/* ===== Quill content rendering ===== */
.post-content p {
    margin-bottom: 0.6rem;
    line-height: 1.6;
}

.post-content h2,
.post-content h3 {
    margin-top: 0.8rem;
    font-weight: 600;
}

.post-content blockquote {
    border-left: 4px solid #1da1f2;
    padding-left: 12px;
    color: #555;
    margin: 0.6rem 0;
}

.post-content pre {
    background: #f6f8fa;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    overflow-x: auto;
}

.youtube-embed-wrap {
    position: relative;
    width: 100%;
    max-width: 760px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
}

.youtube-embed-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.post-media-media {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    background: #0b0b0b;
}

.post-video-media {
    background: #000;
}

.post-image-media {
    width: auto;
    max-width: 45%;
    max-height: 340px;
    object-fit: contain;
    background: transparent;
}

.post-item {
    animation: fadeUp .28s ease;
}

.post-meta-row {
    min-height: 24px;
}

.post-meta-date {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    white-space: nowrap;
}

.quick-post-disabled {
    background: #f3f4f6;
    border-radius: 12px;
}

.quick-post-disabled #editorjs {
    background: #eef1f4;
    border-color: #d7dde4;
    opacity: 0.8;
    pointer-events: none;
}

/* ===== Editor.js styling ===== */
#editorjs {
    border: 1px solid #ddd;
    border-radius: 16px;
    padding: 14px;
    min-height: 120px;
    background: #fff;
    overflow: hidden;
}

.ce-toolbar__content {
    max-width: calc(100% - 56px);
    margin-left: 28px;
    margin-right: 16px;
}

.ce-block__content {
    max-width: calc(100% - 56px);
    margin-left: 28px;
    margin-right: 16px;
}


#editorjs .ce-block__content {
    max-width: calc(100% - 56px);
}

#editorjs .ce-paragraph {
    font-size: 15px;
    line-height: 1.6;
}

/* Курсор */
#editorjs .ce-paragraph:focus {
    outline: none;
}

/* delete post icon */
.delete-post {
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s ease;
}

.delete-post:hover {
    color: #dc3545; /* bootstrap danger */
}

.share-post {
    cursor: pointer;
}

.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.share-modal-window {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    padding: 18px;
    animation: popIn .2s ease;
}

.share-modal-title {
    margin: 0 0 12px;
}

.share-modal-input {
    width: 100%;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

.share-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.system-notices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.system-notice {
    position: relative;
    border: 1px solid #e5e7eb;
    border-left-width: 6px;
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px 12px 38px;
    line-height: 1.45;
    animation: fadeUp .32s ease;
}

.system-notice::before {
    position: absolute;
    left: 12px;
    top: 12px;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.system-notice--green {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.system-notice--green::before {
    content: "\f058";
    color: #16a34a;
}

.system-notice--yellow {
    border-left-color: #ca8a04;
    background: #fefce8;
}

.system-notice--yellow::before {
    content: "\f071";
    color: #ca8a04;
}

.system-notice--red {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.system-notice--red::before {
    content: "\f057";
    color: #dc2626;
}

.account-settings-page {
    max-width: 980px;
    margin: 0 auto;
}

.account-settings-head h3 {
    font-weight: 700;
}

.account-settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    padding: 18px;
}

.account-settings-head p {
    max-width: 620px;
}

.account-settings-card h5 {
    font-weight: 700;
}

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(14, 165, 233, .08), rgba(2, 132, 199, .04));
}

.settings-cover-preview {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(14, 165, 233, .08), rgba(2, 132, 199, .04));
    overflow: hidden;
}

.settings-cover-image {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

.settings-cover-placeholder {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
    text-align: center;
    padding: 16px;
}

#cover-croppie-container {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 10px;
    background: #f8fafc;
}

#cover-croppie-container .cr-boundary {
    margin: 0 auto;
}

#profile-form .form-label {
    color: #334155;
    font-weight: 600;
}

#profile-msg.text-success,
#profile-msg.text-danger {
    font-weight: 600;
}

.account-settings-card .table thead th {
    white-space: nowrap;
}

.account-settings-card .table tbody tr td {
    vertical-align: middle;
}

.btn {
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(.97);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    h1 {
        font-size: 1.9rem;
    }

    .navbar .navbar-nav {
        padding-top: 8px;
        gap: 4px;
    }

    .quick-post-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px;
    }

    .quick-post-actions .form-control {
        width: 100% !important;
    }

    #editorjs {
        padding: 10px;
    }

    .ce-toolbar__content,
    .ce-block__content,
    #editorjs .ce-block__content {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .post-item .card-body {
        padding: 12px;
    }

    .post-item .post-meta-row {
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .post-item .post-meta-date {
        width: 100%;
        margin-left: 0 !important;
        text-align: right;
        justify-content: flex-end;
    }

    .post-media-media {
        max-height: 240px;
    }

    .post-image-media {
        max-width: 75%;
        max-height: 240px;
    }

    .profile-media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .profile-cover-banner img {
        height: 150px;
    }

    .account-settings-card {
        padding: 14px;
    }

    .account-settings-page .table-responsive {
        font-size: 14px;
    }

    .settings-avatar-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-page-center {
        min-height: calc(100vh - 170px);
    }

    .maintenance-page {
        padding: 12px;
    }

    .maintenance-card {
        padding: 18px 14px;
        border-radius: 14px;
    }

    .maintenance-title {
        font-size: 26px;
    }

    .maintenance-text {
        font-size: 14px;
        line-height: 1.5;
    }

    .maintenance-time {
        font-size: 14px;
    }

    .maintenance-card .btn {
        width: 100%;
    }
}
