/* ===================================================================
   Novode — UI Components
   =================================================================== */

/* --- Buttons ---------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: var(--leading-ui);
}

.btn:active {
    transform: scale(0.95);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--sp-3) var(--sp-6);
    font-size: var(--text-base);
    border-radius: var(--radius-pill);
}

.btn-icon {
    padding: var(--sp-2);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
}

/* --- Cards (universal) ------------------------------------------ */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: all var(--duration) var(--ease);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-hover);
    transform: translateY(-2px);
}

.card:active {
    transform: scale(0.98);
}

.card-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.card-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

.card-body {
    padding: var(--sp-5);
}

.card-title {
    font-size: var(--text-base);
    font-weight: 700;
    margin-bottom: var(--sp-1);
    line-height: var(--leading-tight);
}

.card-title a {
    color: var(--color-text);
}

.card-title a:hover {
    color: var(--color-accent);
}

.card-excerpt {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-body);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

/* --- Badges / Status -------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px var(--sp-3);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.6;
}

.badge-default {
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
}

.badge-accent {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.badge-success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.badge-danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.badge-secondary {
    background: var(--color-secondary-soft);
    color: var(--color-secondary);
}

/* Colored dot badge for tags */
.badge-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Forms ------------------------------------------------------ */
.form-group {
    margin-bottom: var(--sp-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--sp-2);
    color: var(--color-text);
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 2px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--sp-1);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: var(--text-sm);
    transition: all var(--duration) var(--ease);
    line-height: var(--leading-ui);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-input.is-error,
.form-textarea.is-error {
    border-color: var(--color-danger);
}

.form-input.is-error:focus,
.form-textarea.is-error:focus {
    box-shadow: 0 0 0 3px var(--color-danger-soft);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-danger);
    margin-top: var(--sp-1);
    display: none;
}

.form-input.is-error~.form-error,
.form-textarea.is-error~.form-error {
    display: block;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    cursor: pointer;
    font-size: var(--text-sm);
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    appearance: none;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: grid;
    place-content: center;
    flex-shrink: 0;
    background: var(--color-surface);
}

.form-checkbox input[type="checkbox"]:checked {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.form-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

/* Multi-select chips */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    border: 1px solid transparent;
}

.chip:hover {
    background: var(--color-accent);
    color: #fff;
}

.chip.active {
    background: var(--color-accent);
    color: #fff;
}

.chip-remove {
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
}

.chip-remove:hover {
    opacity: 1;
}

/* --- Tables ----------------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

thead th {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

tbody td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--color-surface-alt);
}

.table-actions {
    display: flex;
    gap: var(--sp-2);
}

.table-thumb {
    width: 48px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-surface-alt);
}

/* --- Pagination ------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-1);
    margin-top: var(--sp-8);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: all var(--duration) var(--ease);
}

.pagination a:hover {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.pagination .active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.pagination a:active,
.filter-btn:active,
.pill-filter:active,
.chip:active {
    transform: scale(0.95);
}

/* --- Infinite feed ------------------------------------------------ */
.infinite-feed-wrap {
    margin-top: var(--sp-8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
}

.infinite-feed-status {
    margin: 0;
    text-align: center;
}

.infinite-feed-sentinel {
    width: 100%;
    height: 1px;
}

.infinite-feed-wrap.is-loading .infinite-feed-status {
    color: var(--color-text-muted);
}

.infinite-feed-wrap.is-complete .infinite-feed-status {
    opacity: 0.85;
}

/* --- Filter bar (chips) ----------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-bottom: var(--sp-6);
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-4);
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: all var(--duration) var(--ease);
}

.filter-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.filter-btn.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.category-icon-svg {
    width: 18px;
    height: 18px;
}

.category-icon-svg svg {
    width: 18px;
    height: 18px;
    display: block;
}

.category-icon-text {
    font-size: 16px;
    line-height: 1;
}

.category-name {
    line-height: 1.2;
}

/* --- Taxonomy hero header (stories / ai news / wallpapers) ------ */
.taxonomy-hero {
    display: flex;
    gap: var(--sp-6);
    align-items: stretch;
    margin-bottom: var(--sp-6);
}

.taxonomy-hero-left {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: var(--sp-4);
    overflow: hidden;
}

.taxonomy-hero-icon {
    width: 250px;
    height: 180px;
    margin: 0 auto var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.taxonomy-hero-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
}

.taxonomy-hero-title {
    margin: 0 0 var(--sp-2) 0;
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    line-height: 1.1;
}

.taxonomy-hero-subtitle {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    line-height: 1.4;
}

.taxonomy-hero-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: none;
    width: 100%;
}

.taxonomy-search-row {
    margin-bottom: var(--sp-3);
}

.taxonomy-search-form {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.taxonomy-search-form .form-input {
    flex: 1;
}

.taxonomy-search-result {
    margin-top: var(--sp-2);
    margin-bottom: 0;
}

.taxonomy-all-row {
    margin-bottom: var(--sp-3);
}

.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 364px), 364px));
    column-gap: var(--sp-3);
    row-gap: var(--sp-3);
    justify-content: center;
}

.taxonomy-grid .taxonomy-card.filter-btn {
    width: 100%;
    justify-self: stretch;
}

.taxonomy-card.filter-btn {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--sp-2);
    width: 100%;
    min-height: 50px;
    padding: var(--sp-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    position: relative;
    white-space: normal;
}

.taxonomy-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    line-height: 0;
}

.taxonomy-card-icon svg {
    width: 34px;
    height: 34px;
    display: block;
}

.taxonomy-card-icon-text {
    font-size: 20px;
    line-height: 1;
}

.taxonomy-card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.taxonomy-card-title {
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
}

.taxonomy-card-count {
    position: absolute;
    right: var(--sp-2);
    bottom: var(--sp-1);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.taxonomy-card.filter-btn.active {
    background: var(--color-accent-soft);
    color: var(--color-text);
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.08);
}

.taxonomy-card.filter-btn.active .taxonomy-card-count {
    color: var(--color-text-secondary);
}

@media (max-width: 1100px) {
    .taxonomy-hero-left {
        flex-basis: 320px;
    }
}

@media (max-width: 900px) {
    .taxonomy-hero {
        flex-direction: column;
    }

    .taxonomy-hero-left {
        flex: none;
        width: 100%;
    }

    .taxonomy-hero-right {
        max-width: none;
    }

    .taxonomy-hero-icon {
        width: 96px;
        height: 96px;
    }

    .taxonomy-grid {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    }
}

/* --- Modal ------------------------------------------------------ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    opacity: 0;
    visibility: hidden;
    transition: all 200ms var(--ease);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(16px) scale(0.97);
    transition: transform 200ms var(--ease);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--duration);
}

.modal-close:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.modal-body {
    padding: var(--sp-6);
}

.modal-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
}

/* --- Toast ------------------------------------------------------ */
.toast-container {
    position: fixed;
    top: var(--sp-4);
    right: var(--sp-4);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    pointer-events: none;
}

.toast {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 300ms var(--ease);
    transition: opacity 200ms;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.toast-success {
    background: var(--color-success);
}

.toast-error {
    background: var(--color-danger);
}

.toast-info {
    background: var(--color-accent);
}

.toast-warning {
    background: var(--color-warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Upload component ------------------------------------------- */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-10) var(--sp-6);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    position: relative;
    background: var(--color-surface);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.upload-zone-icon {
    font-size: 2rem;
    margin-bottom: var(--sp-3);
    color: var(--color-text-muted);
}

.upload-zone-text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.upload-zone-text strong {
    color: var(--color-accent);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-preview {
    margin-top: var(--sp-4);
    position: relative;
    display: inline-block;
}

.upload-preview img {
    max-height: 200px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.upload-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.upload-progress {
    height: 4px;
    background: var(--color-surface-alt);
    border-radius: 2px;
    margin-top: var(--sp-3);
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 2px;
    transition: width 200ms;
}

/* --- Empty state ------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: var(--sp-16) var(--sp-6);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--sp-4);
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--sp-2);
}

.empty-state-text {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Error state ------------------------------------------------ */
.error-state {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
}

.error-state-icon {
    font-size: 2.5rem;
    margin-bottom: var(--sp-3);
}

.error-state-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-danger);
    margin-bottom: var(--sp-2);
}

.error-state-text {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-4);
}

/* --- Loading skeleton ------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border) 50%, var(--color-surface-alt) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: shimmer 1.5s infinite;
    min-height: 16px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--sp-2);
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 20px;
    width: 70%;
    margin-bottom: var(--sp-3);
}

.skeleton-img {
    aspect-ratio: 16/9;
    border-radius: var(--radius-lg);
}

.skeleton-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

/* --- Dropdown --------------------------------------------------- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    min-width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--duration) var(--ease);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    cursor: pointer;
    color: var(--color-text);
    transition: background var(--duration);
}

.dropdown-item:hover {
    background: var(--color-surface-alt);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--sp-1) 0;
}

/* --- Stat card -------------------------------------------------- */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
}

.stat-card-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    margin-top: var(--sp-1);
    color: var(--color-text);
}

.stat-card-change {
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: var(--sp-1);
}

/* --- Sticky action bar ------------------------------------------ */
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--sp-4) var(--sp-6);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sp-3);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .04);
}

/* --- Avatar ----------------------------------------------------- */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-xs);
    flex-shrink: 0;
}

.avatar-sm {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.avatar-lg {
    width: 40px;
    height: 40px;
    font-size: var(--text-sm);
}

/* --- Spinner ---------------------------------------------------- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* ─── Reaction SVG icons ─── */
.reaction-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    flex-shrink: 0;
}

.reaction-like {
    color: #ef4444;
}

.reaction-fire {
    color: #f97316;
}

.reaction-useful {
    color: #eab308;
}

.reaction-views {
    color: #60a5fa;
}

.article-reactions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-3);
}

.article-action-btn,
.article-action-stat {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-ui);
}

.article-action-btn {
    cursor: pointer;
    transition: border-color var(--duration), color var(--duration), background var(--duration), transform var(--duration);
}

.article-action-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.article-action-btn:active {
    transform: scale(0.96);
}

.article-action-btn.liked,
.article-action-btn.active {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.article-action-stat {
    cursor: default;
}

.article-action-count {
    font-weight: 700;
    color: var(--color-text);
}

/* ─── Article with sticky share sidebar ─── */
.article-with-sidebar {
    display: flex;
    gap: var(--sp-6);
    align-items: flex-start;
    position: relative;
}

.article-with-sidebar>article {
    flex: 1;
    min-width: 0;
}

.share-sidebar {
    position: sticky;
    top: calc(var(--header-h, 64px) + 24px);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    align-self: flex-start;
    z-index: 10;
    padding-top: var(--sp-4);
}

.share-sidebar-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transition: border-color var(--duration), box-shadow var(--duration), transform var(--duration);
    text-decoration: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
}

.share-sidebar-btn:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-sm);
    transform: scale(1.1);
}

.share-sidebar-btn img {
    width: 20px;
    height: 20px;
}

.share-tg:hover {
    border-color: #0088cc;
}

.share-vk:hover {
    border-color: #4a76a8;
}

/* Mobile: hide sidebar, show inline share fallback */
.share-mobile-fallback {
    display: none;
}

@media (max-width: 1024px) {
    .share-sidebar {
        display: none;
    }

    .share-mobile-fallback {
        display: flex !important;
    }
}
