/* ============================================
   PALLETS LISTING COMPONENTS
   ============================================
   Styles for the pallets index page including
   filters, product cards, and table views.
   ============================================ */

/* ===========================
   Earnings Box Animation
   =========================== */
@keyframes shine {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.earnings-box {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        #d4edda 0%,
        #d4edda 40%,
        #e8f5e9 50%,
        #d4edda 60%,
        #d4edda 100%
    );
    background-size: 200% 100%;
    animation: shine 3s ease-in-out infinite;
    border: 2px solid var(--color-success);
    border-radius: var(--radius-md);
    padding: var(--spacing-30);
    text-align: center;
}

.earnings-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s ease-in-out infinite;
}

.earnings-box__label {
    color: var(--color-success-800);
    font-weight: var(--font-weight-semibold);
    position: relative;
    z-index: 1;
    font-size: var(--font-size-sm);
}

.earnings-box__value {
    font-size: 24px;
    font-weight: var(--font-weight-bold);
    color: var(--color-success);
    position: relative;
    z-index: 1;
}

.earnings-box__margin {
    color: var(--color-success-800);
    position: relative;
    z-index: 1;
    font-size: var(--font-size-sm);
}

/* ===========================
   noUiSlider Overrides
   =========================== */
#priceSlider {
    height: 20px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    background: var(--color-gray-100);
    box-shadow: none;
}

#priceSlider .noUi-connect {
    background: var(--color-primary);
    border-radius: 100px;
}

#priceSlider .noUi-handle {
    width: 32px;
    height: 32px;
    border-radius: 100px;
    background: linear-gradient(to bottom, #555, #454545);
    box-shadow: inset -2px -2px 6px 2px rgba(0,0,0,0.1);
    border: none;
    cursor: grab;
    top: -7px;
    right: -16px;
}

#priceSlider .noUi-handle:hover {
    background: linear-gradient(to bottom, #666, #555);
}

#priceSlider .noUi-handle:active {
    cursor: grabbing;
}

#priceSlider .noUi-handle::before,
#priceSlider .noUi-handle::after {
    display: none;
}

sup {
    font-size: 80%;
    vertical-align: top;
    position: relative;
    top: 1px;
}

/* ===========================
   Price Slider
   =========================== */
.price-slider {
    position: relative;
    padding: 60px 20px 40px;
}

.price-slider__display {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    display: flex;
}

.price-slider__value {
    padding: 10px 15px;
    min-width: 80px;
    text-align: center;
}

.price-slider__divider {
    width: 1px;
    height: 35px;
    background: var(--color-border);
    align-self: center;
}

.price-slider__arrow {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 6px solid var(--color-border);
    z-index: 9;
}


.price-slider__markers {
    position: relative;
    margin-top: 16px;
}

.price-slider__marker {
    position: absolute;
    font-size: 12px;
    color: var(--color-text-secondary);
    transform: translateX(-50%);
}

.price-slider__marker--start {
    left: 0;
}

.price-slider__marker--25 {
    left: 25%;
}

.price-slider__marker--50 {
    left: 50%;
}

.price-slider__marker--75 {
    left: 75%;
}

.price-slider__marker--end {
    right: 0;
    left: auto;
    transform: translateX(50%);
}

/* ===========================
   Filters
   =========================== */
.filters-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-20);
    align-items: end;
    margin-bottom: var(--spacing-30);
}

@media (max-width: 768px) {
    .filters-row {
        grid-template-columns: 1fr;
    }
}

.filter-label {
    display: block;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-30);
}

.filter-actions {
    display: flex;
    gap: var(--spacing-30);
}

.filter-actions .form-control {
    flex: 1;
}

/* ===========================
   View Toggle
   =========================== */
.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-40);
}

.view-count {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.view-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-left: auto;
}

.view-toggle-btn {
    padding: 10px 14px;
    background: var(--color-white);
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:not(:last-child) {
    border-right: 1px solid var(--color-border);
}

.view-toggle-btn:hover {
    background: var(--color-gray-100);
    color: var(--color-text-primary);
}

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

.view-toggle-btn.active:hover {
    background: #7c3aed;
    color: var(--color-white);
}

/* ===========================
   Product Cards
   =========================== */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card-link:hover .product-card {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--color-secondary);
}

.product-card-link:hover .product-card__image img {
    transform: scale(1.05);
}

.product-card-link:hover .btn-primary {
    background-color: var(--color-primary);
}

.product-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--color-white);
}

.product-card__image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--color-gray-100);
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.product-card__body {
    padding: var(--spacing-50);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card__badge {
    background-color: var(--color-secondary);
    color: var(--color-white);
    padding: var(--spacing-20) var(--spacing-30);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    display: inline-block;
}

.product-card__subtitle {
    color: var(--color-text-secondary);
    font-style: italic;
}

.product-card__lot-info {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
}

.product-card__details {
    border-top: 1px solid var(--color-border-light);
    padding-top: var(--spacing-30);
}

.product-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.product-card__price-label {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.product-card__price {
    font-size: var(--font-size-lg);
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
}

/* ===========================
   Product Table
   =========================== */
.product-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.product-table th {
    padding: 16px;
    text-align: left;
    font-weight: var(--font-weight-semibold);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
    background: var(--color-gray-50);
    border-bottom: 2px solid var(--color-border);
}

.product-table th.text-center {
    text-align: center;
}

.product-table th.text-right {
    text-align: right;
}

.product-table__sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.product-table__sortable:hover {
    color: var(--color-primary);
}

.product-table__sort-icon {
    font-size: 10px;
    margin-left: 2px;
}

.product-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-light);
}

.product-table__row {
    transition: background 0.15s ease;
    cursor: pointer;
}

.product-table__row:hover {
    background: var(--color-gray-50);
}

.product-table__row:hover .btn-primary {
    background-color: var(--color-primary);
}

.product-table__image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-gray-100);
}

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

.product-table__image--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-300);
}

.product-table__title {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.product-table__subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-style: italic;
}

.product-table__lot {
    font-size: 11px;
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    margin-top: 4px;
}

.product-table__category {
    background-color: var(--color-secondary);
    color: var(--color-white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    display: inline-block;
    text-align: center;
}

.product-table__price {
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    font-size: 16px;
}

.product-table__unit-price {
    font-size: 11px;
    color: var(--color-gray-500);
}

.product-table__retail {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.product-table__profit {
    font-weight: var(--font-weight-bold);
    color: var(--color-success);
    font-size: 15px;
}

.product-table__margin {
    font-size: 11px;
    color: var(--color-success);
}

.product-table__empty {
    color: var(--color-gray-300);
}

/* ===========================
   Empty State
   =========================== */
.pallets-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-80);
}

.pallets-empty--table {
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
}

.pallets-empty__text {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
}

/* ===========================
   Pallet Detail - Promotion Banner
   =========================== */
.pallet-promo-banner {
    background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
    color: white;
    padding: var(--spacing-30) var(--spacing-40);
    border-radius: var(--radius-medium) var(--radius-medium) 0 0;
    text-align: center;
}

.pallet-promo-banner__content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-15);
    flex-wrap: wrap;
}

.pallet-promo-banner__icon {
    font-size: 24px;
}

.pallet-promo-banner__discount {
    font-size: var(--font-size-large);
    font-weight: 700;
}

.pallet-promo-banner__text {
    opacity: 0.95;
}

.pallet-promo-banner__code {
    background: rgba(255, 255, 255, 0.25);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-family: 'Courier New', monospace;
    font-weight: 700;
    margin-left: 4px;
    letter-spacing: 0.5px;
}

.pallet-promo-banner__ends {
    font-size: var(--font-size-small);
    opacity: 0.9;
    margin-top: var(--spacing-10);
}

/* ===========================
   Pallet Detail - Price Box
   =========================== */
.pallet-price-box {
    background-color: var(--color-vivid-purple);
    color: var(--color-white);
    padding: var(--spacing-50);
    border-radius: var(--radius-medium);
    margin-bottom: var(--spacing-40);
}

.pallet-price-box--with-promo {
    border-radius: 0 0 var(--radius-medium) var(--radius-medium);
}

.pallet-price-box__header {
    text-align: center;
    margin-bottom: var(--spacing-30);
}

.pallet-price-box__label {
    font-size: var(--font-size-small);
    opacity: 0.8;
    margin-bottom: var(--spacing-10);
}

.pallet-price-box__original {
    text-decoration: line-through;
    opacity: 0.6;
    font-size: var(--font-size-large);
    margin-bottom: var(--spacing-10);
}

.pallet-price-box__price {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
}

.pallet-price-box__price--discounted {
    color: #86efac;
}

.pallet-price-box__savings {
    font-size: var(--font-size-small);
    color: #86efac;
    margin-top: var(--spacing-15);
    font-weight: 600;
}

/* ===========================
   Pallet Detail - Promo Code Box
   =========================== */
.pallet-promo-code {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-medium);
    padding: var(--spacing-30);
    text-align: center;
    margin-top: var(--spacing-30);
}

.pallet-promo-code__hint {
    font-size: var(--font-size-small);
    opacity: 0.9;
    margin-bottom: var(--spacing-15);
}

.pallet-promo-code__wrapper {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-15);
    background: rgba(0, 0, 0, 0.25);
    padding: var(--spacing-15) var(--spacing-30);
    border-radius: var(--radius-full);
}

.pallet-promo-code__code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: var(--font-size-medium);
    letter-spacing: 1px;
}

.pallet-promo-code__copy {
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    opacity: 0.8;
    padding: 0;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
}

.pallet-promo-code__copy:hover {
    opacity: 1;
}

.pallet-promo-code__feedback {
    font-size: 12px;
    color: #86efac;
    margin-top: var(--spacing-10);
    display: none;
}

.pallet-promo-code__feedback--visible {
    display: block;
}

/* ===========================
   Pallet Detail - Trust Signals
   =========================== */
.pallet-trust-signals {
    display: flex;
    justify-content: center;
    gap: var(--spacing-40);
    margin-top: var(--spacing-30);
    font-size: var(--font-size-small);
    opacity: 0.8;
}

.pallet-trust-signals__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-10);
}

/* ===========================
   Pallet Detail - Add to Basket Button
   =========================== */
.pallet-add-btn {
    background-color: var(--color-white);
    color: var(--color-vivid-purple);
    font-weight: 700;
    width: 100%;
    padding: var(--spacing-40);
    font-size: var(--font-size-medium);
    border: none;
    border-radius: var(--radius-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pallet-add-btn:hover {
    background-color: #f3f4f6;
    transform: translateY(-1px);
}

.pallet-add-btn--in-basket {
    background-color: var(--color-success);
    color: var(--color-white);
    text-decoration: none;
    display: block;
    text-align: center;
}

.pallet-add-btn--in-basket:hover {
    background-color: #059669;
}

/* ===========================
   Pallet Detail - Was/Now Price
   =========================== */
.pallet-price-box__was-price {
    text-decoration: line-through;
    opacity: 0.6;
    font-size: var(--font-size-large);
    margin-bottom: var(--spacing-10);
}

.pallet-price-box__reduction {
    color: #86efac;
    font-size: var(--font-size-small);
    font-weight: 600;
    margin-top: var(--spacing-15);
}
