/**
 * Product Addons Carousel Styles
 * Slick carousel integration with theme color #1F2E44
 * _____________________________________________
 */

/* ============================================
   1. CAROUSEL CONTAINER STYLES
   ============================================ */

.product-addons.carousel-mode {
    position: relative;
    padding: 0;
    margin: 0;
}

.addons-carousel {
    position: relative;
    margin: 0 45px;
    padding: 12px 0;
}

.addons-carousel .addon-card {
    margin: 0 8px;
    outline: none;
    opacity: 1;
    visibility: visible;
}

/* Ensure cards are visible in carousel mode */
.product-addons.carousel-mode .addon-card {
    display: block !important;
}

/* ============================================
   2. SLICK ARROW STYLES
   ============================================ */

.addons-carousel .slick-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    padding: 0;
    text-indent: -9999px;
}

.addons-carousel .slick-arrow:before {
    font-family: 'bootstrap-icons', sans-serif;
    font-size: 16px;
    color: #333;
    opacity: 1;
    text-indent: 0;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.addons-carousel .slick-arrow:hover {
    background-color: #1F2E44;
    border-color: #1F2E44;
    transform: translateY(-50%);
}

.addons-carousel .slick-arrow:hover:before {
    color: #fff;
}

.addons-carousel .slick-prev {
    left: -20px;
}

.addons-carousel .slick-prev:before {
    content: '\f284';
}

.addons-carousel .slick-next {
    right: -20px;
}

.addons-carousel .slick-next:before {
    content: '\f285';
}

/* Focus state for accessibility */
.addons-carousel .slick-arrow:focus {
    outline: 2px solid #1F2E44;
    outline-offset: 3px;
}

/* Disabled state */
.addons-carousel .slick-arrow.slick-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   3. SLICK DOTS STYLES
   ============================================ */

.slick-dots {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 0 0;
    margin: 0;
    list-style: none;
}

.slick-dots li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.slick-dots li button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #1F2E44;
    background: transparent;
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    padding: 0;
    transition: all 0.3s ease;
    display: block;
}

.slick-dots li button:before {
    display: none;
}

/* Hover state for dots */
.slick-dots li button:hover {
    background: rgba(31, 46, 68, 0.5);
    transform: scale(1.2);
}

/* Active dot */
.slick-dots li.slick-active button {
    background: #1F2E44;
    transform: scale(1.3);
}

/* Focus state for accessibility */
.slick-dots li button:focus {
    outline: 2px solid #1F2E44;
    outline-offset: 2px;
}

/* ============================================
   4. LOADING STATE
   ============================================ */

.slick-loading {
    opacity: 0.5;
    pointer-events: none;
}

.slick-initialized {
    opacity: 0;
    animation: fadeInCarousel 0.4s ease forwards;
}

@keyframes fadeInCarousel {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Loading spinner */
.slick-loading .slick-list {
    position: relative;
}

.slick-loading .slick-list:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1F2E44;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   5. CARD HEIGHT CONSISTENCY
   ============================================ */

.slick-track {
    display: flex;
    align-items: flex-start;
}

.slick-slide {
    display: flex;
    height: auto;
    align-items: flex-start;
}

.slick-slide > div {
    display: flex;
    width: 100%;
    height: auto;
    padding: 5px !important;
}

.slick-slide .addon-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
}

/* Limit expanded details height */
.slick-slide .addon-card .addon-details {
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1F2E44 #f0f0f0;
}

.slick-slide .addon-card .addon-details::-webkit-scrollbar {
    width: 6px;
}

.slick-slide .addon-card .addon-details::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.slick-slide .addon-card .addon-details::-webkit-scrollbar-thumb {
    background: #1F2E44;
    border-radius: 3px;
}

/* ============================================
   6. ACCESSIBILITY STYLES
   ============================================ */

/* Focus visible for keyboard navigation */
.slick-arrow:focus-visible {
    outline: 3px solid #1F2E44;
    outline-offset: 4px;
}

.slick-dots li button:focus-visible {
    outline: 3px solid #1F2E44;
    outline-offset: 3px;
}

/* Skip focus on mouse click */
.slick-arrow:focus:not(:focus-visible) {
    outline: none;
}

.slick-dots li button:focus:not(:focus-visible) {
    outline: none;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   7. RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Tablet: max-width 1024px */
@media (max-width: 1024px) {
    .addons-carousel {
        margin: 0 40px;
    }

    .addons-carousel .slick-arrow {
        width: 38px;
        height: 38px;
    }

    .addons-carousel .slick-prev {
        left: -19px;
    }

    .addons-carousel .slick-next {
        right: -19px;
    }

    .addons-carousel .slick-arrow:before {
        font-size: 14px;
    }

    .slick-dots {
        padding: 18px 0 0;
        gap: 5px;
    }

    .slick-dots li button {
        width: 11px;
        height: 11px;
    }
}

/* Mobile: max-width 768px */
@media (max-width: 768px) {
    .addons-carousel {
        margin: 0 30px;
        padding: 8px 0;
    }

    /* Keep arrows visible on mobile */
    .addons-carousel .slick-arrow {
        width: 35px !important;
        height: 35px !important;
        display: flex !important;
    }

    .addons-carousel .slick-prev {
        left: -15px !important;
    }

    .addons-carousel .slick-next {
        right: -15px !important;
    }

    .addons-carousel .slick-arrow:before {
        font-size: 13px !important;
    }

    /* Remove card margins on mobile */
    .addons-carousel .addon-card {
        margin: 0 4px;
    }

    /* Adjust dots for mobile */
    .slick-dots {
        padding: 16px 0 0;
        gap: 4px;
    }

    .slick-dots li button {
        width: 10px;
        height: 10px;
        border-width: 1.5px;
    }

    .slick-dots li.slick-active button {
        transform: scale(1.2);
    }

    .slick-dots li button:hover {
        transform: scale(1.15);
    }

    /* Adjust expanded details height for mobile */
    .slick-slide .addon-card .addon-details {
        max-height: 120px;
    }
}

/* Extra small mobile: max-width 480px */
@media (max-width: 480px) {
    .addons-carousel {
        margin: 0 25px;
    }

    .addons-carousel .slick-arrow {
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
    }

    .addons-carousel .slick-prev {
        left: -13px !important;
    }

    .addons-carousel .slick-next {
        right: -13px !important;
    }

    .addons-carousel .slick-arrow:before {
        font-size: 12px !important;
    }

    .addons-carousel .addon-card {
        margin: 0 2px;
    }

    .slick-dots {
        padding: 14px 0 0;
        gap: 3px;
    }

    .slick-dots li button {
        width: 9px;
        height: 9px;
    }

    .slick-slide .addon-card .addon-details {
        max-height: 100px;
    }
}

/* ============================================
   8. SLICK SLIDER BASE OVERRIDES
   ============================================ */

/* Reset default slick slider spacing */
.slick-list {
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.slick-track {
    position: relative;
    top: 0;
    left: 0;
    margin-left: auto;
    margin-right: auto;
}

/* Smooth transitions */
.slick-slide {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Center mode adjustments (if enabled) */
.slick-center {
    transform: scale(1.05);
    z-index: 10;
}

/* Ensure proper spacing between slides */
.slick-slide > div {
    padding: 0;
}

/* ============================================
   9. ADDITIONAL ENHANCEMENTS
   ============================================ */

/* Prevent layout shift during initialization */
.product-addons.carousel-mode:not(.slick-initialized) .addon-card:not(:first-child) {
    display: none;
}

/* Smooth hover transition for cards in carousel */
.addons-carousel .addon-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.addons-carousel .addon-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 46, 68, 0.15);
}

/* Ensure buttons are above cards */
.slick-arrow,
.slick-dots {
    z-index: 101;
}

/* Handle RTL (Right-to-Left) support if needed */
[dir="rtl"] .slick-prev {
    left: auto;
    right: -25px;
}

[dir="rtl"] .slick-next {
    right: auto;
    left: -25px;
}

[dir="rtl"] .slick-prev:before {
    content: '\203A';
    margin-right: 0;
    margin-left: 2px;
}

[dir="rtl"] .slick-next:before {
    content: '\2039';
    margin-left: 0;
    margin-right: 2px;
}

/* ============================================
   10. PRINT STYLES
   ============================================ */

@media print {
    .slick-arrow,
    .slick-dots {
        display: none !important;
    }

    .addons-carousel {
        margin: 0;
    }

    .product-addons.carousel-mode .addon-card {
        page-break-inside: avoid;
    }
}
