/* ═══════════════ ADMIN PRODUCTS GRID ═══════════════ */
.admin-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    width: 100%;
    min-width: 0;
}
.admin-product-card {
    background: var(--bg-surface);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    contain: layout style;
}
.admin-product-card:hover {
    border-color: var(--border);
    transform: translateY(-2px);
}
.admin-product-card.hidden { border-color: var(--yellow); }
.admin-product-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: var(--bg-input);
    margin-bottom: 16px;
}
.admin-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-badge-popular {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(var(--accent-rgb), 0.9);
    color: var(--white-on-accent);
    padding: 5px 13px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.admin-badge-hidden {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--overlay-modal);
    color: var(--yellow);
    padding: 5px 13px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.admin-card-topbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
    align-items: flex-end;
}
.admin-card-topbar .admin-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: var(--overlay-backdrop);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--white-on-accent);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.admin-card-topbar .admin-card-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
}
.admin-card-topbar .admin-card-btn:hover {
    background: var(--overlay-modal);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.admin-card-topbar .admin-card-btn-toggle:hover,
.admin-card-topbar .admin-card-btn-delete:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white-on-accent);
}

.admin-product-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.admin-product-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    min-width: 0;
}
.admin-product-title-row .admin-product-title {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}
.admin-hidden-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(245, 124, 0, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(245, 124, 0, 0.3);
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    line-height: 1.4;
    margin-top: 2px;
}

.admin-product-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: var(--fw-medium);
    margin-bottom: 6px;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
    color: var(--text-main);
}
.admin-product-category {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-product-price-block {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.admin-current-price {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: var(--fw-semibold);
    color: var(--text-main);
}
.admin-old-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 15px;
}

.admin-product-actions {
    display: flex;
    margin-top: auto;
    padding-top: 4px;
}
.admin-product-actions .btn-edit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 14px;
    border-radius: var(--radius-pill);
}
.admin-product-actions .btn-edit svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
}

/* ═══════════════ CATALOG LAYOUT (filters) ═══════════════ */
.admin-catalog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}
.admin-catalog-main {
    min-width: 0;
    width: 100%;
}
.admin-catalog-controls {
    position: sticky;
    top: 90px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}
.admin-catalog-controls::-webkit-scrollbar { width: 4px; }
.admin-catalog-controls::-webkit-scrollbar-track { background: transparent; }
.admin-catalog-controls::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.admin-catalog-controls::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.filters-title {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0;
}

.sort-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}
.sort-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.sort-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A9A9A' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}
.sort-select:hover { border-color: var(--text-muted); }
.sort-select:focus { border-color: var(--accent); }
.sort-select option { background: var(--bg-surface); color: var(--text-main); }

.search-wrapper-sidebar {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}
.search-wrapper-sidebar svg {
    position: absolute;
    left: 12px;
    width: 15px;
    height: 15px;
    stroke: var(--text-muted);
    fill: none;
    z-index: 1;
}
.search-input-sidebar {
    width: 100%;
    padding: 9px 16px 9px 38px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
    box-sizing: border-box;
}
.search-input-sidebar:focus { border-color: var(--accent); }

.btn-reset-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}
.btn-reset-filters:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}
.btn-reset-filters:active { transform: scale(0.98); }
.btn-reset-filters svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
}

.price-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.price-presets button {
    padding: 5px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: var(--transition);
}
.price-presets button:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

.controls-top-row { display: flex; flex-direction: column; gap: 15px; }
.price-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
    flex-wrap: nowrap;
}
.price-filter .price-label,
.price-filter .price-dash,
.price-filter .price-currency {
    flex-shrink: 0;
    font-size: 15px;
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}
.price-input {
    min-width: 0;
    flex: 1 1 0;
    width: auto;
    max-width: 56px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    text-align: center;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-input::placeholder { color: var(--text-muted); font-weight: 400; font-size: 13px; }

.filter-section { padding-top: 12px; border-top: 1px solid var(--border); }
.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    padding: 9px 0;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-group-header svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}
.filter-group-header.active svg { transform: rotate(180deg); }
.filter-group-content {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding-top: 8px;
}
.filter-group-content.active { display: flex; animation: fadeIn 0.3s ease; }

.filter-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 3px 0;
    line-height: 1.5;
}
.filter-checkbox:hover { color: var(--text-main); }
.filter-checkbox input[type="checkbox"] { display: none; }
.checkmark {
    width: 19px;
    height: 19px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 1px;
}
.filter-checkbox input:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}
.filter-checkbox input:checked + .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--white-on-accent);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}
.filter-checkbox input:checked ~ span { color: var(--text-main); }

.subcategories {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-left: 20px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.color-checkbox { display: flex; align-items: center; gap: 11px; }
.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    margin-top: 1px;
}
.filter-checkbox input:checked + .color-swatch {
    border-color: var(--text-main);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
}
.filter-checkbox input:checked + .color-swatch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 5px;
    height: 9px;
    border: solid var(--text-main);
    border-width: 0 2px 2px 0;
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.5));
}

.hashtag-filter-section {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
#admin-hashtags-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    align-items: flex-start;
}
#admin-hashtags-list .hashtag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 6px 11px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}
#admin-hashtags-list .hashtag-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    background: rgba(var(--accent-rgb), 0.06);
}
#admin-hashtags-list .hashtag-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white-on-accent);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
    transform: translateY(0);
}
#admin-hashtags-list .hashtag-chip-hash {
    color: var(--accent);
    font-weight: 700;
    opacity: 0.9;
}
#admin-hashtags-list .hashtag-chip.active .hashtag-chip-hash {
    color: var(--white-on-accent);
    opacity: 1;
}
#admin-hashtags-list .hashtag-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 3px 7px;
    margin-left: 4px;
    min-width: 20px;
    height: 18px;
    border-radius: 100px;
    background: var(--skeleton-base);
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
}
#admin-hashtags-list .hashtag-chip:hover .hashtag-chip-count {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
}
#admin-hashtags-list .hashtag-chip.active .hashtag-chip-count {
    background: rgba(255, 255, 255, 0.22);
    color: var(--white-on-accent);
}

.admin-mobile-filter-btn { display: none; }
.admin-mobile-filter-overlay { display: none; }
.mobile-filter-close { display: none; }
.mobile-filter-apply { display: none; }

@media (max-width: 992px) {
    .admin-layout,
    .admin-main,
    #tab-products,
    #products-list-view {
        overflow: visible !important;
    }

    .admin-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        width: 100%;
    }
    .admin-catalog-layout { grid-template-columns: 1fr; }

    .admin-mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        z-index: 90;
        width: auto;
        max-width: calc(100vw - 32px);
        padding: 13px 22px;
        background: var(--accent);
        backdrop-filter: blur(16px) saturate(180%);
        -webkit-backdrop-filter: blur(16px) saturate(180%);
        color: var(--white-on-accent);
        border: 1px solid var(--accent);
        border-radius: var(--radius-pill);
        font-family: var(--font-body);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.03em;
        box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.5), 0 4px 12px rgba(0, 0, 0, 0.4) !important;
        cursor: pointer;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
        transition: background 0.2s, border-color 0.2s, color 0.2s;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        margin: 0;
    }
    .admin-mobile-filter-btn:hover,
    .admin-mobile-filter-btn:active {
        background: var(--accent-hover);
        border-color: var(--accent-hover);
        color: var(--white-on-accent);
    }
    .admin-mobile-filter-btn svg {
        width: 18px;
        height: 18px;
        stroke-width: 2;
        flex-shrink: 0;
        pointer-events: none;
    }
    .admin-mobile-filter-btn span { white-space: nowrap; }

    .admin-mobile-filter-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: var(--overlay-backdrop);
        backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .admin-mobile-filter-overlay.active { opacity: 1; visibility: visible; }

    .admin-catalog-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-height: 88vh;
        overflow-y: auto;
        padding: 0 16px 30px;
        background: var(--bg-surface);
        border: none;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 40px var(--shadow-strong);
        z-index: 1000;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    }
    .admin-catalog-controls.active { transform: translateY(0); }

.filters-mobile-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    z-index: 10;
    padding: 24px 16px 12px;
    margin: 0 -16px 16px;
    border-radius: 24px 24px 0 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}
.filters-mobile-header:active {
    cursor: grabbing;
}

    .filters-mobile-header::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 6px;
        background: var(--border);
        border-radius: 3px;
    }

    .filters-title {
        margin: 0;
        font-size: 18px;
    }

    .mobile-filter-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: var(--bg-input);
        border: 1px solid var(--border);
        border-radius: 50%;
        color: var(--text-main);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }
    .mobile-filter-close:active { background: var(--bg-body); }

    .mobile-filter-apply {
        display: block;
        width: 100%;
        padding: 16px;
        margin-top: 20px;
        background: var(--accent);
        color: var(--white-on-accent);
        border: none;
        border-radius: var(--radius-pill);
        font-family: var(--font-body);
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        position: sticky;
        bottom: 0;
        transition: background 0.2s;
    }
    .mobile-filter-apply:active { background: var(--accent-hover); }
}

@media (max-width: 768px) {
    .admin-products-grid { grid-template-columns: 1fr; gap: 16px; width: 100%; }
    .admin-product-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .admin-product-actions { display: flex; }
    .admin-product-actions .btn-action { width: 100%; }
    .admin-products-grid { min-width: 0; max-width: 100%; box-sizing: border-box; }

    .admin-card-topbar {
        top: 6px;
        right: 6px;
        gap: 4px;
    }
    .admin-card-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    .admin-card-btn svg {
        width: 12px;
        height: 12px;
    }
}