/**
 * Amazon Products Scroller - Frontend Styles
 * @version 2.0.0
 */

/* ========================================
   COMMON COMPONENTS
======================================== */

.aps-scroller-container,
.aps-grid-container,
.aps-single-container,
.aps-rows-container {
    max-width: 100%;
    margin: 30px 0;
}

/* Product Card Base */
.aps-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.aps-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: #ff9900;
}

.aps-product-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* Product Image */
.aps-product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #f9f9f9;
    overflow: hidden;
}

.aps-product-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.aps-product-card:hover .aps-product-img {
    transform: translate(-50%, -50%) scale(1.05);
}

.aps-no-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #c3c4c7;
}

/* Product Details */
.aps-product-details {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.aps-product-brand {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aps-product-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 40px;
}

/* Star Rating */
.aps-product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.aps-stars {
    position: relative;
    display: inline-block;
    color: #ffa41c;
    font-size: 16px;
    line-height: 1;
}

.aps-stars-empty {
    color: #e0e0e0;
}

.aps-stars-filled {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    white-space: nowrap;
}

.aps-review-count {
    font-size: 12px;
    color: #646970;
}

/* Price */
.aps-product-pricing {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.aps-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #B12704;
}

.aps-product-list-price {
    font-size: 14px;
    color: #646970;
    text-decoration: line-through;
}

.aps-product-savings {
    font-size: 12px;
    color: #007600;
    font-weight: 600;
}

/* Prime Badge */
.aps-prime-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
}

.aps-prime-badge-small {
    display: inline-block;
    background: #00a8e1;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
}

/* Buy Button */
.aps-product-button {
    display: inline-block;
    background: #ff9900;
    color: #111;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: background 0.3s ease;
    margin-top: auto;
}

.aps-product-card:hover .aps-product-button {
    background: #fa8900;
}

.aps-button-large {
    padding: 12px 24px;
    font-size: 16px;
}

/* Availability */
.aps-product-availability {
    font-size: 12px;
    color: #007600;
}

/* Features */
.aps-product-features {
    font-size: 13px;
    margin: 10px 0;
    padding-left: 20px;
}

.aps-product-features li {
    margin-bottom: 5px;
}

.aps-product-description {
    font-size: 13px;
    color: #646970;
    line-height: 1.5;
}

/* ========================================
   HORIZONTAL SLIDER
======================================== */

.aps-layout-horizontal {
    position: relative;
    padding: 0 50px;
}

.aps-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aps-nav:hover {
    background: #f0f0f0;
    border-color: #999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.aps-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.aps-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.aps-nav:disabled:hover {
    background: #fff;
    border-color: #ddd;
}

.aps-nav-prev { left: 0; }
.aps-nav-next { right: 0; }

.aps-nav svg {
    color: #333;
}

.aps-scroller-wrapper {
    overflow: hidden;
    margin: 0;
}

.aps-scroller-track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease;
}

.aps-layout-horizontal .aps-product-card {
    flex: 0 0 auto;
    width: calc(25% - 15px);
}

/* Dots */
.aps-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.aps-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.aps-dot:hover {
    background: #999;
}

.aps-dot.active {
    background: #ff9900;
}

/* ========================================
   VERTICAL SLIDER
======================================== */

.aps-layout-vertical {
    position: relative;
    padding: 50px 0;
    max-width: 400px;
    margin: 30px auto;
}

.aps-layout-vertical .aps-nav-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.aps-layout-vertical .aps-nav-down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.aps-vscroller-wrapper {
    overflow: hidden;
    height: auto;
}

.aps-vscroller-track {
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: transform 0.5s ease;
}

/* ========================================
   GRID LAYOUT
======================================== */

.aps-layout-grid .aps-grid {
    display: grid;
    gap: 20px;
}

.aps-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.aps-page-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.aps-page-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #999;
}

.aps-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aps-page-numbers {
    display: flex;
    gap: 5px;
}

.aps-page-number {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aps-page-number:hover {
    background: #f0f0f0;
    border-color: #999;
}

.aps-page-number.active {
    background: #ff9900;
    color: #fff;
    border-color: #ff9900;
}

/* ========================================
   SINGLE PRODUCT LAYOUT
======================================== */

.aps-layout-single {
    max-width: 1200px;
    margin: 30px auto;
}

.aps-single-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
}

.aps-single-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.aps-single-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.aps-single-details .aps-product-title {
    font-size: 28px;
    min-height: auto;
    -webkit-line-clamp: unset;
}

.aps-single-details .aps-product-price {
    font-size: 32px;
}

.aps-single-details .aps-product-features h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Single Size Variations */
.aps-size-small .aps-single-product {
    grid-template-columns: 200px 1fr;
    gap: 20px;
    padding: 20px;
}

.aps-size-small .aps-single-details .aps-product-title {
    font-size: 18px;
}

.aps-size-small .aps-single-details .aps-product-price {
    font-size: 24px;
}

.aps-size-large .aps-single-product {
    padding: 50px;
}

.aps-size-large .aps-single-details .aps-product-title {
    font-size: 36px;
}

/* ========================================
   PRODUCT ROW LAYOUT
======================================== */

.aps-product-row {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.aps-product-row:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: #ff9900;
}

.aps-product-row.aps-image-right {
    grid-template-columns: 1fr 300px;
}

.aps-product-row.aps-image-right .aps-row-image {
    order: 2;
}

.aps-row-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.aps-row-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aps-row-details .aps-product-title {
    font-size: 24px;
    min-height: auto;
    -webkit-line-clamp: unset;
}

.aps-row-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.aps-row-details .aps-product-description {
    font-size: 14px;
    line-height: 1.6;
}

.aps-row-details .aps-product-features {
    margin: 0;
    padding-left: 20px;
}

.aps-row-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

/* ========================================
   DISCLOSURE
======================================== */

.aps-disclosure {
    text-align: center;
    font-size: 11px;
    color: #646970;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-style: italic;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
======================================== */

/* Horizontal Slider Responsive */
@media (max-width: 1024px) {
    .aps-layout-horizontal .aps-product-card {
        width: calc(33.333% - 14px);
    }
}

@media (max-width: 768px) {
    .aps-layout-horizontal {
        padding: 0 40px;
    }

    .aps-layout-horizontal .aps-product-card {
        width: calc(50% - 10px);
    }

    .aps-nav {
        width: 36px;
        height: 36px;
    }

    .aps-nav svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .aps-layout-horizontal {
        padding: 0 35px;
    }

    .aps-layout-horizontal .aps-product-card {
        width: 100%;
    }

    .aps-scroller-track {
        gap: 0;
    }
}

/* Grid Responsive */
@media (max-width: 1024px) {
    .aps-layout-grid .aps-grid[style*="grid-template-columns"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .aps-layout-grid .aps-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    .aps-pagination {
        flex-wrap: wrap;
    }

    .aps-page-numbers {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .aps-layout-grid .aps-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Single Product Responsive */
@media (max-width: 768px) {
    .aps-single-product {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .aps-size-small .aps-single-product {
        grid-template-columns: 1fr;
    }

    .aps-single-details .aps-product-title {
        font-size: 20px;
    }
}

/* Product Row Responsive */
@media (max-width: 768px) {
    .aps-product-row,
    .aps-product-row.aps-image-right {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .aps-product-row.aps-image-right .aps-row-image {
        order: 0;
    }

    .aps-row-details .aps-product-title {
        font-size: 18px;
    }

    .aps-row-footer {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

/* ========================================
   ACCESSIBILITY
======================================== */

.aps-product-card:focus-within {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.aps-nav:focus,
.aps-page-btn:focus,
.aps-page-number:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ========================================
   LOADING STATES
======================================== */

.aps-product-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.aps-product-img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

.aps-product-img[src] {
    opacity: 1;
}

/* ========================================
   PRINT STYLES
======================================== */

@media print {
    .aps-nav,
    .aps-dots,
    .aps-pagination {
        display: none !important;
    }

    .aps-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
