/* Aimart-Inspired Modern Dark UI */
:root {
    --bg-color: #0A0A0A;
    --surface-color: #141416;
    --surface-light: #23262F;
    --primary-color: #6C5DD3;
    /* Vibrant Purple */
    --primary-hover: #5A4AD1;
    --secondary-color: #3DE0A8;
    /* Cyan/Teal Accent */
    --text-color: #FCFCFD;
    --text-secondary: #777E90;
    --border-color: #353945;
    --success-color: #45B26B;
    --danger-color: #FF5757;
    --warning-color: #FFD166;
    --card-radius: 20px;
    --button-radius: 12px;
    --input-radius: 12px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

.hidden-media {
    display: none !important;
}


body {
    margin: 0;
    font-family: 'Urbanist', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background-color: rgba(20, 20, 22, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #FCFCFD 0%, #777E90 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.header nav {
    display: flex;
    gap: 24px;
}

.header a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    padding-bottom: 4px;
}

.header a:hover,
.header a.active {
    color: var(--text-color);
}

.header a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Controls Section */
.search-bar {
    display: flex;
    gap: 16px;
    margin: 32px 0;
    flex-wrap: wrap;
    align-items: center;
    background: var(--surface-color);
    padding: 16px;
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
}

.search-bar input,
.search-bar select {
    background-color: var(--surface-light);
    border: 1px solid transparent;
    color: var(--text-color);
    padding: 12px 16px;
    border-radius: var(--input-radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.search-bar input {
    flex-grow: 1;
    min-width: 200px;
}

.search-bar input:focus,
.search-bar select:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-color);
}

.search-bar button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--button-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.search-bar button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 93, 211, 0.4);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding-bottom: 40px;
}

.product-card {
    background-color: var(--surface-color);
    border-radius: 20px;
    /* More rounded */
    border: none;
    /* Clean look */
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    /* For when card is anchor */
    color: inherit;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    background-color: #1a1d21;
    /* Slightly lighter on hover */
}

.product-image {
    width: 100%;
    height: 240px;
    /* Taller */
    object-fit: cover;
    background-color: var(--surface-light);
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.03);
}

.img-container {
    overflow: hidden;
    height: 240px;
    position: relative;
    background-color: #23262F;
    /* Dark background for image transparency */
}

/* Collage Grid for Articles */
.collage-grid {
    display: grid;
    gap: 2px;
    width: 100%;
    height: 100%;
}

.collage-grid.count-2 {
    grid-template-columns: 1fr 1fr;
}

.collage-grid.count-3 {
    grid-template-areas: "a b" "a c";
    grid-template-columns: 2fr 1fr;
}

.collage-grid.count-3>*:nth-child(1) {
    grid-area: a;
}

.collage-grid.count-3>*:nth-child(2) {
    grid-area: b;
}

.collage-grid.count-3>*:nth-child(3) {
    grid-area: c;
}

.collage-grid.count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.collage-grid.count-5 {
    grid-template-areas: "a b c" "a d e";
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.collage-grid.count-5>*:nth-child(1) {
    grid-area: a;
}

.collage-grid.count-5>*:nth-child(2) {
    grid-area: b;
}

.collage-grid.count-5>*:nth-child(3) {
    grid-area: c;
}

.collage-grid.count-5>*:nth-child(4) {
    grid-area: d;
}

.collage-grid.count-5>*:nth-child(5) {
    grid-area: e;
}

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

.collage-more {
    position: relative;
    width: 100%;
    height: 100%;
}

.collage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    z-index: 1;
    background-color: inherit;
}

/* Typography Hierarchy Update */
.product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-color);
    /* White price per design */
    margin-bottom: 4px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

.product-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

/* Badge and Heart on Image */
.card-actions {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2;
}

.badge-new {
    background-color: #000;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.heart-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    /* White circle */
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: #000;
    font-size: 14px;
}

.heart-btn:hover {
    transform: scale(1.1);
}

.feedback-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: #000;
    font-size: 14px;
    margin-left: 8px;
}

.feedback-btn:hover {
    transform: scale(1.1);
}

.feedback-btn.good:hover,
.feedback-btn.good.active {
    background-color: var(--success-color);
    color: white;
}

.feedback-btn.bad:hover,
.feedback-btn.bad.active {
    background-color: var(--danger-color);
    color: white;
}

/* Hide old elements if needed */
.view-details {
    display: none;
    /* Design doesn't show button */
}

.job-error-msg {
    font-size: 0.75rem;
    color: var(--danger-color);
    margin-top: 4px;
    padding: 6px 10px;
    background: rgba(255, 73, 117, 0.05);
    border: 1px dashed rgba(255, 73, 117, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.job-error-msg:hover {
    background: rgba(255, 73, 117, 0.1);
    border-color: rgba(255, 73, 117, 0.4);
}

.job-error-msg::after {
    content: '\f0c5';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.job-error-msg:hover::after {
    opacity: 0.5;
}

.job-error-msg.copied {
    background: rgba(4, 209, 130, 0.1) !important;
    color: var(--success-color) !important;
    border-color: var(--success-color) !important;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.mobile-layout .pagination {
    display: none !important;
}

#infiniteLoader {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination button {
    background-color: var(--surface-light);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--button-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pageInfo {
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    padding: 0 12px;
    min-width: 120px;
    justify-content: center;
}

/* Modal */
.modal {
    background-color: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(8px);
    display: none;
    /* Hidden by default */
    align-items: center;
    /* Centering */
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    outline: none;
}

.modal.visible {
    opacity: 1;
}

.modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    max-width: 550px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    /* Header stays, list scrolls */
}

.stores-list {
    overflow-y: auto;
    padding-right: 8px;
    /* Space for scrollbar */
    margin-right: -8px;
}

/* Custom Scrollbar for Premium Look */
.stores-list::-webkit-scrollbar {
    width: 6px;
}

.stores-list::-webkit-scrollbar-track {
    background: transparent;
}

.stores-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.stores-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.close {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    z-index: 10;
}

.close:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
}

/* My Stores Card Styling */
.stores-list h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 24px 0 16px;
}

.store-item {
    background-color: var(--surface-light);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.store-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.store-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.store-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--surface-light);
    border: 2px solid var(--border-color);
}

.store-title-area {
    display: flex;
    flex-direction: column;
}

.store-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.store-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.store-meta-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.store-stats-badge {
    background: var(--surface-light);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-color);
}

.store-last-sync {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    opacity: 0.8;
}

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

.store-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.store-form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.store-form-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 100px;
}

.store-form-row select,
.store-form-row input {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    flex: 1;
}

.store-form-row input {
    cursor: text;
}

.store-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn i {
    font-size: 0.9rem;
}

.action-btn.archive-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.action-btn.delete-btn {
    background: rgba(255, 107, 107, 0.1);
    color: #FF6B6B;
}

/* Archived specific */
.store-item.archived {
    opacity: 0.7;
    background-color: transparent;
}


/* Form Card (Add Store Page) */
.form-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    max-width: 480px;
    margin: 60px auto;
    box-shadow: var(--shadow-md);
}

.form-group label {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.loader {
    color: var(--primary-color);
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 16px;
    }

    .search-bar {
        flex-direction: column;
        padding: 16px;
    }

    .search-bar input,
    .search-bar select,
    .search-bar button {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .product-image {
        height: 160px;
    }

    .product-info {
        padding: 12px;
    }

    .product-title {
        font-size: 0.95rem;
    }
}

/* View Toggle Styles */
.view-toggle {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.view-toggle button {
    background-color: var(--surface-light);
    color: var(--text-secondary);
    border: 1px solid transparent;
    padding: 10px;
    border-radius: var(--button-radius);
    cursor: pointer;
    transition: var(--transition);
}

.view-toggle button.active {
    background-color: var(--primary-color);
    color: white;
}

/* List View */
.product-grid.list-view {
    display: flex;
    flex-direction: column;
}

.product-grid.list-view .product-card {
    flex-direction: row;
    height: 180px;
}

.product-grid.list-view .product-image {
    width: 240px;
    height: 100%;
}

.product-grid.list-view .img-container {
    height: 100%;
    width: 240px;
    flex-shrink: 0;
}

.product-grid.list-view .product-info {
    justify-content: center;
    align-items: flex-start;
    /* Align left in list mode */
}

.product-grid.list-view .product-price {
    margin-top: 16px;
    margin-bottom: 0;
}

/* Mobile List View Adjusment */
@media (max-width: 768px) {
    .view-toggle {
        width: 100%;
        justify-content: flex-end;
    }

    .product-grid.list-view .product-card {
        height: auto;
        flex-direction: column;
    }

    .product-grid.list-view .img-container,
    .product-grid.list-view .product-image {
        width: 100%;
        height: 200px;
    }
}

/* Product Modal Tweaks */
.product-modal-content {
    max-width: 900px;
    padding: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px;
}

/* Custom Scrollbar for Product Modal */
.product-modal-content::-webkit-scrollbar {
    width: 6px;
}

.product-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.product-modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.product-modal-body {
    display: flex;
    gap: 32px;
    margin-top: 16px;
}

.modal-product-image-container {
    flex: 1;
    max-width: 50%;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.modal-product-image,
.modal-product-image-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    background: #000;
}

.modal-product-image.active,
.modal-product-image-container video.active {
    display: block;
}

.modal-product-image-container video {
    outline: none;
    z-index: 5;
}

.modal-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-product-title {
    font-size: 1.8rem;
    margin: 0 0 16px;
    font-weight: 700;
    line-height: 1.2;
}

.modal-product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 24px;
}

.modal-product-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    white-space: pre-wrap;
    /* Preserve formatting */
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.modal-product-meta {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-btn {
    text-align: center;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
}

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

@media (max-width: 768px) {
    .product-modal-body {
        flex-direction: column;
    }

    .modal-product-image-container {
        max-width: 100%;
    }
}

/* Sidebar Layout */
.layout-grid {
    display: flex;
    gap: 32px;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
}

.content-area {
    width: 65%;
    /* Fallback */
    flex-grow: 1;
    min-width: 0;
    /* Prevents flex items from overflowing container */
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0 0;
}

.category-list li {
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.category-list li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.category-list li.active {
    background: var(--accent-color);
    color: white;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .layout-grid {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        overflow-x: auto;
    }

    .category-list {
        display: flex;
        gap: 8px;
        padding-bottom: 8px;
    }

    .category-list li {
        white-space: nowrap;
        background: var(--input-bg);
    }
}

/* Modal Response */
@media (max-width: 600px) {
    .product-modal-content {
        flex-direction: column;
    }

    .modal-product-image-container {
        height: 250px;
    }
}

/* Category Select in Store Modal */
.category-select {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-select:hover {
    border-color: var(--accent-color);
}

.category-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.1);
}

/* Image Gallery Styles */
.image-gallery {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gallery-main {
    position: relative;
    flex: 1;
    overflow: hidden;
    border-radius: 8px;
    background: var(--bg-secondary);
}

.gallery-image,
.gallery-main video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    background: #000;
}

.gallery-image.active,
.gallery-main video.active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

/* Background Task Indicator */
.job-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.job-indicator:hover {
    border-color: var(--primary-color);
}

.job-indicator .icon-container {
    position: relative;
    width: 20px;
    height: 20px;
}

.job-indicator .job-count {
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -8px;
    right: -8px;
}

.job-spinner {
    animation: spin 2s linear infinite;
}

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

.job-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 16px;
    z-index: 1000;
    display: none;
    /* Default hidden */
    max-height: 480px;
    flex-direction: column;
}

.job-dropdown.visible {
    display: flex;
    animation: slideDown 0.3s ease;
}

.job-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 8px;
}

.job-dropdown-header h3 {
    margin: 0;
    font-size: 1rem;
}

.close-dropdown-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

#jobList {
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

#jobList::-webkit-scrollbar {
    width: 4px;
}

#jobList::-webkit-scrollbar-track {
    background: transparent;
}

#jobList::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.job-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.job-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.job-info {
    flex-grow: 1;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cancel-job-btn {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    opacity: 0.6;
}

.cancel-job-btn:hover {
    opacity: 1;
    background: rgba(255, 73, 117, 0.1);
}

.job-item.cancelled {
    opacity: 0.6;
}

.job-username {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
}

.job-status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 4px;
    background: var(--surface-light);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.job-status-icon.completed {
    color: var(--success-color);
}

.job-status-icon.failed {
    color: var(--danger-color);
}

.job-status-icon.processing {
    color: var(--primary-color);
}

.gallery-next {
    right: 10px;
}

.gallery-thumbnails {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 8px;
    overflow-x: auto;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.gallery-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.gallery-thumbnail:hover {
    opacity: 0.8;
}

.gallery-thumbnail.active {
    opacity: 1;
    border-color: var(--accent-color);
}

/* Shorts Feed */
.shorts-feed-section {
    margin-top: 60px;
    margin-bottom: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.shorts-feed-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.shorts-feed-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFD166 0%, #FFFCF2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shorts-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 20px 0;
    box-sizing: border-box;
}

.shorts-track {
    display: flex;
    gap: 24px;
    align-items: center;
    overflow-x: auto;
    scroll-behavior: auto;
    /* Fixes JS auto-scroll jitter */
    padding: 20px 24px;
    width: 100%;
    /* Keep scrollbar hidden for clean UI */
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    box-sizing: border-box;
    /* Ensure padding is included in width */
}

.shorts-track::-webkit-scrollbar {
    display: none;
}

.short-card {
    min-width: 260px;
    width: 260px;
    height: 400px;
    background: var(--surface-color);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: center center;
    opacity: 0.4;
    transform: scale(0.85);
    flex-shrink: 0;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    filter: grayscale(80%);
}

.short-card.active {
    opacity: 1;
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 20px 60px rgba(255, 209, 102, 0.15);
    border: 2px solid var(--warning-color);
    filter: grayscale(0%);
}

.short-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.short-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 60%;
}

.short-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.short-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.short-type-badge {
    background: var(--warning-color);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
}

/* Grouped Stores Tree Layout */
.stores-tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 20px 0;
}

.user-node {
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(108, 93, 211, 0.4);
    z-index: 2;
    margin-bottom: 24px;
    position: relative;
}

.user-node i {
    font-size: 24px;
    color: white;
}

/* Connecting line from User to Categories */
.user-node::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    width: 2px;
    height: 24px;
    background: var(--border-color);
    transform: translateX(-50%);
}

.categories-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 48px;
    width: 100%;
}

.category-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 120px;
}

/* Lines connecting categories */
.category-branch::before {
    content: '';
    position: absolute;
    top: -24px;
    /* Connect to the user node's bottom line level */
    left: 50%;
    width: 2px;
    height: 24px;
    background: var(--border-color);
}

/* Horizontal connector line logic would be complex with pure CSS flex/wrap 
   Simplification: Just vertical lines dropping from a common virtual horizontal line? 
   For now, we will just have them radiate visually. 
*/

.category-bubble {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid var(--primary-color);
    background: var(--surface-light);
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
    text-align: center;
    min-width: 100px;
}

.category-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    width: 2px;
    height: 24px;
    background: var(--border-color);
    transform: translateX(-50%);
}

.store-leaves {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
}

/* Horizontal line across tops of stores? */
/* Simplified: Just hang them */

.store-leaf-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.store-leaf-wrapper::before {
    content: '';
    position: absolute;
    top: -24px;
    left: 50%;
    width: 2px;
    height: 24px;
    background: var(--border-color);
    transform: translateX(-50%);
}

.store-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.store-bubble:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.store-bubble-label {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Store Detail Popover (Hidden by default) */
.store-popover {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 12px;
    width: 200px;
    z-index: 100;
    box-shadow: var(--shadow-md);
    margin-top: 12px;
    display: none;
    text-align: left;
}

.store-leaf-wrapper:hover .store-popover,
.store-popover:hover {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.2s ease;
}

.store-popover h5 {
    margin: 0;
    font-size: 0.9rem;
    color: white;
}

/* Gallery View Mode Styles */
.product-grid.gallery-mode {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 4), 1fr);
    gap: 6px;
    padding: 10px 0;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface-light);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-item:hover {
    transform: scale(1.02);
    z-index: 20;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-mini-card {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
    backdrop-filter: blur(4px);
    padding: 24px 12px 12px 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
}

.gallery-item:hover .gallery-mini-card {
    opacity: 1;
    transform: translateY(0);
}

.gallery-mini-card .title {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-mini-card .price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--warning-color);
}

/* Zoom Controls Slider */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-light);
    padding: 8px 16px;
    border-radius: 40px;
    width: fit-content;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.zoom-controls input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    width: 140px;
}

.zoom-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(108, 93, 211, 0.5);
    border: 2px solid white;
}

/* ========================================= 
   MOBILE-FIRST SPECIALIZED UI 
   Triggered by .mobile-layout class on body
   ========================================= */

/* Default: Hide mobile-specific elements */
.mobile-category-slider,
.mobile-tab-bar {
    display: none;
}

body.mobile-layout {
    background: #000;
    font-size: 14px;
    padding-bottom: 70px;
    /* Space for tab bar */
}

body.mobile-layout .container {
    padding: 0 12px;
}

body.mobile-layout .header {
    background: rgba(10, 10, 10, 0.9);
    padding: 10px 0;
}

body.mobile-layout .header h1 {
    font-size: 1.1rem;
}

/* Hide bulky desktop elements */
body.mobile-layout .sidebar,
body.mobile-layout .header nav a,
body.mobile-layout .header .job-indicator,
body.mobile-layout .header .tasks-idle,
body.mobile-layout .view-toggle,
body.mobile-layout .pagination {
    display: none !important;
}

body.mobile-layout .layout-grid {
    display: block;
}

/* Tab Bar Navigation (Bottom fixed) */
body.mobile-layout .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 20, 22, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0 20px 0;
    /* Extra padding for iOS home bar area */
    z-index: 1000;
    justify-content: space-around;
}

body.mobile-layout .mobile-tab-bar a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

body.mobile-layout .mobile-tab-bar a.active {
    color: var(--primary-color);
}

body.mobile-layout .mobile-tab-bar a i {
    font-size: 1.3rem;
}

/* Mobile Search Bar */
body.mobile-layout .search-bar {
    margin: 12px 0;
    padding: 12px;
    gap: 10px;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.mobile-layout .search-bar input {
    width: 100%;
    min-width: unset;
    background: #1a1a1c;
    border: none;
    height: 44px;
}

body.mobile-layout .search-bar button {
    width: 100%;
    padding: 12px;
}

body.mobile-layout #storeSelect,
body.mobile-layout #typeSelect,
body.mobile-layout #sortSelect {
    display: none;
}

body.mobile-layout .product-grid {
    display: block;
    column-count: 2;
    column-gap: 12px;
    padding: 20px 0 30px 0;
    /* More top padding to avoid clipping */
    width: 100%;
}

body.mobile-layout .product-card {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    contain: layout;
    /* Helps with layout boundaries */
    border-radius: 14px;
    background: #111;
    overflow: hidden;
}

body.mobile-layout .img-container {
    height: auto !important;
    min-height: 50px;
    /* Ensure it exists */
}

body.mobile-layout .product-image {
    height: auto !important;
    max-height: 500px;
    object-fit: cover;
    /* Keep cover but with auto height it will just scale */
}

body.mobile-layout .product-content {
    padding: 10px;
}

body.mobile-layout .product-title {
    font-size: 0.85rem;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
    margin-bottom: 6px;
    font-weight: 500;
}

body.mobile-layout .product-meta {
    margin-top: auto;
}

body.mobile-layout .price-tag {
    font-size: 0.95rem;
    font-weight: 800;
}

body.mobile-layout .store-name {
    font-size: 0.7rem;
    opacity: 0.6;
}

/* Category Slider */
body.mobile-layout .mobile-category-slider {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 8px 12px;
    margin: 0 -12px 12px -12px;
    scrollbar-width: none;
    background: #000;
}

body.mobile-layout .cat-chip {
    white-space: nowrap;
    background: #1a1a1c;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

body.mobile-layout .cat-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}