/**
 * PC Kompas Trends - Price Drops Styles
 *
 * Contains:
 * - Top 10 deals section (compact list design)
 * - Deal items
 * - Top price drops section
 * - Price drop cards
 * - Load more button
 *
 * @package PC_Kompas_Trends
 * @since 1.0.0
 */

/* ============================================================================
   TOP 10 DEALS SECTION - Compact List Design
   ============================================================================ */

.top-deals {
    margin-bottom: clamp(2rem, 4vw, 3rem);
    max-width: 100%;
    /* overflow: visible to allow alert popovers to extend outside */
    overflow: visible;
}

.top-deals__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.top-deals__title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-deals__icon {
    font-size: 1.5rem;
    line-height: 1;
}

.top-deals__title {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.top-deals__title-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.top-deals__subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 400;
}

.top-deals__date {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.top-deals__loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
    color: var(--accent);
}

.top-deals__loading svg {
    animation: trends-spin 1s linear infinite;
}

.top-deals__empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* Deals List - 2 columns on desktop */
.top-deals__list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 100%;
    /* overflow: visible to allow alert popovers to extend outside */
    overflow: visible;
    /* Isolate stacking context so child z-index works within this container */
    isolation: isolate;
}

/* Individual Deal Item - Horizontal compact card */
.deal-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 150ms ease, z-index 0s;
    min-width: 0;
    /* overflow: visible to allow alert popovers to extend outside */
    overflow: visible;
    position: relative;
    z-index: 1;
}

/* When popover is open, deal item gets high z-index to show above siblings */
.deal-item:has(.deal-item__alert-popover:not([x-cloak]):not([style*="display: none"])),
.deal-item.has-popover-open {
    z-index: 1000;
}

.deal-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Only apply transform when popover is NOT open to avoid trapping z-index */
.deal-item:hover:not(.has-popover-open) {
    transform: translateY(-2px);
}

/* Rank number */
.deal-item__rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Top 3 special styling - using classes for Alpine.js compatibility */
.deal-item__rank--gold {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark, #f59e0b) 100%) !important;
    color: #fff !important;
}

.deal-item__rank--silver {
    background: linear-gradient(135deg, var(--text-muted) 0%, var(--text-secondary) 100%) !important;
    color: #fff !important;
}

.deal-item__rank--bronze {
    background: linear-gradient(135deg, var(--warning-dark, #d97706) 0%, var(--warning-darker, #b45309) 100%) !important;
    color: #fff !important;
}

/* Product image */
.deal-item__image {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    overflow: hidden;
}

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

/* Product info */
.deal-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.deal-item__category {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.deal-item__name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deal-item__supplier {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Pricing section */
.deal-item__pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.deal-item__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    background: var(--success);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.deal-item__prices {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
}

.deal-item__price-old {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.deal-item__price-new {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--success);
}

/* ============================================================================
   TOP PRICE DROPS SECTION
   ============================================================================ */

.trends-drops {
    margin-bottom: clamp(0.75rem, 1.5vw, 1rem);
}

.trends-drops__header {
    margin-bottom: clamp(0.75rem, 1.5vw, 1rem);
}

.trends-drops__title {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 clamp(0.25rem, 0.5vw, 0.35rem) 0;
}

.trends-drops__subtitle {
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    color: var(--text-secondary);
    margin: 0;
}

.trends-drops__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 20vw, 220px), 1fr));
    gap: clamp(0.75rem, 1.5vw, 1rem);
    /* Isolate stacking context so child z-index works within this container */
    isolation: isolate;
}

/* ============================================================================
   PRICE DROP CARD
   ============================================================================ */

.trends-drop-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* overflow: visible to allow popover to extend outside card */
    overflow: visible;
    padding: clamp(0.75rem, 1.5vw, 1rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    gap: clamp(0.5rem, 1vw, 0.75rem);
    transition: all 150ms ease, z-index 0s;
    position: relative;
    z-index: 1;
}

/* When popover is open, card gets high z-index to show above siblings */
.trends-drop-card:has(.trends-drop-card__alert-popover:not([x-cloak]):not([style*="display: none"])),
.trends-drop-card.has-popover-open {
    z-index: 1000;
}

.trends-drop-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

/* Only apply transform when popover is NOT open to avoid trapping z-index */
.trends-drop-card:hover:not(.has-popover-open) {
    transform: translateY(-4px);
}

.trends-drop-card__image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.trends-drop-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 200ms ease;
}

.trends-drop-card:hover .trends-drop-card__image {
    transform: scale(1.05);
}

.trends-drop-card__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 32px;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark, #16a34a) 100%);
    color: #fff;
    font-size: clamp(0.6875rem, 1.2vw, 0.8125rem);
    font-weight: 800;
    border-radius: var(--radius-md);
    padding: clamp(0.375rem, 0.75vw, 0.5rem) clamp(0.5rem, 1vw, 0.75rem);
    text-align: center;
    box-shadow: 0 6px 16px rgba(var(--success-rgb), 0.35), 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    z-index: 10;
    letter-spacing: 0.02em;
}

.trends-drop-card__badge-percent {
    display: block;
}

.trends-drop-card__content {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    flex: 1;
}

.trends-drop-card__info {
    display: flex;
    flex-direction: column;
    gap: clamp(0.25rem, 0.5vw, 0.5rem);
    min-width: 0;
}

.trends-drop-card__brand {
    font-size: clamp(0.625rem, 1.2vw, 0.75rem);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trends-drop-card__name {
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.trends-drop-card__supplier {
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    color: var(--text-muted);
    margin: 0;
    font-style: italic;
}

.trends-drop-card__prices {
    display: flex;
    align-items: flex-end;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    padding-top: clamp(0.5rem, 1vw, 0.75rem);
    border-top: 1px solid var(--border);
}

.trends-drop-card__price-old {
    font-size: clamp(0.6875rem, 0.9vw, 0.8125rem);
    color: var(--text-muted);
    text-decoration: line-through;
    margin: 0;
}

.trends-drop-card__price-current {
    font-size: clamp(0.8125rem, 1.1vw, 0.9375rem);
    font-weight: 700;
    color: var(--success);
    margin: 0;
}

.trends-drop-card__footer {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    margin-top: auto;
    padding-top: clamp(0.5rem, 1vw, 0.75rem);
    border-top: 1px solid var(--border);
}

.trends-drop-card__shop {
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    color: var(--text-secondary);
    margin: 0;
    flex: 1;
}

.trends-drop-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: clamp(0.5rem, 1vw, 0.75rem) clamp(0.75rem, 1.5vw, 1rem);
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.trends-drop-card__cta:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.trends-drop-card__cta:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.trends-drop-card__cta:active {
    transform: translateY(0);
}

/* ============================================================================
   BACK IN STOCK ALERT MODE (no price available)
   ============================================================================ */

.trends-drop-card__alert-back-in-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: clamp(0.875rem, 1.5vw, 1rem);
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
    background-color: rgba(var(--accent-rgb, 48, 119, 166), 0.08);
    border-radius: var(--radius-md);
}

.trends-drop-card__alert-back-in-stock-icon {
    width: clamp(40px, 6vw, 48px);
    height: clamp(40px, 6vw, 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(0.625rem, 1vw, 0.75rem);
    color: var(--accent);
}

.trends-drop-card__alert-back-in-stock-icon svg {
    width: clamp(24px, 4vw, 32px);
    height: clamp(24px, 4vw, 32px);
}

.trends-drop-card__alert-back-in-stock-text {
    margin: 0;
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================================================
   LOAD MORE BUTTON
   ============================================================================ */

.trends-drops__load-more {
    display: flex;
    justify-content: center;
    margin-top: clamp(1rem, 2vw, 1.5rem);
}

.trends-drops__load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 160px;
    min-height: 44px;
    padding: clamp(0.625rem, 1.25vw, 0.875rem) clamp(1.25rem, 2.5vw, 2rem);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: clamp(0.875rem, 1.1vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
}

.trends-drops__load-more-btn:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.trends-drops__load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.trends-drops__load-more-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.trends-drops__load-more-spinner svg {
    color: var(--text-secondary);
}

/* ============================================================================
   PRICE ALERT BUTTON ON DROP CARDS
   Subtle design: hidden by default, appears on card hover
   ============================================================================ */

/* Alert wrapper for popover positioning - positioned top-left ON THE CARD */
.trends-drop-card__alert-wrapper {
    position: absolute;
    top: calc(clamp(0.75rem, 1.5vw, 1rem) + 0.5rem); /* card padding + offset */
    left: calc(clamp(0.75rem, 1.5vw, 1rem) + 0.5rem); /* card padding + offset */
    z-index: 100; /* Higher to ensure popover shows above everything */
}

.trends-drop-card__alert-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: rgba(var(--bg-secondary-rgb), 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transform: scale(1);
    transition: opacity 150ms ease, transform 150ms ease, background 150ms ease, color 150ms ease;
}

/* Enhance on card hover */
.trends-drop-card:hover .trends-drop-card__alert-btn {
    opacity: 1;
    background: rgba(var(--bg-secondary-rgb), 0.95);
}

.trends-drop-card__alert-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.trends-drop-card__alert-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    opacity: 1;
    transform: scale(1);
}

.trends-drop-card__alert-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Always visible when alert is active */
.trends-drop-card__alert-btn.is-alert-active {
    opacity: 1;
    transform: scale(1);
    background: var(--accent);
    color: var(--bg-primary);
}

.trends-drop-card__alert-btn.is-alert-active:hover {
    background: var(--accent-hover);
}

.trends-drop-card__alert-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.trends-drop-card__alert-btn--loading {
    pointer-events: none;
    opacity: 0.5;
}

/* Price Alert Popover */
.trends-drop-card__alert-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 300px;
    max-width: min(340px, calc(100vw - 2rem));
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 6px 16px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000; /* Very high to ensure it's above everything */
}

/* Dark mode enhanced popover visibility */
.dark .trends-drop-card__alert-popover,
html.dark .trends-drop-card__alert-popover,
[data-theme="dark"] .trends-drop-card__alert-popover {
    background: var(--bg-primary);
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.trends-drop-card__alert-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.trends-drop-card__alert-popover-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.trends-drop-card__alert-popover-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: all 150ms ease;
}

.trends-drop-card__alert-popover-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.trends-drop-card__alert-popover-body {
    padding: 1rem;
}

.trends-drop-card__alert-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.trends-drop-card__alert-current {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.trends-drop-card__alert-current-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.trends-drop-card__alert-current-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Alert type selection */
.trends-drop-card__alert-types {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.trends-drop-card__alert-type {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 150ms ease;
}

.trends-drop-card__alert-type input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.trends-drop-card__alert-type.is-selected {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent);
}

.trends-drop-card__alert-type-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.trends-drop-card__alert-type.is-selected .trends-drop-card__alert-type-label {
    color: var(--accent);
}

/* Alert input groups */
.trends-drop-card__alert-input-group {
    margin-bottom: 1rem;
}

.trends-drop-card__alert-input-group label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.trends-drop-card__alert-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trends-drop-card__alert-input {
    flex: 1;
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 150ms ease;
}

.trends-drop-card__alert-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.1);
}

.trends-drop-card__alert-input-suffix,
.trends-drop-card__alert-input-prefix {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Alert error message */
.trends-drop-card__alert-error {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(var(--error-rgb), 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.trends-drop-card__alert-error svg {
    flex-shrink: 0;
    color: var(--error);
}

.trends-drop-card__alert-error span {
    font-size: 0.8125rem;
    color: var(--error);
    line-height: 1.4;
}

/* Alert popover footer */
.trends-drop-card__alert-popover-footer {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
}

.trends-drop-card__alert-btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
}

.trends-drop-card__alert-btn-action--cancel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.trends-drop-card__alert-btn-action--cancel:hover {
    background: var(--bg-primary);
    border-color: var(--text-muted);
}

.trends-drop-card__alert-btn-action--create {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: var(--bg-primary);
}

.trends-drop-card__alert-btn-action--create:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.trends-drop-card__alert-btn-action:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Delete button for existing alerts */
.trends-drop-card__alert-btn-action--delete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
}

.trends-drop-card__alert-btn-action--delete:hover:not(:disabled) {
    background-color: var(--error);
    color: #fff;
}

/* Single footer (only delete button) */
.trends-drop-card__alert-popover-footer--single {
    padding-top: 0;
    border-top: none;
    margin-top: 0;
}

/* Active alert info box */
.trends-drop-card__alert-active-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background-color: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.trends-drop-card__alert-active-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.trends-drop-card__alert-active-text {
    flex: 1;
}

.trends-drop-card__alert-active-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.trends-drop-card__alert-active-text strong {
    color: var(--accent);
}

/* Account link */
.trends-drop-card__alert-account-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.trends-drop-card__alert-account-link:hover {
    color: var(--accent);
}

.trends-drop-card__alert-account-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* SSR version: simple link to login - always visible styling */
.trends-drop-card__alert-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: rgba(var(--bg-secondary-rgb), 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    opacity: 0.7;
    transform: scale(1);
    transition: opacity 150ms ease, transform 150ms ease, background 150ms ease, color 150ms ease;
    z-index: 5;
}

/* Enhance on card hover */
.trends-drop-card:hover .trends-drop-card__alert-link {
    opacity: 1;
    background: rgba(var(--bg-secondary-rgb), 0.95);
}

.trends-drop-card__alert-link:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.trends-drop-card__alert-link svg {
    width: 14px;
    height: 14px;
}

/* Deal item alert button (top 10 list)
   Subtle inline design - visible but muted, highlights on hover */
.deal-item__alert-wrapper {
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 0.375rem;
    z-index: 100; /* Ensure popover shows above other deal items */
}

.deal-item__alert-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    opacity: 0.5;
    transition: opacity 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

/* Show more prominently on row hover */
.deal-item:hover .deal-item__alert-btn {
    opacity: 1;
    background: var(--bg-tertiary);
}

.deal-item__alert-btn:hover {
    opacity: 1;
    background: var(--bg-primary);
    color: var(--accent);
    transform: scale(1.1);
}

.deal-item__alert-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    opacity: 1;
}

.deal-item__alert-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Always visible and highlighted when alert is active */
.deal-item__alert-btn.is-alert-active {
    opacity: 1;
    background: var(--accent);
    color: var(--bg-primary);
}

.deal-item__alert-btn.is-alert-active:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.deal-item__alert-btn svg {
    width: 14px;
    height: 14px;
}

/* Deal item alert popover */
.deal-item__alert-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 280px;
    max-width: min(320px, calc(100vw - 2rem));
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000; /* Very high to show above everything */
}

/* Dark mode enhanced popover visibility */
.dark .deal-item__alert-popover,
html.dark .deal-item__alert-popover,
[data-theme="dark"] .deal-item__alert-popover {
    background: var(--bg-primary);
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
    /* On touch devices, always show alert buttons clearly */
    .trends-drop-card__alert-btn,
    .trends-drop-card__alert-link {
        opacity: 0.8;
        transform: scale(1);
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    .trends-drop-card:hover .trends-drop-card__alert-btn,
    .trends-drop-card:hover .trends-drop-card__alert-link {
        opacity: 1;
    }

    .trends-drop-card__alert-btn.is-alert-active,
    .trends-drop-card__alert-link.is-alert-active {
        opacity: 1;
    }

    /* Keep icon legible on mobile */
    .trends-drop-card__alert-btn svg,
    .trends-drop-card__alert-link svg {
        width: 14px;
        height: 14px;
    }

    /* Popover adjustments for mobile */
    .trends-drop-card__alert-popover {
        min-width: 260px;
        left: -0.5rem;
    }

    .trends-drop-card__alert-popover-body {
        padding: 0.75rem;
    }

    .trends-drop-card__alert-types {
        flex-direction: column;
    }

    /* Deal item alert button - always visible on mobile */
    .deal-item__alert-btn {
        opacity: 0.7;
    }

    .deal-item:hover .deal-item__alert-btn {
        opacity: 1;
    }

    .deal-item__alert-btn.is-alert-active {
        opacity: 1;
    }

    .deal-item__alert-wrapper {
        margin-right: 0.25rem;
    }

    .deal-item__alert-btn {
        width: 26px;
        height: 26px;
        min-width: 26px;
    }

    .deal-item__alert-popover {
        right: auto;
        left: 0;
        min-width: 260px;
    }
}

/* Fix deal-item styling when not using <a> wrapper */
.deal-item {
    text-decoration: none;
}

.deal-item__image,
.deal-item__info,
.deal-item__pricing {
    text-decoration: none;
    color: inherit;
}

.deal-item__info {
    cursor: pointer;
}

.deal-item__pricing {
    cursor: pointer;
}

/* ============================================================================
   PRICE ALERT POPOVER - ENHANCED MOBILE & POLISH
   ============================================================================ */

/* Desktop: Refined popover styling */
@media (min-width: 641px) {
    .trends-drop-card__alert-popover,
    .deal-item__alert-popover {
        max-width: 320px;
        border-radius: var(--radius-lg);
        animation: popoverFadeIn 150ms ease-out;
    }

    /* Popover arrow pointing to bell button */
    .trends-drop-card__alert-popover::before {
        content: '';
        position: absolute;
        top: -8px;
        left: 12px;
        width: 14px;
        height: 14px;
        background: var(--bg-secondary);
        border-left: 1px solid var(--border);
        border-top: 1px solid var(--border);
        transform: rotate(45deg);
        z-index: 1;
    }

    /* Dark mode arrow */
    .dark .trends-drop-card__alert-popover::before,
    html.dark .trends-drop-card__alert-popover::before,
    [data-theme="dark"] .trends-drop-card__alert-popover::before {
        background: var(--bg-primary);
    }

    /* Deal item popover arrow - positioned on right side */
    .deal-item__alert-popover::before {
        content: '';
        position: absolute;
        top: -8px;
        right: 12px;
        left: auto;
        width: 14px;
        height: 14px;
        background: var(--bg-secondary);
        border-left: 1px solid var(--border);
        border-top: 1px solid var(--border);
        transform: rotate(45deg);
        z-index: 1;
    }

    /* Dark mode arrow for deal item */
    .dark .deal-item__alert-popover::before,
    html.dark .deal-item__alert-popover::before,
    [data-theme="dark"] .deal-item__alert-popover::before {
        background: var(--bg-primary);
    }

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

    /* Handle popover positioning when near right edge */
    .trends-drop-card:nth-child(2n) .trends-drop-card__alert-wrapper .trends-drop-card__alert-popover,
    .trends-drop-card:last-child .trends-drop-card__alert-wrapper .trends-drop-card__alert-popover {
        left: auto;
        right: 0;
    }

    /* Move arrow to right side when popover is flipped */
    .trends-drop-card:nth-child(2n) .trends-drop-card__alert-wrapper .trends-drop-card__alert-popover::before,
    .trends-drop-card:last-child .trends-drop-card__alert-wrapper .trends-drop-card__alert-popover::before {
        left: auto;
        right: 12px;
    }
}

/* Mobile: Full-width bottom sheet modal */
@media (max-width: 640px) {
    /* Overlay backdrop for mobile - only show when popover is actually open */
    /* Use the .has-popover-open class on parent card instead of :has() which can be unreliable */
    .trends-drop-card.has-popover-open .trends-drop-card__alert-wrapper::before,
    .deal-item.has-popover-open .deal-item__alert-wrapper::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 1;
        pointer-events: auto;
        z-index: 9998;
    }

    /* Bottom sheet style popover */
    .trends-drop-card__alert-popover,
    .deal-item__alert-popover {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        max-width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.25);
        z-index: 9999;
        animation: slideUpSheet 250ms cubic-bezier(0.32, 0.72, 0, 1);
    }

    @keyframes slideUpSheet {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    /* Drag handle indicator for mobile bottom sheet */
    .trends-drop-card__alert-popover::before,
    .deal-item__alert-popover::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    .trends-drop-card__alert-popover-header {
        padding: 1.25rem 1.25rem 1rem;
        padding-top: 1.5rem;
        border-bottom: 1px solid var(--border);
    }

    .trends-drop-card__alert-popover-title {
        font-size: 1.125rem;
    }

    .trends-drop-card__alert-popover-close {
        width: 36px;
        height: 36px;
    }

    .trends-drop-card__alert-popover-body {
        padding: 1.25rem;
        max-height: 55vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .trends-drop-card__alert-description {
        font-size: 0.9375rem;
        margin-bottom: 1rem;
    }

    .trends-drop-card__alert-current {
        padding: 0.75rem 1rem;
        margin-bottom: 1.25rem;
    }

    .trends-drop-card__alert-current-label {
        font-size: 0.875rem;
    }

    .trends-drop-card__alert-current-value {
        font-size: 1.0625rem;
    }

    .trends-drop-card__alert-types {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .trends-drop-card__alert-type {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .trends-drop-card__alert-type-label {
        font-size: 0.9375rem;
    }

    .trends-drop-card__alert-input-group {
        margin-bottom: 1.25rem;
    }

    .trends-drop-card__alert-input-group label {
        font-size: 0.9375rem;
        margin-bottom: 0.625rem;
    }

    .trends-drop-card__alert-input {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md);
    }

    .trends-drop-card__alert-input-suffix,
    .trends-drop-card__alert-input-prefix {
        font-size: 1rem;
    }

    .trends-drop-card__alert-error {
        padding: 1rem;
        margin-bottom: 1.25rem;
        border-radius: var(--radius-md);
    }

    .trends-drop-card__alert-error span {
        font-size: 0.9375rem;
    }

    .trends-drop-card__alert-popover-footer {
        padding: 1rem 1.25rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--border);
        margin-top: 0;
        gap: 0.75rem;
    }

    .trends-drop-card__alert-btn-action {
        min-height: 48px;
        font-size: 1rem;
        border-radius: var(--radius-md);
    }

    /* Bell button touch target - larger and always visible on mobile */
    .trends-drop-card__alert-btn,
    .trends-drop-card__alert-link,
    .deal-item__alert-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        opacity: 0.8;
        transform: scale(1);
    }

    .trends-drop-card__alert-btn svg,
    .trends-drop-card__alert-link svg,
    .deal-item__alert-btn svg {
        width: 16px;
        height: 16px;
    }

    .trends-drop-card__alert-btn.is-alert-active,
    .deal-item__alert-btn.is-alert-active {
        opacity: 1;
    }
}

/* Success state styling */
.trends-drop-card__alert-success {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(var(--success-rgb), 0.1);
    border: 1px solid rgba(var(--success-rgb), 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    animation: successPulse 300ms ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.trends-drop-card__alert-success svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--success);
}

.trends-drop-card__alert-success-text {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Enhanced focus states for accessibility */
.trends-drop-card__alert-type:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.trends-drop-card__alert-btn-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Loading state for buttons */
.trends-drop-card__alert-btn-action--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.trends-drop-card__alert-btn-action--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: buttonSpinner 600ms linear infinite;
}

.trends-drop-card__alert-btn-action--create.trends-drop-card__alert-btn-action--loading::after {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}

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

/* Smooth input transitions */
.trends-drop-card__alert-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.trends-drop-card__alert-input:hover:not(:focus) {
    border-color: var(--text-muted);
}

/* Type selection hover state */
.trends-drop-card__alert-type:hover:not(.is-selected) {
    background: var(--bg-primary);
    border-color: var(--text-muted);
}

/* Ensure popover doesn't overflow viewport on small screens */
@media (max-width: 400px) {
    .trends-drop-card__alert-popover-body {
        padding: 1rem;
    }

    .trends-drop-card__alert-popover-footer {
        padding: 0.875rem 1rem;
        padding-bottom: calc(0.875rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ============================================================================
   PRICE ALERT ONBOARDING MODAL (imported from single-product)
   ============================================================================ */

.price-alert-onboarding {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 200ms ease;
}

.price-alert-onboarding.is-visible {
    opacity: 1;
}

.price-alert-onboarding__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.price-alert-onboarding__content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl, 16px);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px) scale(0.95);
    transition: transform 200ms ease;
}

.price-alert-onboarding.is-visible .price-alert-onboarding__content {
    transform: translateY(0) scale(1);
}

.price-alert-onboarding__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover, var(--accent)) 100%);
    border-radius: 50%;
    color: var(--bg-primary);
    animation: bellRing 600ms ease-out 300ms;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-10deg); }
}

.price-alert-onboarding__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.price-alert-onboarding__text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
}

.price-alert-onboarding__features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.price-alert-onboarding__feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md, 8px);
}

.price-alert-onboarding__feature svg {
    flex-shrink: 0;
    color: var(--success);
}

.price-alert-onboarding__feature span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.price-alert-onboarding__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-alert-onboarding__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
}

.price-alert-onboarding__btn--primary {
    background: var(--accent);
    border: none;
    color: var(--bg-primary);
}

.price-alert-onboarding__btn--primary:hover {
    background: var(--accent-hover, var(--accent));
    transform: translateY(-1px);
}

.price-alert-onboarding__btn--secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.price-alert-onboarding__btn--secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .price-alert-onboarding__content {
        padding: 1.5rem;
    }
    
    .price-alert-onboarding__icon {
        width: 64px;
        height: 64px;
        margin-bottom: 1rem;
    }
    
    .price-alert-onboarding__icon svg {
        width: 36px;
        height: 36px;
    }
    
    .price-alert-onboarding__title {
        font-size: 1.25rem;
    }
    
    .price-alert-onboarding__text {
        font-size: 0.875rem;
    }
}
