/* Bike Comparison Widget Styles */
.bike-comparison-widget {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: visible;
}

/* When used inside GASP ScrollTrigger */
.gasp-image-step .bike-comparison-widget {
    background: transparent;
    max-width: 100%;
}

.gasp-image-area .bike-comparison-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header Section with Title and Options */
.bike-comparison-header {
    padding: 30px 40px 20px;
    position: relative;
}

/* Transition Settings */
.transition-settings {
    position: absolute;
    top: 20px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 10;
}

.transition-settings label {
    font-weight: 600;
    color: #666;
}

.transition-mode-select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.transition-mode-select:hover {
    border-color: #5cb85c;
}

.transition-mode-select:focus {
    outline: none;
    border-color: #5cb85c;
    box-shadow: 0 0 0 2px rgba(92, 184, 92, 0.2);
}

.bike-comparison-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.bike-comparison-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.bike-comparison-title .title-number {
    background: #e5f5e5;
    color: #5cb85c;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

/* Options Navigation */
.bike-comparison-options {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 30px;
}

.comparison-option {
    position: relative;
    cursor: pointer;
    padding: 10px 0;
    color: #999;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.comparison-option.active {
    color: #333;
    border-bottom-color: #5cb85c;
}

.comparison-option:hover {
    color: #555;
}

/* Option Labels */
.option-label-main {
    display: block;
    font-size: 16px;
    line-height: 1.2;
}

.option-label-sub {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* Comparison Container */
.bike-comparison-container {
    position: relative;
    width: 100%;
    padding: 0 40px 40px;
}

/* Main Comparison View */
.bike-comparison-view {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: #f8f8f8;
    border-radius: 8px;
}

/* Bike Images Container */
.bike-comparison-images {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Individual Bike Layer */
.bike-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bike-layer.active {
    opacity: 1;
    pointer-events: auto;
}

/* Instant mode - no transitions */
.bike-comparison-widget[data-transition-mode="instant"] .bike-layer,
.bike-comparison-widget[data-transition-mode="instant"] .comparison-slider-container {
    transition: none !important;
}

.bike-comparison-widget[data-transition-mode="instant"] .option-tag {
    transition: none !important;
}

.bike-layer.before {
    z-index: 1;
}

.bike-layer.after {
    z-index: 2;
}

/* Bike Image Styling */
.bike-layer img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.1));
}

/* Comparison Slider (for before/after mode) */
.comparison-slider-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.comparison-slider-container.active {
    opacity: 1;
    pointer-events: auto;
}

.comparison-slider-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.comparison-before,
.comparison-after {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-before {
    left: 0;
    z-index: 2;
}

.comparison-after {
    left: 0;
    z-index: 1;
}

.comparison-before-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Slider Handle */
.comparison-handle {
    position: absolute;
    top: 0;
    width: 40px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
}

.comparison-handle-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.comparison-handle-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-handle-button::before,
.comparison-handle-button::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 8px 6px 0;
    border-color: transparent #333 transparent transparent;
}

.comparison-handle-button::before {
    left: 8px;
}

.comparison-handle-button::after {
    right: 8px;
    transform: rotate(180deg);
}

/* Feature Icons Grid */
.bike-features-grid {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    padding: 0 40px;
}

.bike-feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.bike-feature-item.active {
    opacity: 1;
}

.bike-feature-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bike-feature-icon svg {
    width: 100%;
    height: 100%;
    fill: #666;
}

.bike-feature-label {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Option Tags */
.option-tags {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.option-tag {
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.option-tag.visible {
    opacity: 1;
    transform: translateY(0);
}

.option-tag.before {
    background: #e5f5e5;
    color: #5cb85c;
}

.option-tag.after {
    background: #fff3e0;
    color: #ff9800;
}

/* Transition Effects */
.bike-comparison-view.fade-transition {
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.bike-comparison-view.fade-transition * {
    transition: none !important;
}

/* Buffer Transition for Elementor Content */
.bike-comparison-view.buffer-transition {
    position: relative;
}

.bike-comparison-view.buffer-transition::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 248, 248, 0.95);
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.bike-comparison-view:not(.buffer-transition)::before {
    opacity: 0;
}

/* Elementor Content Container */
.bike-layer .elementor-content,
.comparison-before .elementor-content,
.comparison-after .elementor-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prevent FOUC (Flash of Unstyled Content) */
.bike-layer:not(.active) .elementor-widget,
.comparison-slider-container:not(.active) .elementor-widget {
    opacity: 0;
}

.bike-layer.active .elementor-widget,
.comparison-slider-container.active .elementor-widget {
    opacity: 1;
    transition: opacity 0.3s ease 0.1s;
}

/* Elementor Widget Optimization */
.bike-comparison-widget .elementor-widget {
    will-change: opacity, transform;
}

.bike-comparison-widget .elementor-widget-container {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bike-comparison-header {
        padding: 20px;
    }
    
    .bike-comparison-container {
        padding: 0 20px 20px;
    }
    
    .bike-comparison-options {
        gap: 20px;
        flex-wrap: wrap;
    }
    
    .comparison-option {
        font-size: 14px;
    }
    
    .bike-comparison-view {
        height: 350px;
    }
    
    .bike-features-grid {
        gap: 20px;
        padding: 0 20px;
    }
    
    .bike-feature-icon {
        width: 32px;
        height: 32px;
    }
}

/* Loading State */
.bike-comparison-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 101;
}

.bike-comparison-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5cb85c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Preloading State */
.bike-comparison-view.preloading {
    position: relative;
}

.bike-comparison-view.preloading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(92, 184, 92, 0.3);
    border-top-color: #5cb85c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 102;
}

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

/* Hover Effects */
.bike-comparison-view:hover .comparison-handle-line {
    background: #5cb85c;
}

.bike-comparison-view:hover .comparison-handle-button {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Deep Dive Link */
.deep-dive-link {
    position: absolute;
    bottom: 20px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #5cb85c;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.deep-dive-link:hover {
    transform: translateX(5px);
}

.deep-dive-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}