/* Extracted from templates/index.html <style> */
:root {
    --mdc-theme-primary: #d243ff; /* main primary */
    --mdc-theme-secondary: #aa1fff; /* a deeper tone */
    --mdc-theme-surface: #ffffff;
    --mdc-theme-background: #fafafa;
    --mdc-theme-on-primary: #ffffff;
    --mdc-theme-on-secondary: #000000;
    --mdc-theme-on-surface: #000000;
    --mdc-theme-on-background: #000000;
}

a {
    color: #d243ff;
    text-decoration: underline;
}
a:hover {
    text-decoration: underline;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--mdc-theme-background);
    margin: 0;
    padding: 0;
    touch-action: pan-x pan-y;
    -ms-touch-action: pan-x pan-y;
}

.app-bar {
    background: linear-gradient(135deg, #d243ff 0%, #b935ff 60%, #9b2bff 100%);
    color: var(--mdc-theme-on-primary);
    padding: 16px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    text-align: center;
    display: flex;
    align-items: center;
}

.app-bar h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 auto;
}

/* Reduce header height by 20% on mobile devices */
@media (max-width: 760px) {
    .app-bar {
        padding: 13px 20px; /* Reduced from 16px 24px (20% less) */
    }
    
    .app-bar h1 {
        font-size: 19px; /* Reduced from 24px (20% less) */
        gap: 6px; /* Reduced from 8px proportionally */
    }
    
    .app-bar h1 img {
        width: 19px !important; /* Reduced from 24px (20% less) */
        height: 19px !important; /* Reduced from 24px (20% less) */
    }
}

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

.add-product-card {
    background-color: var(--mdc-theme-surface);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 24px;
}

/* Desktop: Original expanding container behavior */
#addProductCard {
    display: block;
}

#addProductCard.hidden {
    display: none;
}

/* Ensure form content takes full width on desktop */
@media (min-width: 761px) {
    #addProductCard .add-product-form-content {
        width: 100%;
        max-width: 100%;
    }
}

/* Mobile: Modal overlay for add product form */
@media (max-width: 760px) {
    #addProductCard {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background-color: rgba(0, 0, 0, 0.5) !important;
        display: none !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 1000 !important;
        padding: 16px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
    }

    #addProductCard.hidden {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    #addProductCard:not(.hidden) {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    #addProductCard .add-product-form-content {
        background-color: var(--mdc-theme-surface);
        border-radius: 8px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.2);
        padding: 24px;
        max-width: 500px;
        width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        position: relative;
        transform: scale(0.9);
        transition: transform 0.3s ease;
    }

    #addProductCard:not(.hidden) .add-product-form-content {
        transform: scale(1);
    }
}

/* Mobile Floating Action Button */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d243ff 0%, #b935ff 60%, #9b2bff 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(210, 67, 255, 0.4);
    cursor: pointer;
    z-index: 999;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(210, 67, 255, 0.5);
}

.mobile-fab:active {
    transform: scale(0.95);
}

.mobile-fab .material-icons {
    font-size: 24px;
    color: white;
}

.recent-products-card {
    background-color: var(--mdc-theme-surface);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.recent-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.recent-card-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: #333;
}

.recent-card-close {
    background: transparent;
    border: none;
    color: #777;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.recent-card-close:hover {
    color: #444;
}

.hidden-recent-duplicate {
    display: none !important;
}

.add-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.add-card-close {
    background: transparent;
    border: none;
    color: #777;
    cursor: pointer;
}
.add-card-close:hover { color: #444; }

.add-product-card h2 {
    margin: 0 0 16px 0;
    color: var(--mdc-theme-on-surface);
    font-size: 20px;
    font-weight: 500;
}

.form-group {
    margin-bottom: 16px;
}

.mdc-text-field {
    width: 100%;
}

.mdc-button {
    margin-top: 8px;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-row {
    background-color: var(--mdc-theme-surface);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.product-cell {
    min-width: 0;
}
.cell-image { flex: 0 px; }
.cell-name { 
    flex: 2; 
    display: flex;
    flex-direction: column;
}
.product-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    background: #eee;
}
.cell-image {
    position: relative;
}
.out-of-stock-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(244, 67, 54, 0.95);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 4px;
}
.out-of-stock-badge .material-icons {
    font-size: 14px;
    line-height: 1;
}
.cell-price { flex: 2; }
.cell-url { flex: 3; }
.cell-updated { flex: 2.5; }
.cell-actions { flex: 0.5; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.product-menu-container {
    position: relative;
    display: inline-block;
}
.product-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    border-radius: 8px;
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

@media (max-width: 760px) {
    .product-menu-dropdown {
        right: 0;
        top: 36px;
        min-width: 200px;
    }
}
.product-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.product-menu-item:hover {
    background-color: #f5f5f5;
}
.product-menu-item .material-icons {
    font-size: 20px;
    color: #666;
}
.product-menu-item:hover .material-icons {
    color: #333;
}
.product-menu-item.delete-menu-item {
    color: #d32f2f;
}
.product-menu-item.delete-menu-item .material-icons {
    color: #d32f2f;
}
.product-menu-item.delete-menu-item:hover {
    background-color: #ffebee;
}

@media (max-width: 760px) {
    .out-of-stock-badge {
        font-size: 10px;
        padding: 3px 6px;
        bottom: 8px;
    }
    .out-of-stock-badge .material-icons {
        font-size: 12px;
    }
    .product-row { 
        display: grid;
        grid-template-columns: 100px 1fr;
        gap: 12px 12px;
        row-gap: 4px;
        align-items: start;
        position: relative;
        padding: 12px;
    }
    
    .cell-image {
        grid-column: 1;
        grid-row: 1 / 4;
        align-self: start;
    }
    
    .product-thumb {
        width: 100px;
        height: 100px;
        object-fit: cover;
        border-radius: 8px;
    }
    
    .cell-actions {
        position: absolute;
        top: 8px;
        right: 8px;
        margin: 0;
        z-index: 10;
    }
    
    .product-menu-btn {
        background: rgba(255, 255, 255, 0.95);
        border-radius: 50%;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        width: 36px;
        height: 36px;
        padding: 0;
    }
    
    .product-menu-btn .material-icons {
        font-size: 20px;
    }
    
    .cell-price {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        margin-top: 0;
        padding-right: 44px; /* Space for menu button */
    }
    
    .product-price {
        font-size: 20px;
        font-weight: 500;
        margin-bottom: 0;
    }
    
    .price-wrap {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .base-price-faded {
        font-size: 12px;
        color: #9e9e9e;
        margin-top: 4px;
        margin-bottom: 0;
        display: block;
    }
    
    /* Use display: contents to make cell-name children participate in parent grid */
    .cell-name {
        display: contents;
    }
    
    .product-name {
        grid-column: 2;
        grid-row: 2;
        font-size: 14px;
        margin-bottom: 0;
        margin-top: 0;
        line-height: 1.4;
        color: #000;
        min-height: calc(14px * 1.4 * 2); /* Two lines of text */
    }
    
    .cell-price {
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    .product-price {
        margin-bottom: 0;
    }
    
    .base-price-faded {
        margin-bottom: 0;
    }
    
    .product-name a {
        color: #000;
        text-decoration: none;
    }
    
    .product-name a:hover {
        text-decoration: underline;
    }
    
    /* Tags container - full width, above sparkline */
    .product-tags {
        grid-column: 1 / -1;
        grid-row: 3;
        width: 100%;
        margin-bottom: 8px;
        padding: 0;
        padding-bottom: 2px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        display: flex;
        gap: 4px;
    }
    
    .product-tags::-webkit-scrollbar {
        display: none;
    }
    
    .cell-updated {
        grid-column: 1 / -1;
        grid-row: 4;
        width: 100%;
        margin-top: 0;
        padding-top: 8px;
        border-top: 1px solid #e0e0e0;
    }
    
    .sparkline {
        width: 100%;
        height: 48px;
        margin-top: 0;
        margin-bottom: 4px;
    }
    
    .last-updated {
        font-size: 11px;
        color: #999;
        margin-top: 4px;
    }
    
    .cell-url { width: 100%; }
    .product-url { word-break: break-all; }
    
    /* Hide original Add Product button on mobile */
    #showAddFormBtn {
        display: none !important;
    }
    
    /* Hide desktop sort controls on mobile */
    #sortBar {
        display: none !important;
    }
    
    /* Hide tag filter card on mobile */
    #tagFilterCard {
        display: none !important;
    }
    
    /* Show mobile sort button */
    .mobile-sort-btn {
        display: flex !important;
    }
    
    /* Show mobile tags button */
    .mobile-tags-btn {
        display: flex !important;
    }
    
    /* Show mobile FAB on mobile */
    .mobile-fab {
        display: flex;
    }
    
    /* Adjust modal padding on mobile */
    #addProductCard {
        padding: 8px;
    }
    
    #addProductCard .add-product-form-content {
        padding: 20px;
        max-height: 85vh;
    }
    
    /* Mobile-native tag filter - horizontal scrollable single line */
    .tag-filter-wrapper {
        flex-wrap: nowrap !important;
        margin: -8px;
        padding: 8px;
        overflow: hidden;
        display: flex !important;
        align-items: center;
        width: 100%;
    }
    
    #tagFilterCard {
        overflow: hidden;
    }
    
    .tag-filter-label {
        display: none !important;
    }
    
    .tag-filter-scroll {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        flex: 1;
        min-width: 0;
        max-width: 100%;
        display: flex !important;
        gap: 6px;
        padding-bottom: 2px;
    }
    
    .tag-filter-scroll::-webkit-scrollbar {
        display: none;
    }
    
    .tag-filter-btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
        font-weight: 500;
        border-radius: 18px !important;
        white-space: nowrap !important;
        min-height: 32px;
        flex-shrink: 0 !important;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.2s ease;
    }
    
    .tag-filter-btn:active {
        transform: scale(0.95);
    }
    
    .tag-filter-btn.active {
        background: linear-gradient(135deg, #d243ff 0%, #b935ff 60%, #9b2bff 100%) !important;
        color: white !important;
        border-color: transparent !important;
        box-shadow: 0 2px 6px rgba(210, 67, 255, 0.3);
    }
    
    /* Mobile-native product tags - single scrollable line */
    .product-tags {
        gap: 4px !important;
        margin-top: 6px;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        display: flex !important;
        padding-bottom: 2px;
        max-width: 100%;
    }
    
    .product-tags::-webkit-scrollbar {
        display: none;
    }
    
    .tag-chip {
        padding: 6px 10px !important;
        font-size: 12px !important;
        font-weight: 500;
        border-radius: 14px !important;
        min-height: 28px;
        flex-shrink: 0 !important;
        -webkit-tap-highlight-color: transparent;
        gap: 4px;
        white-space: nowrap !important;
    }
    
    .tag-remove-btn {
        width: 16px !important;
        height: 16px !important;
        background: rgba(210, 67, 255, 0.2) !important;
        border-radius: 50% !important;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
    }
    
    .tag-remove-btn:active {
        background: rgba(210, 67, 255, 0.3) !important;
        transform: scale(0.9);
    }
    
    .tag-remove-btn .material-icons {
        font-size: 12px !important;
    }
    
    /* Remove pink background from tag-chip wrapper containing tag-add-btn */
    .tag-chip:has(.tag-add-btn) {
        background-color: transparent !important;
        padding: 0 !important;
    }
    
    .tag-add-btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        font-weight: 500;
        border-radius: 14px !important;
        min-height: 28px;
        flex-shrink: 0 !important;
        -webkit-tap-highlight-color: transparent;
        gap: 4px;
        white-space: nowrap !important;
        background-color: #f5f5f5 !important;
        border: 1px dashed #ccc !important;
        color: #666;
    }
    
    .tag-add-btn .material-icons {
        font-size: 14px !important;
    }
}

.product-name {
    font-size: 16px;
    color: var(--mdc-theme-on-surface);
    margin-bottom: 8px;
    line-height: 1.4;
    order: 1;
}
.product-name a {
    color: #000;
}

.product-price {
    font-size: 24px;
    font-weight: 500;
    color: #000;
    margin-bottom: 8px;
}
.price-wrap { display: inline-flex; align-items: center; gap: 6px; }
.price-trend.up { color: #c62828; }
.price-trend.down { color: #2e7d32; }
.price-trend.same { color: #9e9e9e; }
.price-out-of-stock {
    opacity: 0.6;
    color: #999;
}

.price-change-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
.price-change-badge.up { background: rgba(198,40,40,0.12); color: #c62828; }
.price-change-badge.down { background: rgba(46,125,50,0.12); color: #2e7d32; }
.price-change-badge.same { background: rgba(158,158,158,0.12); color: #616161; }
/* Significant changes: bold and prominent */
.price-change-badge.change-significant {
    font-weight: 700;
    font-size: 13px;
    padding: 3px 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.price-change-badge.change-significant.up { background: rgba(198,40,40,0.2); }
.price-change-badge.change-significant.down { background: rgba(46,125,50,0.2); }
/* Minor changes: normal styling */
.price-change-badge.change-minor {
    font-weight: 500;
}
/* Negligible changes: muted and smaller */
.price-change-badge.change-negligible {
    font-weight: 400;
    font-size: 11px;
    opacity: 0.7;
    padding: 1px 5px;
}
.price-change-badge.change-negligible.up { background: rgba(198,40,40,0.08); }
.price-change-badge.change-negligible.down { background: rgba(46,125,50,0.08); }
.price-change-badge .material-icons {
    font-size: 14px;
    line-height: 1;
    vertical-align: -2px;
    margin-right: 4px;
}

.product-url {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
    word-break: break-all;
}

.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Inline sparkline (lazy-loaded) */
.sparkline {
    width: 100%;
    height: 56px;
    margin-top: 6px;
}
.sparkline svg { width: 100%; height: 100%; display: block; }
.sparkline .line { stroke: #9c27b0; stroke-width: 1; fill: none; }
.sparkline .area { fill: rgba(156,39,176,0.12); }
.sparkline .axis { stroke: #ddd; stroke-width: 0.75; }
.sparkline .grid { stroke: #ddd; stroke-width: 0.75; }

/* Modal for price history */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    width: min(92vw, 820px);
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #d243ff 0%, #b935ff 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title {
    margin: 0;
    font-weight: 500;
}
.modal-body {
    padding: 16px 20px 20px 20px;
    background: #fafafa;
}
.modal-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
}

.mdc-button--outlined {
    border-color: var(--mdc-theme-primary);
    color: var(--mdc-theme-primary);
}

.mdc-button--outlined:hover {
    background-color: rgba(210, 67, 255, 0.06);
}

.mdc-button--raised {
    background: linear-gradient(135deg, #d243ff 0%, #b935ff 100%);
    color: var(--mdc-theme-on-primary);
    border: none;
}
.mdc-button--raised:hover {
    filter: brightness(1.05);
}

.last-updated {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #666;
}

.empty-state .material-icons {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

.loading {
    display: none;
    text-align: center;
    padding: 16px;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--mdc-theme-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Inline spinner for buttons */
.btn-spinner {
    display: none;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--mdc-theme-primary);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    margin-left: 6px;
}

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

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 4px;
    margin-top: 8px;
    display: none;
}

.success-message {
    background-color: #e8f5e8;
    color: #2e7d32;
    padding: 12px;
    border-radius: 4px;
    margin-top: 8px;
    display: none;
}
.hidden { display: none; }

/* Override .hidden for modal */
#addProductCard.hidden { display: none !important; }
#addProductCard:not(.hidden) { display: flex !important; }

/* App bar layout additions */
.app-bar h1 .material-icons {
    vertical-align: middle;
    margin-right: 8px;
}

.app-bar h1 a {
    text-decoration: none;
    color: inherit;
}

/* Hamburger menu */
#hamburgerMenu {
    position: relative;
    flex: 0 0 auto;
}

#hamburgerBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
}

#hamburgerBtn .material-icons {
    line-height: 1;
}

#hamburgerDropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 44px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    border-radius: 8px;
    min-width: 180px;
    z-index: 1000;
}

#hamburgerDropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
}

#hamburgerDropdown .material-icons {
    font-size: 20px;
}

/* Sort controls */
.sort-controls-bar {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#sortBar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 13px;
    color: #555;
}

.sort-select {
    padding: 6px 10px;
}

/* Tag filter */
#tagFilterCard {
    margin-bottom: 16px;
}

.tag-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-filter-scroll {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-filter-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.tag-filter-btn {
    padding: 4px 8px;
    font-size: 12px;
}

.tag-filter-btn.active {
    background-color: rgba(210, 67, 255, 0.1);
    border-color: #d243ff;
}

/* Product tags */
.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    order: 2;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background-color: rgba(210, 67, 255, 0.1);
    color: #d243ff;
    border-radius: 12px;
    font-size: 11px;
}

.tag-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #d243ff;
    padding: 0;
    margin: 0;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tag-remove-btn .material-icons {
    font-size: 14px;
}

/* Tag selector */
.tag-selector-container {
    position: relative;
    display: inline-block;
}

.tag-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background-color: #f5f5f5;
    color: #666;
    border: 1px dashed #ccc;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
}

.tag-add-btn .material-icons {
    font-size: 14px;
}

.tag-selector-dropdown {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 220px;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.tag-selector-section-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.tag-selector-section-label:not(:first-child) {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #eee;
    border-bottom: none;
    padding-bottom: 0;
}

.tag-selector-existing {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 30px;
}

.tag-selector-existing .empty-message {
    color: #999;
    font-size: 11px;
    padding: 4px;
}

.tag-selector-input-wrapper {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.tag-selector-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.tag-selector-create-btn {
    padding: 6px 12px;
    background: #d243ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.tag-selector-create-btn .material-icons {
    font-size: 16px;
    vertical-align: middle;
}

.tag-selector-item-btn {
    padding: 4px 8px;
    background: rgba(210, 67, 255, 0.1);
    color: #d243ff;
    border: 1px solid rgba(210, 67, 255, 0.3);
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-selector-item-btn:hover {
    background: rgba(210, 67, 255, 0.2);
    transform: scale(1.05);
}

/* Base price faded */
.base-price-faded {
    margin-top: 4px;
    font-size: 12px;
    color: #9e9e9e;
}

/* Action buttons */
.history-btn {
    font-size: 11px;
}

.delete-btn {
    min-width: auto;
}

.delete-btn .material-icons {
    padding: 0;
    margin: 0;
}

/* Mobile Sort Button */
.mobile-sort-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-sort-btn .material-icons {
    font-size: 20px;
    color: #666;
}

.mobile-sort-btn:active {
    background: #f5f5f5;
    transform: scale(0.98);
}

.mobile-sort-text {
    display: none;
}

@media (max-width: 760px) {
    .mobile-sort-text {
        display: inline;
    }
}

/* Mobile Sort Bottom Sheet */
.mobile-sort-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-sort-sheet.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.mobile-sort-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.mobile-sort-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.mobile-sort-sheet.show .mobile-sort-sheet-content {
    transform: translateY(0);
}

.mobile-sort-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.mobile-sort-sheet-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.mobile-sort-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-sort-close:active {
    background: #f5f5f5;
}

.mobile-sort-close .material-icons {
    font-size: 24px;
}

.mobile-sort-options {
    padding: 8px 0;
}

.mobile-sort-section {
    padding: 16px 20px;
}

.mobile-sort-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.mobile-sort-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-sort-radio {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-sort-radio:active {
    background: #f5f5f5;
}

.mobile-sort-radio input[type="radio"] {
    display: none;
}

.mobile-sort-radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: #333;
    flex: 1;
}

.mobile-sort-radio-label .material-icons {
    font-size: 20px;
    color: #666;
}

.mobile-sort-radio input[type="radio"]:checked + .mobile-sort-radio-label {
    color: #d243ff;
    font-weight: 500;
}

.mobile-sort-radio input[type="radio"]:checked + .mobile-sort-radio-label .material-icons {
    color: #d243ff;
}

.mobile-sort-radio input[type="radio"]:checked + .mobile-sort-radio-label::after {
    content: '✓';
    margin-left: auto;
    color: #d243ff;
    font-weight: bold;
    font-size: 18px;
}

/* Mobile Tags Button */
.mobile-tags-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tags-btn .material-icons {
    font-size: 20px;
    color: #666;
}

.mobile-tags-btn:active {
    background: #f5f5f5;
    transform: scale(0.98);
}

.mobile-tags-text {
    display: none;
}

@media (max-width: 760px) {
    .mobile-tags-text {
        display: inline;
    }
}

/* Mobile Tags Bottom Sheet */
.mobile-tags-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-tags-sheet.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.mobile-tags-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.mobile-tags-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.mobile-tags-sheet.show .mobile-tags-sheet-content {
    transform: translateY(0);
}

.mobile-tags-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.mobile-tags-sheet-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.mobile-tags-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tags-close:active {
    background: #f5f5f5;
}

.mobile-tags-close .material-icons {
    font-size: 24px;
}

.mobile-tags-options {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.mobile-tag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: #333;
    font-size: 16px;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    border-left: 3px solid transparent;
}

.mobile-tag-item:active {
    background: #f5f5f5;
}

.mobile-tag-item.active {
    background: rgba(210, 67, 255, 0.1);
    border-left-color: #d243ff;
    color: #d243ff;
    font-weight: 500;
}

.mobile-tag-item .material-icons {
    font-size: 20px;
    color: #666;
    flex-shrink: 0;
}

.mobile-tag-item.active .material-icons {
    color: #d243ff;
}

.mobile-tag-item span:not(.material-icons) {
    flex: 1;
}

.mobile-tag-count {
    color: #999;
    font-size: 14px;
    font-weight: normal;
}

.mobile-tag-item.active .mobile-tag-count {
    color: #d243ff;
}

.mobile-tags-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
    position: sticky;
    bottom: 0;
}

.mobile-add-tag-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #d243ff 0%, #b935ff 60%, #9b2bff 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(210, 67, 255, 0.3);
}

.mobile-add-tag-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(210, 67, 255, 0.3);
}

.mobile-add-tag-btn .material-icons {
    font-size: 20px;
}

/* Mobile Add Tag Bottom Sheet */
.mobile-add-tag-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1002;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-add-tag-sheet.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.mobile-add-tag-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.mobile-add-tag-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.mobile-add-tag-sheet.show .mobile-add-tag-sheet-content {
    transform: translateY(0);
}

.mobile-add-tag-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    flex-shrink: 0;
}

.mobile-add-tag-sheet-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.mobile-add-tag-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-add-tag-close:active {
    background: #f5f5f5;
}

.mobile-add-tag-close .material-icons {
    font-size: 24px;
}

.mobile-add-tag-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.mobile-add-tag-section {
    padding: 16px 20px;
}

.mobile-add-tag-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.mobile-add-tag-existing {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.mobile-add-tag-existing .empty-message {
    color: #999;
    font-size: 14px;
    padding: 8px;
    text-align: center;
}

.mobile-add-tag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
}

.mobile-add-tag-item:active {
    background: #f0f0f0;
}

.mobile-add-tag-item .material-icons {
    font-size: 20px;
    color: #666;
    flex-shrink: 0;
}

.mobile-add-tag-item span:not(.material-icons) {
    flex: 1;
    font-size: 16px;
    color: #333;
}

.mobile-add-tag-item-count {
    color: #999;
    font-size: 14px;
    font-weight: normal;
}

.mobile-add-tag-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mobile-add-tag-input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #f9f9f9;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.mobile-add-tag-input:focus {
    outline: none;
    border-color: #d243ff;
    background: white;
}

.mobile-add-tag-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #d243ff 0%, #b935ff 60%, #9b2bff 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(210, 67, 255, 0.3);
    flex-shrink: 0;
}

.mobile-add-tag-create-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(210, 67, 255, 0.3);
}

.mobile-add-tag-create-btn .material-icons {
    font-size: 24px;
}

/* Hide dropdown on mobile, show bottom sheet instead */
@media (max-width: 760px) {
    .tag-selector-dropdown {
        display: none !important;
    }
}
