/* 
   ==========================================================================
   4-components.css
   ==========================================================================
   This file contains reusable UI components.
   It includes:
   - CTA Buttons
   - Inputs and Selects
   - Product Cards
   - Product Details Components (Carousel, Features)
*/

/* ----------------------------------------------------- */
/* BUTTONS & INPUTS */
/* ----------------------------------------------------- */
.cta-button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: bold;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-block;
}

.cta-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
}

/* Custom Select Dropdown Styling */
.sort-select {
    padding: 0.6rem 2rem 0.6rem 1rem;
    border-radius: 50px;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid #444;
    cursor: pointer;
    font-size: 0.9rem;
    appearance: none;
    /* Remove default browser arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Custom SVG Arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ff4500%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.65em auto;
    transition: var(--transition);
    min-width: 140px;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.2);
}

/* ----------------------------------------------------- */
/* PRODUCT CARD COMPONENT */
/* ----------------------------------------------------- */
.product-card {
    flex: 1 1 240px;
    /* Grow, shrink, basis */
    max-width: 280px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    /* For badge positioning */
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff0000;
    color: white;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.product-image-wrapper {
    width: 100%;
    overflow: hidden;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background-color: transparent;
}

.product-card img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    transition: var(--transition);
    display: block;
}

.product-card:hover img {
    transform: scale(1.05);
    /* Zoom effect on hover */
}

.product-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.product-card .price {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 1rem;
    display: block;
}

/* ----------------------------------------------------- */
/* PRODUCT DETAILS COMPONENTS */
/* ----------------------------------------------------- */

/* Carousel Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px 15px;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 5px;
    transition: var(--transition);
    user-select: none;
    z-index: 5;
}

.carousel-arrow:hover {
    background-color: var(--primary-color);
}

.carousel-arrow.left {
    left: 10px;
}

.carousel-arrow.right {
    right: 10px;
}

/* Product Features List */
.product-features {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #333;
}

.product-features h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.product-features ul {
    padding: 0;
    list-style: none;
}

.product-features li {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #333;
    padding-bottom: 0.5rem;
}

.product-features li:last-child {
    border-bottom: none;
}

.product-features li strong {
    color: #ccc;
}

/* Option Buttons (Color, Size etc.) */
.option-group {
    margin-bottom: 1.5rem;
}

.option-group h4 {
    margin-bottom: 0.5rem;
    color: var(--heading-color);
}

.option-btn {
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #444;
    background-color: #2a2a2a;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.option-btn:hover,
.option-btn.selected {
    border-color: var(--primary-color);
    color: white;
}

.option-btn.selected {
    background-color: rgba(255, 69, 0, 0.2);
}

/* ----------------------------------------------------- */
/* LOADING SPINNER */
/* ----------------------------------------------------- */
.loader-wrapper {
    display: none;
    /* Hidden by default */
    width: 100%;
    text-align: center;
    padding: 3rem;
}

.loader {
    border: 5px solid #333;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ----------------------------------------------------- */
/* LIGHTBOX MODAL */
/* ----------------------------------------------------- */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: hidden;
}

.lightbox-modal.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: var(--transition);
    line-height: 1;
}

.lightbox-close:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Enable pinch-to-zoom on mobile */
    touch-action: pinch-zoom pan-x pan-y;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    /* Allow zooming on mobile */
    touch-action: pinch-zoom;
}

.lightbox-video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    background-color: #000;
}

.lightbox-nav {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    pointer-events: none;
    z-index: 10000;
}

.lightbox-arrow {
    color: #fff;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    transition: var(--transition);
    pointer-events: auto;
    user-select: none;
}

.lightbox-arrow:hover {
    background-color: var(--primary-color);
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
}

/* ----------------------------------------------------- */
/* VIDEO THUMBNAIL INDICATOR */
/* ----------------------------------------------------- */
.media-thumbnail-wrapper {
    position: relative;
    cursor: pointer;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 69, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
}

.video-play-overlay::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid #fff;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 5px;
}

.media-thumbnail-wrapper:hover .video-play-overlay,
.main-media-wrapper:hover .video-play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: var(--primary-color);
}

/* Main media wrapper for videos in product details */
.main-media-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.main-media-wrapper video {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    cursor: pointer;
    border-radius: 8px;
}

/* Video play overlay in thumbnails - no pointer events */
.thumbnail-item .video-play-overlay {
    pointer-events: none;
}

/* Clickable product image in details view */
.product-image-section img {
    cursor: zoom-in;
}

.product-image-section video {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    cursor: pointer;
    border-radius: 8px;
}

/* Media type indicator on carousel */
.media-type-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(255, 69, 0, 0.9);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
    text-transform: uppercase;
}

/* ----------------------------------------------------- */
/* THUMBNAIL STRIP (for multiple images/videos) */
/* ----------------------------------------------------- */
.thumbnail-strip {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.thumbnail-item {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    border-color: var(--primary-color);
}

.thumbnail-item img,
.thumbnail-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item .video-play-overlay {
    width: 24px;
    height: 24px;
}

.thumbnail-item .video-play-overlay::after {
    border-left-width: 8px;
    border-top-width: 5px;
    border-bottom-width: 5px;
    margin-left: 2px;
}