* {
    box-sizing: border-box;
}

:root {
    --bg: #0b1020;
    --panel: #12192b;
    --panel-2: #18223b;
    --border: #293654;
    --text: #f5f7ff;
    --muted: #9da8c0;
    --accent: #6e8cff;
    --accent-hover: #819bff;
    --danger: #ff667f;
    --success: #5ee49a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}


/* =====================================================
   GENERAL
===================================================== */

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;

    background: var(--bg);
    color: var(--text);

    font-family:
        Arial,
        Helvetica,
        sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* =====================================================
   AUTH
===================================================== */

.screen {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 24px;
}

.auth-card {
    width: min(420px, 100%);

    padding: 30px;

    border:
        1px solid
        var(--border);

    border-radius: 24px;

    background:
        var(--panel);

    box-shadow:
        var(--shadow);
}

.brand {
    border: 0;

    background:
        transparent;

    color:
        var(--text);

    font-size:
        42px;

    font-weight:
        800;

    letter-spacing:
        -2px;
}

.brand.small {
    font-size:
        28px;
}

.brand-button {
    padding: 0;
}

.muted {
    color:
        var(--muted);
}


/* =====================================================
   TABS
===================================================== */

.tabs {
    display:
        grid;

    grid-template-columns:
        1fr
        1fr;

    gap:
        6px;

    padding:
        5px;

    margin:
        24px
        0
        16px;

    border:
        1px solid
        var(--border);

    border-radius:
        12px;

    background:
        #0e1527;
}

.tab {
    padding:
        10px;

    border:
        0;

    border-radius:
        8px;

    background:
        transparent;

    color:
        var(--muted);
}

.tab.active {
    background:
        var(--panel-2);

    color:
        var(--text);
}


/* =====================================================
   INPUTS
===================================================== */

.auth-card input,
.search-wrap input,
.create-box textarea,
.normal-input,
.edit-input,
.reply-input {
    width:
        100%;

    border:
        1px solid
        var(--border);

    border-radius:
        12px;

    outline:
        none;

    background:
        #0d1425;

    color:
        var(--text);
}

.auth-card input {
    height:
        46px;

    margin-bottom:
        12px;

    padding:
        0
        14px;
}

.normal-input {
    height:
        46px;

    padding:
        0
        14px;
}

.auth-card input:focus,
.search-wrap input:focus,
.create-box textarea:focus,
.normal-input:focus,
.edit-input:focus,
.reply-input:focus {
    border-color:
        var(--accent);
}


/* =====================================================
   BOTONES
===================================================== */

.primary-btn {
    padding:
        11px
        17px;

    border:
        0;

    border-radius:
        12px;

    background:
        var(--accent);

    color:
        white;

    font-weight:
        700;

    transition:
        background 0.2s,
        transform 0.15s;
}

.primary-btn:hover {
    background:
        var(--accent-hover);

    transform:
        translateY(-1px);
}

.primary-btn:disabled {
    opacity:
        0.6;

    cursor:
        not-allowed;

    transform:
        none;
}

.full {
    width:
        100%;
}

.ghost-btn {
    padding:
        9px
        12px;

    border:
        0;

    background:
        transparent;

    color:
        var(--muted);
}

.ghost-btn:hover {
    color:
        var(--text);
}


/* =====================================================
   TOPBAR
===================================================== */

.topbar {
    position:
        sticky;

    top:
        0;

    z-index:
        100;

    border-bottom:
        1px solid
        var(--border);

    background:
        rgba(
            11,
            16,
            32,
            0.94
        );

    backdrop-filter:
        blur(12px);
}

.topbar-inner {
    width:
        min(
            1180px,
            100%
        );

    margin:
        0
        auto;

    display:
        flex;

    align-items:
        center;

    gap:
        20px;

    padding:
        14px
        20px;
}

.search-wrap {
    flex:
        1;

    max-width:
        620px;
}

.search-wrap input {
    height:
        42px;

    padding:
        0
        14px;
}


/* =====================================================
   LAYOUT
===================================================== */

.layout {
    width:
        min(
            1180px,
            100%
        );

    margin:
        0
        auto;

    display:
        grid;

    grid-template-columns:
        220px
        minmax(
            0,
            1fr
        );

    gap:
        26px;

    padding:
        26px
        20px
        60px;
}

.sidebar {
    position:
        sticky;

    top:
        88px;

    align-self:
        start;

    display:
        grid;

    gap:
        8px;
}

.nav-btn {
    width:
        100%;

    padding:
        12px
        14px;

    border:
        0;

    border-radius:
        12px;

    background:
        transparent;

    color:
        var(--muted);

    text-align:
        left;

    transition:
        background 0.2s,
        color 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    background:
        var(--panel-2);

    color:
        var(--text);
}

.feed-area {
    min-width:
        0;
}


/* =====================================================
   HEADERS
===================================================== */

.page-header {
    margin-bottom:
        18px;
}

.page-header.compact {
    margin-top:
        30px;
}

.page-header h1,
.page-header h2 {
    margin:
        0
        0
        5px;
}


/* =====================================================
   CREATE
===================================================== */

.create-box {
    padding:
        16px;

    margin-bottom:
        20px;

    border:
        1px solid
        var(--border);

    border-radius:
        18px;

    background:
        var(--panel);

    box-shadow:
        var(--shadow);
}

.create-box.large {
    min-height:
        250px;
}

.create-box textarea {
    min-height:
        120px;

    padding:
        14px;

    resize:
        vertical;
}

.create-actions {
    display:
        flex;

    align-items:
        center;

    justify-content:
        space-between;

    gap:
        12px;

    margin-top:
        10px;
}


/* =====================================================
   IMÁGENES - SELECTOR
===================================================== */

.media-actions {
    display:
        flex;

    align-items:
        center;

    gap:
        10px;

    margin-top:
        12px;
}

.image-picker {
    display:
        inline-flex;

    align-items:
        center;

    gap:
        7px;

    padding:
        9px
        12px;

    border:
        1px solid
        var(--border);

    border-radius:
        10px;

    background:
        #0e1527;

    color:
        var(--muted);

    cursor:
        pointer;

    transition:
        border-color 0.2s,
        background 0.2s,
        color 0.2s,
        transform 0.15s;
}

.image-picker:hover {
    border-color:
        var(--accent);

    background:
        var(--panel-2);

    color:
        var(--text);

    transform:
        translateY(-1px);
}

.file-input {
    display:
        none;
}


/* =====================================================
   PREVISUALIZACIÓN
===================================================== */

.image-preview {
    position:
        relative;

    width:
        min(
            100%,
            550px
        );

    margin-top:
        14px;

    border:
        1px solid
        var(--border);

    border-radius:
        14px;

    overflow:
        hidden;

    background:
        #080d18;
}

.image-preview img {
    display:
        block;

    width:
        100%;

    max-height:
        400px;

    object-fit:
        contain;
}

.remove-image-button {
    position:
        absolute;

    top:
        10px;

    right:
        10px;

    width:
        34px;

    height:
        34px;

    display:
        grid;

    place-items:
        center;

    border:
        0;

    border-radius:
        50%;

    background:
        rgba(
            0,
            0,
            0,
            0.72
        );

    color:
        white;

    font-size:
        16px;

    cursor:
        pointer;

    transition:
        background 0.2s,
        transform 0.15s;
}

.remove-image-button:hover {
    background:
        rgba(
            0,
            0,
            0,
            0.92
        );

    transform:
        scale(1.05);
}


/* =====================================================
   POSTS
===================================================== */

.post {
    position:
        relative;

    padding:
        18px;

    margin-bottom:
        14px;

    border:
        1px solid
        var(--border);

    border-radius:
        18px;

    background:
        var(--panel);

    box-shadow:
        var(--shadow);

    overflow:
        visible;
}

.post-head {
    display:
        flex;

    align-items:
        center;

    gap:
        12px;
}

.avatar {
    width:
        44px;

    height:
        44px;

    display:
        grid;

    place-items:
        center;

    flex:
        0 0 auto;

    border-radius:
        50%;

    background:
        linear-gradient(
            135deg,
            #6e8cff,
            #8e6eff
        );

    color:
        white;

    font-weight:
        800;
}

.post-author {
    font-weight:
        700;
}

.post-time {
    font-size:
        13px;

    color:
        var(--muted);
}

.post-content {
    margin:
        14px
        0;

    white-space:
        pre-wrap;

    word-break:
        break-word;

    line-height:
        1.55;
}

.post-actions {
    display:
        flex;

    align-items:
        center;

    gap:
        8px;
}

.like-btn {
    display:
        inline-flex;

    align-items:
        center;

    gap:
        5px;

    padding:
        8px
        12px;

    border:
        1px solid
        var(--border);

    border-radius:
        10px;

    background:
        #0e1527;

    color:
        var(--text);

    transition:
        border-color 0.2s,
        background 0.2s,
        transform 0.15s;
}

.like-btn:hover {
    border-color:
        var(--accent);

    background:
        #131d35;

    transform:
        translateY(-1px);
}

.like-btn.liked {
    border-color:
        var(--accent);

    color:
        #bec9ff;
}

.like-count {
    min-width:
        12px;

    color:
        var(--muted);

    font-weight:
        600;
}


/* =====================================================
   IMÁGENES DE PUBLICACIONES
===================================================== */

.post-image-wrap {
    width:
        100%;

    margin:
        14px
        0;

    border:
        1px solid
        var(--border);

    border-radius:
        14px;

    overflow:
        hidden;

    background:
        #080d18;
}

.post-image {
    display:
        block;

    width:
        100%;

    max-height:
        650px;

    object-fit:
        contain;

    margin:
        0
        auto;
}


/* =====================================================
   MENÚ ⋮
===================================================== */

.post-menu {
    position:
        relative;

    margin-left:
        auto;

    flex:
        0 0 auto;
}

.post-menu-btn {
    width:
        38px;

    height:
        38px;

    display:
        grid;

    place-items:
        center;

    padding:
        0;

    border:
        1px solid
        transparent;

    border-radius:
        10px;

    background:
        transparent;

    color:
        #c3cbe0;

    font-size:
        25px;

    font-weight:
        700;

    line-height:
        1;

    cursor:
        pointer;

    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}

.post-menu-btn:hover {
    background:
        var(--panel-2);

    border-color:
        var(--border);

    color:
        white;
}

.post-dropdown {
    position:
        absolute;

    top:
        44px;

    right:
        0;

    width:
        175px;

    padding:
        5px;

    border:
        1px solid
        var(--border);

    border-radius:
        12px;

    background:
        #10182a;

    box-shadow:
        0
        15px
        40px
        rgba(
            0,
            0,
            0,
            0.4
        );

    z-index:
        1000;
}

.post-dropdown-item {
    width:
        100%;

    display:
        flex;

    align-items:
        center;

    gap:
        9px;

    padding:
        10px
        11px;

    border:
        0;

    border-radius:
        8px;

    background:
        transparent;

    color:
        var(--text);

    text-align:
        left;

    font-size:
        14px;

    cursor:
        pointer;
}

.post-dropdown-item:hover {
    background:
        var(--panel-2);
}

.post-dropdown-item.delete {
    color:
        var(--danger);
}

.post-dropdown-item.delete:hover {
    background:
        rgba(
            255,
            102,
            127,
            0.11
        );
}


/* =====================================================
   EDITAR POST
===================================================== */

.edit-area {
    margin:
        12px
        0;
}

.edit-input {
    min-height:
        100px;

    padding:
        12px;

    resize:
        vertical;

    line-height:
        1.5;
}

.edit-actions {
    display:
        flex;

    align-items:
        center;

    gap:
        8px;

    margin-top:
        8px;
}


/* =====================================================
   RESPUESTAS
===================================================== */

.replies-section {
    margin-top:
        18px;

    padding-top:
        16px;

    border-top:
        1px solid
        var(--border);
}

.replies-title {
    display:
        flex;

    align-items:
        center;

    gap:
        5px;

    margin-bottom:
        12px;

    font-weight:
        700;
}

.reply-count {
    color:
        var(--muted);
}

.replies-list {
    display:
        block;

    margin-bottom:
        14px;
}

.reply-node {
    position:
        relative;

    margin-top:
        10px;
}

.reply-node:first-child {
    margin-top:
        0;
}

.reply {
    position:
        relative;

    display:
        flex;

    gap:
        10px;

    padding:
        0;

    min-width:
        0;
}

.reply-avatar {
    width:
        34px;

    height:
        34px;

    display:
        grid;

    place-items:
        center;

    flex:
        0 0 auto;

    border-radius:
        50%;

    background:
        linear-gradient(
            135deg,
            #6e8cff,
            #8e6eff
        );

    color:
        white;

    font-size:
        13px;

    font-weight:
        800;

    position:
        relative;

    z-index:
        2;
}

.reply-body {
    min-width:
        0;

    flex:
        1;

    padding:
        8px
        11px;

    border-radius:
        12px;

    background:
        #0e1527;
}

.reply-header {
    display:
        flex;

    align-items:
        center;

    gap:
        8px;

    flex-wrap:
        wrap;
}

.reply-content {
    margin-top:
        4px;

    color:
        var(--text);

    line-height:
        1.45;

    white-space:
        pre-wrap;

    word-break:
        break-word;
}


/* =====================================================
   RESPONDER A RESPUESTA
===================================================== */

.reply-to-button {
    display:
        inline-flex;

    align-items:
        center;

    margin-top:
        7px;

    padding:
        4px
        7px;

    border:
        0;

    border-radius:
        7px;

    background:
        transparent;

    color:
        var(--muted);

    font-size:
        13px;

    cursor:
        pointer;

    transition:
        background 0.2s,
        color 0.2s;
}

.reply-to-button:hover {
    background:
        var(--panel-2);

    color:
        var(--text);
}


/* =====================================================
   ÁRBOL DE RESPUESTAS
===================================================== */

.reply-children {
    position:
        relative;

    margin-left:
        17px;

    padding-left:
        26px;

    margin-top:
        10px;
}

.reply-children::before {
    content:
        "";

    position:
        absolute;

    left:
        7px;

    top:
        -5px;

    bottom:
        17px;

    width:
        2px;

    border-radius:
        999px;

    background:
        #33405e;
}

.reply-children > .reply-node::before {
    content:
        "";

    position:
        absolute;

    left:
        -19px;

    top:
        17px;

    width:
        20px;

    height:
        2px;

    border-radius:
        999px;

    background:
        #33405e;
}


/* =====================================================
   RESPUESTA ACTIVA
===================================================== */

.replying-to {
    display:
        flex;

    align-items:
        center;

    gap:
        6px;

    margin-bottom:
        8px;

    padding:
        7px
        10px;

    border:
        1px solid
        var(--border);

    border-radius:
        10px;

    background:
        var(--panel-2);

    color:
        var(--muted);

    font-size:
        13px;
}

.replying-to strong {
    color:
        var(--text);
}

.cancel-reply {
    margin-left:
        auto;

    padding:
        2px
        5px;

    border:
        0;

    border-radius:
        6px;

    background:
        transparent;

    color:
        var(--muted);

    cursor:
        pointer;
}

.cancel-reply:hover {
    background:
        rgba(
            255,
            255,
            255,
            0.06
        );

    color:
        var(--text);
}

.no-replies {
    padding:
        10px
        0;

    color:
        var(--muted);

    font-size:
        14px;
}


/* =====================================================
   CAJA DE RESPUESTA
===================================================== */

.reply-form {
    margin-top:
        14px;
}

.reply-input {
    min-height:
        78px;

    padding:
        11px;

    resize:
        vertical;

    line-height:
        1.45;
}

.reply-input::placeholder {
    color:
        #697590;
}

.reply-actions {
    display:
        flex;

    align-items:
        center;

    justify-content:
        space-between;

    gap:
        10px;

    margin-top:
        8px;
}


/* =====================================================
   PERFIL
===================================================== */

.profile-card {
    display:
        flex;

    align-items:
        center;

    gap:
        18px;

    padding:
        22px;

    border:
        1px solid
        var(--border);

    border-radius:
        18px;

    background:
        var(--panel);

    box-shadow:
        var(--shadow);
}

.profile-avatar-large {
    width:
        86px;

    height:
        86px;

    display:
        grid;

    place-items:
        center;

    flex:
        0 0 auto;

    border-radius:
        50%;

    background:
        linear-gradient(
            135deg,
            #6e8cff,
            #8e6eff
        );

    color:
        white;

    font-size:
        34px;

    font-weight:
        800;
}

.profile-main {
    min-width:
        0;
}

.profile-card h1 {
    margin:
        0
        0
        5px;
}

.profile-stats {
    display:
        flex;

    flex-wrap:
        wrap;

    gap:
        8px
        16px;

    margin-top:
        14px;

    color:
        var(--muted);

    font-size:
        14px;
}

.profile-actions {
    display:
        flex;

    gap:
        10px;

    margin:
        16px
        0;
}

.profile-edit-button {
    margin-top:
        14px;
}

.following-btn {
    background:
        #202d4c;
}

.following-btn:hover {
    background:
        #2a3a60;
}


/* =====================================================
   EDITAR PERFIL
===================================================== */

.edit-profile-box h2 {
    margin:
        0
        0
        16px;
}

.edit-profile-box label {
    display:
        block;

    margin-bottom:
        7px;

    color:
        var(--muted);

    font-size:
        14px;
}

#editBioInput {
    min-height:
        100px;
}

.profile-edit-actions {
    display:
        flex;

    align-items:
        center;

    gap:
        8px;
}


/* =====================================================
   USUARIOS
===================================================== */

.user-result {
    display:
        flex;

    align-items:
        center;

    gap:
        14px;

    padding:
        14px;

    margin-bottom:
        10px;

    border:
        1px solid
        var(--border);

    border-radius:
        16px;

    background:
        var(--panel);

    cursor:
        pointer;

    transition:
        border-color 0.2s,
        background 0.2s,
        transform 0.15s;
}

.user-result:hover {
    border-color:
        var(--accent);

    background:
        var(--panel-2);

    transform:
        translateY(-1px);
}

.user-result-info {
    min-width:
        0;

    display:
        flex;

    flex-direction:
        column;

    gap:
        3px;
}


/* =====================================================
   VOLVER
===================================================== */

.back-button {
    margin-bottom:
        15px;

    padding-left:
        0;
}


/* =====================================================
   MODALES
===================================================== */

.nexa-modal-overlay {
    position:
        fixed;

    inset:
        0;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    padding:
        20px;

    background:
        rgba(
            0,
            0,
            0,
            0.58
        );

    backdrop-filter:
        blur(6px);

    z-index:
        9999;

    animation:
        modalFadeIn
        0.15s
        ease-out;
}

.nexa-modal {
    width:
        min(
            410px,
            100%
        );

    padding:
        24px;

    border:
        1px solid
        var(--border);

    border-radius:
        20px;

    background:
        var(--panel);

    box-shadow:
        0
        25px
        70px
        rgba(
            0,
            0,
            0,
            0.45
        );

    animation:
        modalSlideIn
        0.18s
        ease-out;
}

.nexa-modal-icon {
    width:
        46px;

    height:
        46px;

    display:
        grid;

    place-items:
        center;

    margin-bottom:
        14px;

    border-radius:
        13px;

    background:
        rgba(
            255,
            102,
            127,
            0.12
        );

    font-size:
        22px;
}

.nexa-modal h2 {
    margin:
        0
        0
        8px;
}

.nexa-modal p {
    margin:
        0;

    color:
        var(--muted);

    line-height:
        1.5;
}

.nexa-modal-actions {
    display:
        flex;

    justify-content:
        flex-end;

    gap:
        8px;

    margin-top:
        22px;
}

.modal-cancel,
.modal-delete {
    padding:
        10px
        15px;

    border:
        0;

    border-radius:
        10px;

    font-weight:
        600;
}

.modal-cancel {
    background:
        var(--panel-2);

    color:
        var(--text);
}

.modal-cancel:hover {
    background:
        #22304f;
}

.modal-delete {
    background:
        var(--danger);

    color:
        white;
}

.modal-delete:hover {
    background:
        #ff4d6b;
}

@keyframes modalFadeIn {

    from {
        opacity:
            0;
    }

    to {
        opacity:
            1;
    }

}

@keyframes modalSlideIn {

    from {
        opacity:
            0;

        transform:
            translateY(
                8px
            )
            scale(
                0.98
            );
    }

    to {
        opacity:
            1;

        transform:
            translateY(
                0
            )
            scale(
                1
            );
    }

}


/* =====================================================
   MENSAJES
===================================================== */

.message {
    min-height:
        20px;

    margin-top:
        12px;

    color:
        var(--muted);
}

.error {
    color:
        var(--danger);
}

.success {
    color:
        var(--success);
}


/* =====================================================
   EMPTY
===================================================== */

.empty {
    padding:
        36px
        18px;

    text-align:
        center;

    border:
        1px dashed
        var(--border);

    border-radius:
        18px;

    color:
        var(--muted);
}


/* =====================================================
   SCROLLBAR
===================================================== */

::-webkit-scrollbar {
    width:
        9px;
}

::-webkit-scrollbar-track {
    background:
        var(--bg);
}

::-webkit-scrollbar-thumb {
    border-radius:
        999px;

    background:
        #293654;
}

::-webkit-scrollbar-thumb:hover {
    background:
        #3b4b70;
}


/* =====================================================
   SELECCIÓN
===================================================== */

::selection {
    background:
        rgba(
            110,
            140,
            255,
            0.35
        );

    color:
        white;
}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 820px) {

    .layout {
        grid-template-columns:
            1fr;
    }

    .sidebar {
        position:
            static;

        grid-template-columns:
            repeat(
                4,
                1fr
            );
    }

    .nav-btn {
        text-align:
            center;
    }

    .topbar-inner {
        flex-wrap:
            wrap;
    }

    .search-wrap {
        order:
            3;

        flex-basis:
            100%;

        max-width:
            none;
    }

}


@media (max-width: 560px) {

    .sidebar {
        grid-template-columns:
            repeat(
                2,
                1fr
            );
    }

    .profile-card {
        align-items:
            flex-start;

        flex-direction:
            column;
    }

    .profile-avatar-large {
        width:
            72px;

        height:
            72px;

        font-size:
            28px;
    }

    .reply-children {
        margin-left:
            10px;

        padding-left:
            22px;
    }

    .reply-children::before {
        left:
            5px;
    }

    .reply-children > .reply-node::before {
        left:
            -17px;

        width:
            18px;
    }

    .reply-actions {
        align-items:
            stretch;

        flex-direction:
            column;
    }

    .reply-actions .primary-btn {
        width:
            100%;
    }

    .image-preview {
        width:
            100%;
    }

    .post-image {
        max-height:
            500px;
    }

}


@media (max-width: 500px) {

    .brand.small {
        font-size:
            24px;
    }

    .topbar-inner {
        gap:
            10px;

        padding:
            12px;
    }

    .layout {
        padding:
            18px
            12px
            45px;
    }

    .auth-card {
        padding:
            22px;
    }

    .post {
        padding:
            14px;
    }

    .profile-card {
        padding:
            16px;
    }

}