/* ==========================================================================
   NOTEBING - STYLESHEET v3
   Architecture: Mobile-First, CSS Variables, CSS Grid, Material 3 
   Fixes aplicados: #1 (sin Tailwind), #4 (nav-item unificado)
   Nuevos Cambios: Lucide Icons, CSS Grid estricto, Notion/X hybrid
   ========================================================================== */

:root {
    /* M3 Expressive Light Theme */
    --bg-base: #f0f2f5;
    --bg-surface: #ffffff;
    --bg-surface-hover: rgba(0, 0, 0, 0.03);
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-strong: rgba(255, 255, 255, 0.88);

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-inverse: #ffffff;

    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-alpha: rgba(37, 99, 235, 0.08);

    --border-color: rgba(0, 0, 0, 0.06);

    --danger-color: #e11d48;
    --danger-alpha: rgba(225, 29, 72, 0.08);
    --success-color: #10b981;
    --success-alpha: rgba(16, 185, 129, 0.08);
    --warning-color: #f59e0b;
    --warning-alpha: rgba(245, 158, 11, 0.08);

    /* Ultra-diffused depth system */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.06);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.04);

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 9999px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

[data-theme="dark"] {
    /* M3 Expressive Dark Theme */
    --bg-base: #0a0e1a;
    --bg-surface: rgba(15, 23, 42, 0.6);
    --bg-surface-hover: rgba(255, 255, 255, 0.04);
    --bg-glass: rgba(15, 23, 42, 0.65);
    --bg-glass-strong: rgba(15, 23, 42, 0.82);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);

    --accent-primary: #3b82f6;
    --accent-hover: #60a5fa;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;


}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    overflow-y: scroll;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

button,
input,
select,
textarea {
    font-family: inherit;
    border: none;
    background: none;
    outline: none;
    color: inherit;
}

button {
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
    touch-action: manipulation;

}

button:active {
    transform: scale(0.97);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

/* ==========================================================================
   LUCIDE ICONS CSS SUPPORT
   ========================================================================== */
.lucide {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
    transition: stroke var(--transition-smooth), fill var(--transition-smooth), transform var(--transition-fast);
}

.nav-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.btn-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

.action-icon {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   LAYOUT (Mobile First — Single Column)
   ========================================================================== */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    /* No radius on mobile for full-screen feel */
    border-radius: 0;
    background: var(--bg-base);
    animation: ios-fade-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    flex: 1;
    width: 100%;
    min-width: 0;

    /* space for bottom-nav */
    background-color: transparent;
    /* let bg-base show between card gaps */
    min-height: 100vh;
}

.sidebar-left {
    display: none;

}

.sidebar-right {
    display: none;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
    left: 0;
    right: 0;
    width: 100%;
    bottom: 0;
}

/* Bottom nav is position:fixed, so it's visually out of flow,
   but it IS an HTML child of .app-container. We must ensure
   Grid does not assign it a column slot on tablet/desktop. */
.bottom-nav {
    grid-column: 1 / -1;
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   TABLET — 2 Columns (>= 768px)
   ========================================================================== */
@media (min-width: 768px) {
    body {
        background-color: var(--bg-base);
        touch-action: manipulation;
        overflow-y: scroll;
        overflow-x: hidden !important;
        scrollbar-gutter: stable;
        scrollbar-width: thin;
        scrollbar-color: var(--accent-primary) transparent;
        border-radius: var(--radius-lg);
    }

    /* Kill mobile bottom nav strictly on Tablet/Desktop */
    .bottom-nav {
        display: none !important;
    }

    .toast {
        bottom: 40px;
    }

    /* Switch to CSS Grid, 2 columns, centered */
    .app-container {
        display: grid;
        grid-template-columns: 240px 1fr;
        grid-template-rows: auto;
        max-width: 860px;
        /* 240 + 600 + 20px breathing room */
        margin: 0 auto;
        min-height: 100vh;
        border-radius: var(--radius-lg);
        overflow: hidden;
    }

    /* Show left sidebar */
    .sidebar-left {
        display: block;
        grid-column: 1;
        grid-row: 1;
        position: relative;
    }

    .sidebar-left-inner {
        position: sticky;
        top: 0;
        height: 100vh;
        width: 100%;
        padding: var(--space-xl) var(--space-md);
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        background: var(--bg-glass);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-right: 1px solid var(--border-color);
    }

    .logo-desktop {
        font-size: 24px;
        font-weight: 800;
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: var(--space-xl);
        padding-left: 12px;
        letter-spacing: -0.5px;
    }

    .logo-desktop span {
        color: var(--accent-primary);
    }

    .nav-section-title {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-secondary);
        letter-spacing: 0.5px;
        margin: 16px 0 8px 12px;
        opacity: 0.8;
    }

    .nav-section-divider {
        height: 1px;
        background: var(--border-color);
        margin: 16px 12px;
    }

    .nav-item--desktop {
        flex-direction: row;
        gap: 12px;
        font-size: 15px;
        padding: 10px 14px;
        width: 100%;
        border-radius: var(--radius-md);
        font-weight: 500;
    }

    .nav-item--desktop.active {
        font-weight: 700;
    }

    .btn-compose-desktop {
        margin-top: auto;
        width: 100%;
        font-size: 15px;
    }

    /* Main feed takes the second column */
    .main-content {
        grid-column: 2;
        grid-row: 1;
        margin: 0;
        padding-bottom: 0;
        max-width: 600px;
        width: 100%;
    }

    .top-bar {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* ==========================================================================
   DESKTOP — 3 Columns (>= 1080px)
   ========================================================================== */
@media (min-width: 1080px) {
    .app-container {
        grid-template-columns: 260px 600px 320px;
        column-gap: 0;
        justify-content: center;
        max-width: 1200px;
        margin: 0 auto;
        border-radius: var(--radius-lg);
        box-shadow: 0 30px 100px rgba(0, 0, 0, 0.4);
    }

    .sidebar-left-inner {
        padding: var(--space-xl) var(--space-lg);
        border-radius: var(--radius-lg);
        z-index: 30;
        box-shadow: 15px 0 45px rgba(0, 0, 0, 0.4);
    }

    .nav-item--desktop {
        font-size: 16px;
        padding: 12px 16px;
    }

    /* Show right sidebar */
    .sidebar-right {
        grid-column: 3;
        display: grid;
        grid-row: 1;
        position: sticky;
        top: 0;
        height: fit-content;
        border-radius: var(--radius-lg);
    }

    .sidebar-right-inner {
        position: sticky;
        top: 0;
        height: 100vh;
        padding: var(--space-xl) var(--space-lg);
        overflow-y: auto;
        border-radius: var(--radius-lg);
        border-left: 1px solid rgba(0, 0, 0, 0.4);
        z-index: 30;
        box-shadow: -15px 0 45px rgba(0, 0, 0, 0.4);
    }

    .main-content {
        grid-column: 2;
    }
}

/* ==========================================================================
   COMPONENTES
   ========================================================================== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: calc(10px + env(safe-area-inset-top)) var(--space-lg) 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Full width on mobile */
    border-radius: var(--radius-lg);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-surface-hover);
}

[data-theme="dark"] .theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: block !important;
}

/* --- Mobile Bottom Nav con FAB style --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: none;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    touch-action: manipulation;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
    left: 0;
    right: 0;
    width: 100%;
    bottom: 0;
}

/* Nav Items M3 Style */
.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.nav-item:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.nav-item.active {
    color: var(--accent-primary);
    font-weight: 700;
    background: var(--accent-alpha);
}

.nav-item.active .lucide {
    fill: var(--accent-alpha);
    stroke-width: 2.5;
}

.nav-item--mobile {
    flex-direction: column;
    font-size: 10px;
    padding: 6px 12px;
}

.nav-item--mobile .nav-icon {
    margin-bottom: 2px;
}

.btn-compose-mobile .fab-inner {
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-md);
    transform: translateY(-10px);
    transition: var(--transition-fast);
}

.btn-compose-mobile:active .fab-inner {
    transform: translateY(-8px) scale(0.95);
}

/* --- Botones --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent-primary);
    color: var(--text-inverse);
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 12px var(--accent-alpha);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary.btn--danger {
    background: var(--danger-color);
    box-shadow: 0 4px 12px var(--danger-alpha);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 14px;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
}

/* Follow Toggle */
.btn-follow {
    background: var(--text-primary);
    color: var(--bg-surface);
    padding: 6px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    border: 1px solid transparent;
}

.btn-follow.following {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-follow.following:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: var(--danger-alpha);
}

/* --- Avatar & Media --- */
.avatar {
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar--lg {
    width: 96px;
    height: 96px;
    font-size: 32px;
}

.avatar--md {
    width: 44px;
    height: 44px;
    font-size: 15px;
}

.avatar--sm {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.avatar--xs {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Composer --- */
.composer {
    padding: var(--space-lg);
    margin: var(--space-md);
    background: var(--bg-glass-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    gap: 16px;
}

@media (max-width: 600px) {
    .composer {
        margin: var(--space-sm);
        padding: var(--space-md);
        gap: 12px;
    }
}

.composer-body {
    flex: 1;
}

.composer textarea {
    width: 100%;
    font-size: 18px;
    line-height: 1.4;
    color: var(--text-primary);
    resize: none;
    min-height: 60px;
    padding-top: 8px;
}

.composer textarea::placeholder {
    color: var(--text-secondary);
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.select-group {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.pill-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.pill-select-wrapper .select-icon {
    position: absolute;
    left: 10px;
    width: 14px;
    height: 14px;
    color: var(--accent-primary);
    pointer-events: none;
}

.pill-select {
    padding: 6px 12px 6px 30px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    appearance: none;
    transition: var(--transition-fast);
}

.pill-select:hover {
    background: var(--border-color);
}

/* --- Feed & Note Cards (M3 Expressive Bubble Cards) --- */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm);
}

.note-card {
    padding: var(--space-lg);
    background: var(--bg-glass-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
    animation: fadeIn 0.4s ease forwards;
}

.note-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    cursor: pointer;
}

.note-author-wrap {
    display: flex;
    gap: 12px;
}

.note-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.note-author {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-handle {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 14px;
    margin-left: 4px;
}

.note-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: -2px;
}

.note-options {
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.note-card:hover .note-options {
    opacity: 1;
}

.opt-btn {
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 50%;
}

.opt-btn:hover {
    background: var(--danger-alpha);
    color: var(--danger-color);
}

.opt-btn.edit:hover {
    background: var(--accent-alpha);
    color: var(--accent-primary);
}

.note-body {
    margin-left: 56px;
}

.note-content {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.badges-container {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

.badge .lucide {
    width: 14px;
    height: 14px;
}

.badge-ai {
    background: var(--accent-alpha);
    color: var(--accent-primary);
}

.badge-niche {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-private {
    background: var(--warning-alpha);
    color: var(--warning-color);
}

.note-actions {
    display: flex;
    gap: 24px;
    max-width: 420px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    margin-left: -12px;
}

.action-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--accent-primary);
}

/* Lucide Icon Interaction States */
.action-btn.liked {
    color: var(--danger-color);
}

.action-btn.liked:hover {
    background: var(--danger-alpha);
}

.action-btn.liked .lucide {
    fill: var(--danger-color);
    stroke: var(--danger-color);
}

.action-btn.saved {
    color: var(--accent-primary);
}

.action-btn.saved:hover {
    background: var(--accent-alpha);
}

.action-btn.saved .lucide {
    fill: var(--accent-primary);
    stroke: var(--accent-primary);
}

.action-btn.renoted {
    color: var(--success-color);
}

.action-btn.renoted:hover {
    background: var(--success-alpha);
}

.action-btn.renoted .lucide {
    stroke: var(--success-color);
    stroke-width: 2.5;
}

/* Heart Anim */
@keyframes heartBurst {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.4) translateY(-2px);
    }

    100% {
        transform: scale(1) translateY(0);
    }
}

.action-btn.liked .lucide {
    animation: heartBurst 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- Widgets (Sidebar Derecho — Glass M3) --- */
.widget {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: rgba(34, 34, 34, 0.182) 4px 4px 9px 0px, rgba(17, 17, 17, 1) -10px -10px 25px -12px, rgba(31, 31, 31, 0.11) 2px 2px 6px 0px;
}

.widget h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.trend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.trend-item:hover {
    background: var(--bg-surface-hover);
}

.trend-item:last-child {
    padding-bottom: 0;
}

.trend-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trend-info strong {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trend-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

/* --- Feed Filters (Barra Píldoras JS) --- */
.feed-filters-wrapper {
    position: sticky;
    top: calc(58px + env(safe-area-inset-top));
    /* Just below top-bar */
    z-index: 40;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.feed-filters {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px var(--space-lg);
    scrollbar-width: none;
    /* Firefox */
}

.feed-filters::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-pill {
    white-space: nowrap;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
}

.filter-pill:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.filter-pill.active {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: 0 4px 14px var(--accent-alpha);
}

/* SPA Links Interactions */
.user-link,
.niche-link {
    cursor: pointer;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.user-link:hover,
.niche-link:hover {
    opacity: 0.7;
    text-decoration: none;
}

/* --- Modals & Toasts --- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-surface);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--space-xl);
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-message {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.modal-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface-hover);
    font-size: 15px;
    margin-bottom: var(--space-md);
    transition: border var(--transition-fast);
}

.modal-textarea:focus {
    border-color: var(--accent-primary);
    background: var(--bg-surface);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
   NOTION BLOCK EDITOR UI
   ========================================================================== */
.block-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.block-wrapper {
    position: relative;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.block-wrapper.is-edit-mode {
    border: 1px dashed transparent;
}

.block-wrapper.is-edit-mode:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-color);
}

.block-handle {
    position: absolute;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    cursor: grab;
    color: var(--text-secondary);
    padding: 4px;
    transition: opacity var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.block-handle i {
    width: 18px;
    height: 18px;
}

.block-handle-arrows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.arrow-up,
.arrow-down {
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px;
}

.arrow-up:hover,
.arrow-down:hover {
    color: var(--text-primary);
}

.block-wrapper.is-edit-mode:hover .block-handle {
    opacity: 0.6;
}

.block-wrapper.is-edit-mode .block-handle:hover {
    opacity: 1;
}

.block-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    display: flex;
    gap: 4px;
    transition: opacity var(--transition-fast);
}

.block-wrapper.is-edit-mode:hover .block-actions {
    opacity: 1;
}

/* Block Content Styles */
.block-content[data-type="text"] {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.block-content[data-type="h1"] {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-top: 24px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.block-content[data-type="h2"] {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-top: 20px;
    margin-bottom: 8px;
}

.block-content[data-type="h3"] {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 4px;
}

.block-content[data-type="quote"] {
    border-left: 4px solid var(--accent-primary);
    padding-left: 16px;
    margin: 12px 0;
    font-size: 18px;
    font-style: italic;
    color: var(--text-secondary);
}

.block-content[data-type="divider"] {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

.block-content[data-type="folder"] {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-glass-strong);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.block-content[data-type="folder"] i {
    color: var(--accent-primary);
}

/* Edit Mode Add Button */
.add-block-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    padding: 12px;
    margin-top: 8px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.add-block-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--accent-primary);
    border-color: var(--accent-alpha);
}

/* Profile Locked State */
.profile-locked {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-lg);
    margin-top: 24px;
}

.profile-locked i {
    color: var(--text-secondary);
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ==========================================================================
   NOTIFICATIONS VIEW
   ========================================================================== */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.notif-item:hover {
    background: var(--bg-surface-hover);
}

.notif-item.unread {
    background: var(--accent-alpha);
}

.notif-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon-wrap.like {
    background: var(--danger-alpha);
    color: var(--danger-color);
}

.notif-icon-wrap.renote {
    background: var(--success-alpha);
    color: var(--success-color);
}

.notif-icon-wrap.follow {
    background: var(--accent-alpha);
    color: var(--accent-primary);
}

.notif-badge {
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* ==========================================================================
   iOS 26.1 MOTION DESIGN
   ========================================================================== */
.view-enter {
    animation: springFadeIn 0.8s var(--transition-spring) forwards;
}

@keyframes springFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   MOBILE-SPECIFIC REFINEMENTS (EXCELLENCE)
   ========================================================================== */
@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        /* Tighter padding on mobile */
    }

    body {
        -webkit-user-select: none;
        /* Prevents accidental text selection on taps */
        user-select: none;
    }

    .main-content {
        padding-top: 0;
    }

    .note-card {
        padding: 16px;
        margin: 0 4px;
        /* Slight margin to show bg-base between cards */
        border-radius: var(--radius-md);
    }

    .note-body {
        margin-left: 0;
        margin-top: 12px;
    }

    .note-author {
        font-size: 14px;
    }

    .note-handle {
        font-size: 13px;
    }

    .note-content {
        font-size: 16px;
        /* Slightly larger for readability */
    }

    /* Composer Tweaks */
    .composer {
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
    }

    .composer textarea {
        font-size: 16px;
    }

    .btn-primary {
        padding: 12px 28px;
        font-size: 14px;
        width: 100%;
        /* Full width button on mobile composer for better tap */
        max-width: 140px;
    }

    .composer-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .select-group {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .select-group::-webkit-scrollbar {
        display: none;
    }

    .composer-actions #btn-publish {
        align-self: flex-end;
        margin-top: 8px;
    }

    /* Bottom Nav Polish */
    .bottom-nav {
        height: calc(64px + env(safe-area-inset-bottom));
        padding: 0 12px;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    }

    .nav-item--mobile {
        padding: 8px 4px;
        min-width: 60px;
    }

    .btn-compose-mobile .fab-inner {
        width: 52px;
        height: 52px;
        transform: translateY(-16px);
    }
}

@keyframes ios-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOutCard {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}