/* Feed Charm — Custom Styles */

/* ---- Design Tokens ---- */
:root {
    --fc-primary: #0F172A;
    --fc-secondary: #3B82F6;
    --fc-accent: #6366F1;
    --fc-accent-hover: #4F46E5;
    --fc-success: #10B981;
    --fc-danger: #EF4444;
    --fc-warning: #F59E0B;
    --fc-muted: #94A3B8;
    --fc-bg: #F8FAFC;
    --fc-card-bg: #FFFFFF;
    --fc-text: #0F172A;
    --fc-text-secondary: #64748B;
    --fc-override: #F59E0B;
    --fc-border: #E2E8F0;
    --fc-border-hover: #CBD5E1;
    --fc-radius: 8px;
    --fc-radius-lg: 12px;
    --fc-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --fc-shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --fc-shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --fc-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --fc-font-display: 'DM Sans', system-ui, sans-serif;
    --fc-font-body: 'Source Sans 3', system-ui, sans-serif;
    --fc-font-mono: 'JetBrains Mono', monospace;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --fc-primary: #E2E8F0;
    --fc-secondary: #60A5FA;
    --fc-accent: #818CF8;
    --fc-accent-hover: #6366F1;
    --fc-success: #34D399;
    --fc-danger: #F87171;
    --fc-warning: #FBBF24;
    --fc-muted: #64748B;
    --fc-bg: #0F172A;
    --fc-card-bg: #1E293B;
    --fc-text: #E2E8F0;
    --fc-text-secondary: #94A3B8;
    --fc-override: #FBBF24;
    --fc-border: #334155;
    --fc-border-hover: #475569;
    --fc-shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --fc-shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --fc-shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

/* ---- Theme toggle button ---- */
.theme-toggle {
    background: none;
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius);
    width: 34px;
    height: 34px;
    min-height: auto;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fc-muted);
    transition: all var(--fc-transition);
    vertical-align: middle;
}
.theme-toggle:hover {
    border-color: var(--fc-accent);
    color: var(--fc-accent);
    background: rgba(99, 102, 241, 0.06);
}
.theme-toggle svg {
    width: 18px;
    height: 18px;
}
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---- Typography ---- */
body {
    font-family: var(--fc-font-body);
    background: var(--fc-bg);
    color: var(--fc-text);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--fc-font-display);
}

code, .feed-card__source {
    font-family: var(--fc-font-mono);
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.page-header__left {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--fc-primary);
    margin-bottom: 0;
}
.page-counter {
    font-size: 0.9rem;
    color: var(--fc-muted);
    font-weight: 400;
    background: var(--fc-bg);
    border: 1px solid var(--fc-border);
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
}

/* ---- Primary / Secondary buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--fc-font-body);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--fc-radius);
    border: none;
    cursor: pointer;
    transition: all var(--fc-transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn--primary {
    background: var(--fc-accent);
    color: #fff;
}
.btn--primary:hover {
    background: var(--fc-accent-hover);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}
.btn--secondary {
    background: var(--fc-card-bg);
    color: var(--fc-text);
    border: 1px solid var(--fc-border);
}
.btn--secondary:hover {
    border-color: var(--fc-border-hover);
    background: var(--fc-bg);
}

/* ---- Icon buttons (feed cards) ---- */
.btn-icon {
    width: 34px;
    height: 34px;
    min-height: auto;
    padding: 0;
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius);
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fc-muted);
    transition: all var(--fc-transition);
}
.btn-icon:hover {
    border-color: var(--fc-secondary);
    color: var(--fc-secondary);
    background: rgba(59, 130, 246, 0.06);
}
.btn-icon--danger:hover {
    border-color: var(--fc-danger);
    color: var(--fc-danger);
    background: rgba(239, 68, 68, 0.06);
}
.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* ---- Feeds grid ---- */
.feeds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

/* ---- Feed card ---- */
.feed-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-lg);
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: border-color var(--fc-transition), box-shadow var(--fc-transition), transform var(--fc-transition);
    position: relative;
    display: flex;
    flex-direction: column;
    animation: cardAppear 0.4s ease both;
}
.feed-card:nth-child(1) { animation-delay: 0.05s; }
.feed-card:nth-child(2) { animation-delay: 0.1s; }
.feed-card:nth-child(3) { animation-delay: 0.15s; }
.feed-card:nth-child(4) { animation-delay: 0.2s; }
.feed-card:nth-child(5) { animation-delay: 0.25s; }
.feed-card:nth-child(6) { animation-delay: 0.3s; }

.feed-card:hover {
    border-color: var(--fc-secondary);
    box-shadow: var(--fc-shadow-md);
    transform: translateY(-2px);
}

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

.feed-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
}
.feed-card__name {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--fc-primary);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}
.status-dot--active {
    background: var(--fc-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.status-dot--inactive {
    background: var(--fc-muted);
    opacity: 0.5;
}

.feed-card__meta {
    margin-bottom: 1rem;
    min-height: 1.2rem;
}
.feed-card__source {
    font-family: var(--fc-font-mono);
    font-size: 0.72rem;
    color: var(--fc-muted);
    background: none;
    padding: 0;
    word-break: break-all;
    line-height: 1.4;
}
.feed-card__badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 4px;
}
.feed-card__badge--sub {
    background: rgba(99, 102, 241, 0.1);
    color: var(--fc-accent);
}

.feed-card__stats {
    display: flex;
    gap: 0;
    padding: 0.85rem 0;
    border-top: 1px solid var(--fc-border);
    margin-bottom: 0.5rem;
    flex: 1;
}
.stat {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
    position: relative;
}
.stat + .stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--fc-border);
}
.stat__value {
    font-family: var(--fc-font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fc-primary);
    line-height: 1.2;
}
.stat__value--warning {
    color: var(--fc-warning);
}
.stat__value--mono {
    font-family: var(--fc-font-mono);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--fc-text-secondary);
}
.stat__value--empty {
    color: var(--fc-muted);
    font-size: 1rem;
}
.stat__label {
    font-size: 0.68rem;
    color: var(--fc-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    margin-top: 0.15rem;
}

.feed-card__actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

/* ---- Create feed modal (dialog) ---- */
/* Pico CSS делает dialog полноэкранным оверлеем, article внутри — окно модала */
dialog.feed-modal {
    background-color: rgba(15, 23, 42, 0.5) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    backdrop-filter: blur(4px) !important;
}
dialog.feed-modal > article {
    max-width: 480px !important;
    width: 100% !important;
    background: var(--fc-card-bg) !important;
    border-radius: var(--fc-radius-lg) !important;
    box-shadow: var(--fc-shadow-lg) !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}
.modal__header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--fc-border);
    position: relative;
}
.modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}
.modal__close {
    position: absolute !important;
    top: 1rem;
    right: 1rem;
}
.modal__close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--fc-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--fc-radius);
    transition: all var(--fc-transition);
    min-height: auto;
    padding: 0;
}
.modal__close:hover {
    background: var(--fc-bg);
    color: var(--fc-primary);
}
.modal__body {
    padding: 1.5rem;
}
.modal__footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--fc-border);
    background: var(--fc-bg);
    border-radius: 0 0 var(--fc-radius-lg) var(--fc-radius-lg);
}

.form-group {
    margin-bottom: 1.25rem;
}
.form-group:last-child {
    margin-bottom: 0;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fc-primary);
    margin-bottom: 0.4rem;
}
.form-hint {
    font-size: 0.78rem;
    color: var(--fc-muted);
    margin-top: 0.3rem;
}
.form-input,
.form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-family: var(--fc-font-body);
    font-size: 0.9rem;
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius);
    background: var(--fc-card-bg);
    color: var(--fc-text);
    transition: border-color var(--fc-transition), box-shadow var(--fc-transition);
    outline: none;
}
.form-input:focus,
.form-select:focus {
    border-color: var(--fc-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.form-input::placeholder {
    color: var(--fc-muted);
}

/* ---- Empty state (feeds) ---- */
.empty-state {
    text-align: center !important;
    padding: 5rem 2rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--fc-muted);
}
.empty-state__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--fc-bg);
    border: 2px dashed var(--fc-border);
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--fc-muted);
}
.empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fc-primary);
    margin-bottom: 0.5rem;
    text-align: center !important;
}
.empty-state__text {
    font-size: 0.95rem;
    color: var(--fc-text-secondary);
    margin-bottom: 2rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    text-align: center !important;
}

/* ---- Responsive: feeds page ---- */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .feeds-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Global Transitions ---- */
a, button, .small-btn, tr, .image-card, .override-dot {
    transition: all var(--fc-transition);
}

/* ---- Thumbnail images in table ---- */
.thumb {
    width: 160px;
    min-width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: var(--fc-radius);
    cursor: pointer;
}

/* ---- Row hover ---- */
#offers-table tbody tr {
    cursor: default;
    transition: background-color var(--fc-transition);
}

#offers-table tbody tr:hover {
    background-color: rgba(30, 64, 175, 0.04);
}

/* ---- Override indicators ---- */
.overridden {
    border-left: 3px solid var(--fc-override) !important;
    padding-left: 8px;
}

.override-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--fc-secondary);
}

.override-badge {
    background: var(--fc-override);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.override-label {
    color: var(--fc-override);
    font-weight: 600;
}

.reset-link {
    color: var(--fc-danger);
    font-size: 0.8em;
    margin-left: 8px;
    cursor: pointer;
}

.reset-link:hover {
    text-decoration: underline;
}

/* ---- Availability badges ---- */
.avail-yes {
    color: var(--fc-success);
    font-weight: 600;
}

.avail-no {
    color: var(--fc-danger);
    font-weight: 600;
}

/* ---- Status badges ---- */
.status-active {
    color: var(--fc-success);
    font-weight: 600;
}

.status-inactive {
    color: var(--fc-muted);
}

/* ---- Buttons ---- */
.small-btn {
    padding: 6px 12px !important;
    font-size: 0.8em !important;
    margin: 2px !important;
    min-height: 32px;
    cursor: pointer;
}

.small-btn:hover {
    opacity: 0.85;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

button[aria-busy="true"] {
    opacity: 0.6;
    pointer-events: none;
}

/* ---- Edit form ---- */
.edit-fields {
    display: grid;
    gap: 16px;
}

.edit-section-title {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--fc-primary);
    margin-top: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(30, 64, 175, 0.15);
}

.field-overridden {
    background: rgba(245, 158, 11, 0.06);
    padding: 10px;
    border-radius: var(--fc-radius);
    border-left: 3px solid var(--fc-override);
}

/* ---- Images grid ---- */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.image-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.image-card:hover {
    border-color: var(--fc-secondary);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.08);
}

.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: var(--fc-radius);
    margin-bottom: 8px;
}

.image-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 8px;
}

.image-url-input {
    font-size: 0.75em !important;
    padding: 4px !important;
}

/* ---- Pagination ---- */
.pagination-controls {
    text-align: center;
    margin-top: 16px;
}

.pagination-controls nav ul {
    display: flex;
    justify-content: center;
    gap: 4px;
    list-style: none;
    padding: 0;
}

.pagination-controls nav ul li a {
    padding: 6px 12px;
    border-radius: var(--fc-radius);
    cursor: pointer;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-controls nav ul li a:hover {
    background: rgba(30, 64, 175, 0.08);
}

.pagination-controls nav ul li a.active {
    background: var(--fc-primary);
    color: white;
}

/* ---- Toast notifications ---- */
/* ---- Модалки без размытия фона ---- */
dialog::backdrop,
dialog[open]::backdrop,
#photo-add-dialog::backdrop,
#video-add-dialog::backdrop,
#tag-dialog::backdrop,
#edit-dialog::backdrop,
#images-dialog::backdrop,
#subfeed-dialog::backdrop,
#photo-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
dialog[open] {
    z-index: 10000;
}
/* Pico CSS override */
:where(dialog) {
    backdrop-filter: none !important;
}

#toast-container,
.toast-container-inner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

#toast-container .toast,
.toast-container-inner .toast {
    pointer-events: auto;
}

.toast {
    padding: 12px 40px 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 0.9em;
    animation: slideIn 0.3s ease;
    max-width: 420px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast .toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    min-height: auto;
}

.toast .toast-close:hover {
    opacity: 1;
}

.toast.success {
    background: var(--fc-success);
}

.toast.error {
    background: var(--fc-danger);
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }
    .toast.fade-out {
        animation: none;
        opacity: 0;
    }
    a, button, .small-btn, tr, .image-card, .override-dot {
        transition: none;
    }
}

/* ---- Table responsiveness ---- */
figure {
    overflow-x: auto;
}

/* (старый empty-state удалён — стили выше) */

/* ---- Params in edit ---- */
.params-list {
    display: grid;
    gap: 4px;
}

.param-row {
    padding: 6px 10px;
    background: var(--pico-card-background-color);
    border-radius: var(--fc-radius);
    font-size: 0.9em;
}

/* ---- Loading spinner ---- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Footer ---- */
footer {
    margin-top: 40px;
    padding-bottom: 20px;
}

/* ---- Adaptive layout ---- */
main#main-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

footer#main-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (min-width: 1400px) {
    main#main-content {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 2560px) {
    main#main-content {
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

/* ---- Source picture cell (оригинальное фото) ---- */
.source-pic-cell {
    position: relative;
    display: inline-block;
}
.source-pic-cell.pic-deleted::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(220, 38, 38, 0.3);
    border-radius: var(--fc-radius);
    pointer-events: none;
}

.pic-trash-btn {
    display: none;
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    min-height: auto;
    padding: 0;
    border: 1px solid var(--pico-muted-border-color, #ccc);
    border-radius: 4px;
    background: rgba(255,255,255,0.9);
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
}
.pic-trash-btn.active {
    background: var(--fc-danger);
    color: white;
    border-color: var(--fc-danger);
}
.source-pic-cell:hover .pic-trash-btn { display: block; }

/* ---- New picture cell (загруженное фото) ---- */
.new-pic-cell {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.thumb-new {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: var(--fc-radius);
    cursor: pointer;
}

.pic-delete-btn {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    min-height: auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    color: white;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
}
.pic-replace-btn {
    display: none;
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    min-height: auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.85);
    color: white;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
}
.new-pic-cell:hover .pic-delete-btn,
.new-pic-cell:hover .pic-replace-btn { display: block; }

/* ---- Upload placeholder ---- */
.new-pic-upload {
    width: 160px;
    height: 160px;
    border: 2px dashed var(--pico-muted-border-color, #ccc);
    border-radius: var(--fc-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--fc-transition);
}
.new-pic-upload:hover {
    border-color: var(--fc-secondary);
}
.upload-placeholder {
    font-size: 2em;
    color: var(--fc-muted);
    line-height: 1;
}

.video-name {
    font-size: 0.75em;
    color: var(--fc-muted);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* ---- Resizable column headers ---- */
th.resizable {
    position: relative;
    overflow: visible;
}

th.resizable .col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    background: transparent;
    z-index: 1;
}

th.resizable .col-resizer:hover,
th.resizable .col-resizer.dragging {
    background: var(--fc-secondary);
    opacity: 0.5;
}

/* ---- Inline editable inputs in table ---- */
.inline-input {
    width: 100%;
    padding: 2px 4px;
    font-size: 0.8em;
    margin: 0;
    min-width: 80px;
}

/* ---- Draggable column headers: cursor только на .drag-handle ---- */
.drag-handle {
    cursor: grab;
    opacity: 0.35;
    font-size: 0.85em;
    user-select: none;
    display: inline-block;
    margin-right: 2px;
}
.drag-handle:hover { opacity: 0.85; }
.drag-handle:active { cursor: grabbing; }

/* ---- Photo hover preview ---- */
.thumb-wrap {
    position: relative;
    display: inline-block;
}
.thumb-hover {
    display: none;
    position: absolute;
    top: 100%;
    margin-top: 4px;
    left: 0;
    width: auto;
    height: auto;
    max-width: 320px;
    max-height: 320px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 200;
    background: white;
    pointer-events: none;
}
.thumb-wrap:hover .thumb-hover { display: block; }
.no-photo { opacity: 0.4; }

/* ---- URL cell ---- */
.url-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 100px;
}
.url-link {
    font-size: 1.1em;
    text-decoration: none;
    flex-shrink: 0;
    opacity: 0.6;
}
.url-link:hover { opacity: 1; }

/* ---- Filters row ---- */
.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    padding-bottom: 0.5rem;
}
.filters-row label {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 260px;
    margin-bottom: 0;
}

/* ---- Table toolbar ---- */
.table-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}
.col-visibility-wrapper {
    position: relative;
}
.col-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--pico-card-background-color, #fff);
    border: 1px solid var(--pico-muted-border-color, #ddd);
    border-radius: var(--fc-radius);
    padding: 8px 12px;
    z-index: 300;
    min-width: 180px;
    max-height: 420px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.col-panel-title {
    font-weight: 600;
    font-size: 0.82em;
    color: var(--fc-muted);
    padding-bottom: 5px;
    border-bottom: 1px solid var(--pico-muted-border-color, #ddd);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.col-panel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 0.9em;
    cursor: pointer;
    margin-bottom: 0;
}

/* ---- Icon buttons (replace/delete in cells) ---- */
.icon-btn {
    background: none;
    border: 1px solid var(--pico-muted-border-color, #ccc);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 1em;
    line-height: 1.4;
    min-height: auto;
}
.icon-btn:hover {
    background: rgba(0,0,0,0.05);
}
.icon-btn.danger {
    border-color: var(--fc-danger);
}

/* ---- Column dropdown ---- */
.col-dropdown-wrapper {
    position: relative;
    display: inline-block;
}
.col-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    background: var(--pico-card-background-color, #fff);
    border: 1px solid var(--pico-muted-border-color, #ddd);
    border-radius: var(--fc-radius);
    padding: 8px 12px;
    z-index: 300;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    white-space: nowrap;
}

/* ---- Column visibility panel inside dropdown ---- */
.col-panel-inline {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}

/* ---- Тултип-подсказка в заголовке столбца ---- */
.col-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--fc-muted);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    margin-left: 3px;
    flex-shrink: 0;
}
.hint-bubble {
    position: fixed;
    background: #1E293B;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: 240px;
    z-index: 10000;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
}

/* ---- Красный текст сверх лимита ---- */
.text-overlimit {
    color: var(--fc-danger);
}

/* ---- Красная рамка input при превышении лимита ---- */
.inline-input.input-overlimit {
    border-color: var(--fc-danger) !important;
}

/* ---- Счётчик символов под input ---- */
.char-counter {
    font-size: 10px;
    color: var(--fc-muted);
    margin-top: 1px;
    line-height: 1;
}
.char-counter.over {
    color: var(--fc-danger);
    font-weight: 600;
}

/* ============================================
   REDESIGN v2 — Feed Detail Page
   ============================================ */

/* ---- Header stats ---- */
.stat-badges {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--fc-font-body);
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-border);
}
.stat-badge--warning {
    background: #FFFBEB;
    border-color: var(--fc-warning);
}
.stat-badge .stat-label {
    color: var(--fc-text-secondary);
    font-weight: 500;
}
.stat-badge .stat-value {
    color: var(--fc-text);
    font-weight: 700;
}
.stat-badge .stat-icon {
    width: 14px;
    height: 14px;
}

/* ---- Action buttons row ---- */
.actions-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.action-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: var(--fc-radius);
    background: var(--fc-accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all var(--fc-transition);
}
.action-primary:hover {
    background: var(--fc-accent-hover);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.action-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: var(--fc-radius);
    background: transparent;
    color: var(--fc-text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid var(--fc-border);
    cursor: pointer;
    transition: all var(--fc-transition);
}
.action-outline:hover {
    border-color: var(--fc-accent);
    color: var(--fc-accent);
}
.action-template {
    background: #EEF2FF;
    border-color: var(--fc-accent);
    color: var(--fc-accent);
    font-weight: 600;
}

/* ---- Tags filter row ---- */
.tags-filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.tags-filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fc-text-secondary);
}
.tag-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--fc-border);
    background: transparent;
    color: var(--fc-text-secondary);
    cursor: pointer;
    transition: all var(--fc-transition);
}
.tag-filter-pill:hover {
    border-color: var(--fc-accent);
    color: var(--fc-accent);
}
.tag-filter-pill.active {
    background: var(--fc-accent);
    border-color: var(--fc-accent);
    color: #fff;
    font-weight: 600;
}
.tag-filter-pill .tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.tag-filter-pill .tag-count {
    font-size: 0.7rem;
    opacity: 0.7;
}
.tag-filter-add {
    border-style: dashed;
    color: var(--fc-muted);
}
.tag-filter-add:hover {
    border-color: var(--fc-accent);
    color: var(--fc-accent);
}
.tag-delete-btn {
    display: none;
    margin-left: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--fc-danger);
    cursor: pointer;
    line-height: 1;
}
.tag-filter-pill:hover .tag-delete-btn {
    display: inline;
}

/* ---- Tag badges in table ---- */
.col-tags {
    text-align: center;
}
.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    margin-right: 3px;
}

/* ---- Status badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-modified {
    background: #EEF2FF;
    color: var(--fc-accent);
}
.status-original {
    background: #ECFDF5;
    color: var(--fc-success);
}
.status-hidden {
    background: #FEF2F2;
    color: var(--fc-danger);
}

/* ---- Action buttons in table ---- */
.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}
.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--fc-transition);
    color: var(--fc-muted);
    padding: 0;
}
.act-btn:hover {
    background: var(--fc-bg);
    color: var(--fc-text);
}
.act-btn svg {
    width: 15px;
    height: 15px;
}
.act-btn--reset {
    background: #FEF2F2;
    color: var(--fc-danger);
}
.act-btn--reset:hover {
    background: #FEE2E2;
}
.act-btn--hide-active {
    background: #FEF2F2;
    color: var(--fc-danger);
}
.act-btn--hide-active:hover {
    background: #FEE2E2;
}
.act-btn--placeholder {
    visibility: hidden;
}

/* ---- Hidden row ---- */
#offers-table tbody tr.row-hidden {
    opacity: 0.5;
}
#offers-table tbody tr.row-hidden:hover {
    opacity: 0.7;
}

/* ---- Filters card ---- */
.filters-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-lg);
    padding: 16px 20px;
    margin-bottom: 0;
}
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.filters-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fc-text);
}
.filters-title svg {
    width: 16px;
    height: 16px;
    color: var(--fc-accent);
}

/* ---- Table wrapper ---- */
.table-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius-lg);
    overflow: hidden;
}
.table-card table {
    margin-bottom: 0;
}
.table-card thead th {
    background: var(--fc-bg);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fc-text-secondary);
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--fc-border);
    padding: 10px 8px;
    white-space: nowrap;
}
.table-card tbody td {
    padding: 8px;
    font-size: 0.8rem;
    vertical-align: middle;
}
.table-card tbody tr {
    border-bottom: 1px solid var(--fc-border);
    transition: opacity var(--fc-transition);
}
.table-card tbody tr:last-child {
    border-bottom: none;
}

/* ---- Pagination redesign ---- */
.pagination-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--fc-border);
}
.pagination-v2 .page-info {
    font-size: 0.8rem;
    color: var(--fc-muted);
}
.pagination-v2 .page-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}
.pagination-v2 .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--fc-text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--fc-transition);
}
.pagination-v2 .page-btn:hover {
    background: var(--fc-bg);
}
.pagination-v2 .page-btn.active {
    background: var(--fc-accent);
    color: #fff;
    font-weight: 600;
}
.pagination-v2 .page-btn--nav {
    border: 1px solid var(--fc-border);
}

/* ---- Create tag modal ---- */
.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--fc-transition);
}
.color-option:hover,
.color-option.selected {
    border-color: var(--fc-text);
    transform: scale(1.15);
}

/* ---- Source URL monospace ---- */
.source-url {
    font-family: var(--fc-font-mono);
    font-size: 0.75rem;
    color: var(--fc-muted);
}

/* ---- Header top row ---- */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--fc-radius);
    border: 1px solid var(--fc-border);
    color: var(--fc-text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--fc-transition);
}
.back-link:hover {
    border-color: var(--fc-accent);
    color: var(--fc-accent);
}
.back-link svg {
    width: 16px;
    height: 16px;
}

/* ---- Thumb photo in table ---- */
.offer-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
}
