/* ==========================================================================
   KutSocial · Tema Mastodon 5.0 (Layout completo con barra de iconos superior
   y barra vertical colapsable)
   Activado cuando html[data-ui-theme="mastodon"]
   ========================================================================== */

html[data-ui-theme="mastodon"] {
    --bg-color: #0b0b0f;
    --surface-bg: #131318;
    --surface-elevated: #1b1b24;
    --card-bg: #131318;
    --border-color: rgba(255, 255, 255, 0.085);
    --primary: #8c86ff;
    --primary-hover: #a5a0ff;
    --pill-bg: #c4c0ff;
    --pill-bg-hover: #d8d5ff;
    --pill-text: #111116;
    --secondary: #34d399;
    --text-color: #f4f4f6;
    --text-muted: #9898a8;
    --sidebar-width: 264px;
}

html[data-ui-theme="mastodon"] body {
    background-color: var(--bg-color);
    background-image: none;
    color: var(--text-color);
}

/* Layout de 2 columnas centrado (sin barra derecha) */
html[data-ui-theme="mastodon"] .app-layout {
    max-width: 1020px;
    padding: 16px 20px;
    gap: 24px;
    justify-content: center;
}

html[data-ui-theme="mastodon"] .right-sidebar {
    display: none !important;
}

/* ==========================================================================
   Sidebar Izquierdo Mastodon 5.0 (Expandido)
   ========================================================================== */
html[data-ui-theme="mastodon"] .sidebar {
    width: var(--sidebar-width);
    top: 16px;
    height: calc(100vh - 32px);
    padding: 6px 4px;
    transition: width 0.2s ease;
    overflow: visible;
    z-index: 200;
}

/* Cabecera: Marca + botón cerrar/colapsar */
html[data-ui-theme="mastodon"] .m5-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 6px 14px 6px;
}

html[data-ui-theme="mastodon"] .m5-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    min-width: 0;
}

html[data-ui-theme="mastodon"] .m5-brand-logo {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

html[data-ui-theme="mastodon"] .m5-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

html[data-ui-theme="mastodon"] .m5-brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

html[data-ui-theme="mastodon"] .m5-brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

html[data-ui-theme="mastodon"] button.m5-collapse-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border-radius: 9999px;
    border: none;
    background: transparent;
    background-image: none;
    box-shadow: none;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

html[data-ui-theme="mastodon"] button.m5-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: none;
}

html[data-ui-theme="mastodon"] .m5-collapse-btn .m5-icon-open {
    display: none;
}

/* Barra superior de 5 iconos (Home, Search, Messages, Notifications, Avatar) */
html[data-ui-theme="mastodon"] .m5-icon-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 2px 2px 14px 2px;
}

html[data-ui-theme="mastodon"] .m5-account-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

html[data-ui-theme="mastodon"] .m5-icon-btn,
html[data-ui-theme="mastodon"] button.m5-icon-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 9999px;
    border: 1px solid transparent;
    background: transparent;
    background-image: none;
    box-shadow: none;
    color: #c8c8d6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

html[data-ui-theme="mastodon"] .m5-icon-btn:hover,
html[data-ui-theme="mastodon"] button.m5-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: none;
}

html[data-ui-theme="mastodon"] .m5-icon-btn.active {
    background: rgba(196, 192, 255, 0.14);
    color: #e0ddff;
}

html[data-ui-theme="mastodon"] .m5-avatar-btn img {
    width: 30px;
    height: 30px;
    border-radius: 9999px;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
}

html[data-ui-theme="mastodon"] .m5-notif-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid var(--bg-color);
}

/* Popover menú de cuenta */
html[data-ui-theme="mastodon"] .m5-popover-menu {
    position: absolute;
    top: 48px;
    right: 0;
    left: auto;
    width: 240px;
    background: var(--surface-elevated);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
    z-index: 2500;
}

html[data-ui-theme="mastodon"] .m5-account-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 10px 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
}

html[data-ui-theme="mastodon"] .m5-account-menu-header img {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    object-fit: cover;
}

html[data-ui-theme="mastodon"] .m5-menu-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[data-ui-theme="mastodon"] .m5-menu-handle {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[data-ui-theme="mastodon"] .m5-menu-item,
html[data-ui-theme="mastodon"] button.m5-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    margin: 0;
    border-radius: 9px;
    border: none;
    background: transparent;
    background-image: none;
    box-shadow: none;
    color: #e4e4ec;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}

html[data-ui-theme="mastodon"] .m5-menu-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

html[data-ui-theme="mastodon"] .m5-menu-item .material-icons-outlined {
    font-size: 18px;
    color: var(--text-muted);
}

html[data-ui-theme="mastodon"] .m5-menu-danger:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

html[data-ui-theme="mastodon"] .m5-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

html[data-ui-theme="mastodon"] .m5-menu-lang {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
}

/* Botón principal "New Post / Publicar" */
html[data-ui-theme="mastodon"] button.m5-new-post-btn {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    margin: 0 0 16px 0;
    border-radius: 9999px;
    border: none;
    background: var(--pill-bg);
    background-image: none;
    box-shadow: none;
    color: var(--pill-text);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

html[data-ui-theme="mastodon"] button.m5-new-post-btn:hover {
    background: var(--pill-bg-hover);
    transform: none;
}

html[data-ui-theme="mastodon"] button.m5-new-post-btn .material-icons-outlined {
    font-size: 19px;
    line-height: 1;
}

/* Enlaces secundarios de navegación */
html[data-ui-theme="mastodon"] .nav-menu {
    gap: 2px;
}

/* Ocultamos en el menú inferior los que ya están en la barra superior de iconos o en el menú de perfil */
html[data-ui-theme="mastodon"] #nav-home,
html[data-ui-theme="mastodon"] #nav-notifications,
html[data-ui-theme="mastodon"] #nav-direct,
html[data-ui-theme="mastodon"] #nav-profile,
html[data-ui-theme="mastodon"] #nav-settings,
html[data-ui-theme="mastodon"] #nav-admin-settings,
html[data-ui-theme="mastodon"] #nav-item-owner,
html[data-ui-theme="mastodon"] .sidebar-lang-selector,
html[data-ui-theme="mastodon"] .user-profile-summary {
    display: none !important;
}

html[data-ui-theme="mastodon"] .nav-link {
    border-radius: 9999px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #c8c8d6;
    transition: background-color 0.15s ease, color 0.15s ease;
}

html[data-ui-theme="mastodon"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    transform: none;
}

html[data-ui-theme="mastodon"] .nav-link.active {
    background: rgba(196, 192, 255, 0.14);
    color: #e0ddff;
    font-weight: 600;
    border-color: transparent;
}

/* ==========================================================================
   ESTADO COLAPSADO (Barra vertical compacta de iconos, como Mastodon 5.0)
   ========================================================================== */
html[data-ui-theme="mastodon"].m5-sidebar-collapsed .sidebar {
    width: 64px;
    align-items: center;
    padding: 6px 0;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-sidebar-header {
    justify-content: center;
    padding: 4px 0 10px 0;
    width: 100%;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-brand {
    display: none;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-collapse-btn .m5-icon-close {
    display: none;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-collapse-btn .m5-icon-open {
    display: inline-block;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-icon-bar {
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 12px 0;
    width: 100%;
    align-items: center;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-popover-menu {
    left: 54px;
    right: auto;
    top: 0;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed button.m5-new-post-btn {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    margin: 0 auto 14px auto;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-new-post-label {
    display: none;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .nav-menu {
    align-items: center;
    gap: 6px;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .nav-link {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    border-radius: 9999px;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .nav-label,
html[data-ui-theme="mastodon"].m5-sidebar-collapsed .notification-badge {
    display: none !important;
}

/* ==========================================================================
   Columna Central (Feed continuo estilo Mastodon 5.0)
   ========================================================================== */
html[data-ui-theme="mastodon"] .main-content {
    max-width: 680px;
    width: 100%;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: visible;
    padding-bottom: 12px;
}

html[data-ui-theme="mastodon"] #tab-feed > .composer-card {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(19, 19, 24, 0.92);
    backdrop-filter: blur(16px);
}

html[data-ui-theme="mastodon"] .composer-card {
    background: transparent;
    backdrop-filter: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    box-shadow: none;
    margin-bottom: 0;
    padding: 18px 20px;
}

html[data-ui-theme="mastodon"] .composer-card.zen-mode {
    background: #111116;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

html[data-ui-theme="mastodon"] .btn-publish,
html[data-ui-theme="mastodon"] .btn-submit,
html[data-ui-theme="mastodon"] #login-form button[type="submit"] {
    background: var(--pill-bg);
    color: var(--pill-text);
    border-radius: 9999px;
    font-weight: 700;
    border: none;
    box-shadow: none;
}

html[data-ui-theme="mastodon"] .btn-publish:hover,
html[data-ui-theme="mastodon"] .btn-submit:hover,
html[data-ui-theme="mastodon"] #login-form button[type="submit"]:hover {
    background: var(--pill-bg-hover);
    color: var(--pill-text);
}

html[data-ui-theme="mastodon"] .feed-container {
    gap: 0;
}

html[data-ui-theme="mastodon"] .toot-card {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    padding: 16px 20px;
    transition: background-color 0.12s ease;
}

html[data-ui-theme="mastodon"] .toot-card:last-child {
    border-bottom: none;
}

html[data-ui-theme="mastodon"] .toot-card:not(.toot-main):hover {
    background: rgba(255, 255, 255, 0.025);
    border-color: var(--border-color);
}

html[data-ui-theme="mastodon"] .toot-avatar-link img,
html[data-ui-theme="mastodon"] .user-avatar {
    border-radius: 9999px;
}

html[data-ui-theme="mastodon"] .toot-content a {
    color: #b8b2ff;
}

html[data-ui-theme="mastodon"] .toot-media-grid img,
html[data-ui-theme="mastodon"] .toot-media-single img,
html[data-ui-theme="mastodon"] .link-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

html[data-ui-theme="mastodon"] .toot-action-btn {
    color: var(--text-muted);
    border-radius: 9999px;
}

html[data-ui-theme="mastodon"] .toot-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

html[data-ui-theme="mastodon"] .section-header,
html[data-ui-theme="mastodon"] .profile-header-card,
html[data-ui-theme="mastodon"] .catchup-header,
html[data-ui-theme="mastodon"] .notifications-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    margin-bottom: 0;
}

html[data-ui-theme="mastodon"] .login-card,
html[data-ui-theme="mastodon"] .modal-card,
html[data-ui-theme="mastodon"] .modal-content {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
}

html[data-ui-theme="mastodon"] .m5-scroll-top {
    width: 100%;
    margin-top: auto;
    padding-top: 12px;
}

html[data-ui-theme="mastodon"] button.sidebar-scroll-top-btn {
    width: 100%;
    padding: 10px 14px;
    margin: 0;
    border-radius: 9999px;
    background: var(--surface-elevated);
    background-image: none;
    border: 1px solid rgba(196, 192, 255, 0.28);
    color: #e4e1ff;
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

html[data-ui-theme="mastodon"] button.sidebar-scroll-top-btn:hover {
    background: var(--pill-bg);
    color: var(--pill-text);
}

html[data-ui-theme="mastodon"] button.sidebar-scroll-top-btn.has-new-toots {
    background: var(--pill-bg);
    color: var(--pill-text);
    border-color: transparent;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-scroll-top {
    display: flex;
    justify-content: center;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed button.sidebar-scroll-top-btn {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 9999px;
}

html[data-ui-theme="mastodon"].m5-sidebar-collapsed .m5-scroll-top-text {
    display: none;
}

@media (max-width: 768px) {
    html[data-ui-theme="mastodon"] .app-layout {
        padding: 0;
        gap: 0;
    }
    html[data-ui-theme="mastodon"] .main-content {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}
