/**
 * Single Product - Modern Styles
 * 
 * Conversion-optimized, clean design με micro-interactions
 * 
 * @package Grabit
 * @version 1.0
 */

/* ==========================================================================
   Main Product Container
   ========================================================================== */

.gi-single-product-modern {
    position: relative;
}

/* ==========================================================================
   Gallery & Media
   ========================================================================== */

.gi-product-media .gi-main-image-wrapper:hover .gi-main-image img {
    transform: scale(1.05);
}

.gi-thumb.border-\[#5caf90\] {
    box-shadow: 0 0 0 2px rgba(92, 175, 144, 0.2);
}

.gi-thumb:hover {
    transform: translateY(-2px);
}

.gi-thumb:active {
    transform: translateY(0);
}

/* Lightbox */
#gi-product-lightbox {
    animation: fadeIn 0.3s ease;
}

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

#gi-product-lightbox img {
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Buy Box
   ========================================================================== */

.gi-product-buybox {
    position: sticky;
    top: 1rem;
}

/* Price Animation */
.gi-product-price {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stock pulse animation */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Secondary Actions */
.gi-action-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.gi-action-secondary:active {
    transform: translateY(0);
}

.gi-action-secondary.active {
    border-color: #5caf90;
    background-color: rgba(92, 175, 144, 0.1);
}

.gi-action-secondary.active svg {
    color: #5caf90;
    fill: #5caf90;
}

/* ==========================================================================
   Sticky Mobile Add to Cart
   ========================================================================== */

.gi-sticky-atc {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gi-sticky-atc:not(.translate-y-full) {
    animation: slideUpBar 0.4s ease;
}

@keyframes slideUpBar {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.gi-sticky-atc-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Trust Signals
   ========================================================================== */

.gi-trust-signals > div {
    animation: fadeInUp 0.5s ease backwards;
}

.gi-trust-signals > div:nth-child(1) { animation-delay: 0.1s; }
.gi-trust-signals > div:nth-child(2) { animation-delay: 0.2s; }
.gi-trust-signals > div:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Delivery Info
   ========================================================================== */

.gi-delivery-info {
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Policies Accordions
   ========================================================================== */

details[open] summary ~ * {
    animation: slideDown 0.3s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

details summary::-webkit-details-marker {
    display: none;
}

details summary:focus {
    outline: 2px solid #5caf90;
    outline-offset: 2px;
}

/* ==========================================================================
   Product Tabs - Sticky
   ========================================================================== */

.gi-tabs-sticky {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    background: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    padding: 0.75rem 0 !important;
    animation: slideDownTab 0.3s ease !important;
}

@keyframes slideDownTab {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.woocommerce-tabs .tabs li.active a {
    border-bottom: 3px solid #5caf90;
    color: #5caf90;
}

/* ==========================================================================
   Add to Cart Button Enhancement
   ========================================================================== */

.single_add_to_cart_button {
    position: relative;
    overflow: hidden;
}

.single_add_to_cart_button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.single_add_to_cart_button:active::before {
    width: 300px;
    height: 300px;
}

/* Loading state */
.single_add_to_cart_button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.single_add_to_cart_button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.gi-toast {
    max-width: 300px;
    backdrop-filter: blur(10px);
}

/* ==========================================================================
   Quantity Input Stepper - Modern Design
   ========================================================================== */

.gi-qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.gi-qty-stepper:hover,
.gi-qty-stepper:focus-within {
    border-color: #5caf90;
    box-shadow: 0 0 0 3px rgba(92, 175, 144, 0.1);
}

.qty-btn {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: none;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background-color: #f9fafb;
}

.qty-btn:active {
    transform: scale(0.95);
    background-color: #f3f4f6;
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #374151;
}

.qty-input {
    width: 5rem;
    height: 3rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    background: white;
    border: 0;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}

.qty-input:focus {
    outline: none;
    box-shadow: none;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input[type=number] {
    -moz-appearance: textfield;
}

/* Modern Cart Form */
.modern-cart-form .gi-single-qty-modern {
    margin-bottom: 0;
}

.qty-container {
    margin-bottom: 0;
}

/* Legacy gi-single-qty override */
.gi-single-qty {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    margin: 0 !important;
}

.gi-single-qty .quantity {
    flex: 1;
    margin: 0 !important;
}

.gi-single-qty .single_add_to_cart_button {
    flex: 2;
    margin: 0 !important;
    min-width: auto !important;
}

/* ==========================================================================
   Variations & Swatches
   ========================================================================== */

.variations select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.variations select:hover {
    border-color: #5caf90;
}

.variations select:focus {
    outline: none;
    border-color: #5caf90;
    box-shadow: 0 0 0 3px rgba(92, 175, 144, 0.1);
}

/* Color swatches (if using) */
.gi-swatch-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gi-swatch-color:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gi-swatch-color.selected {
    border-color: #5caf90;
    box-shadow: 0 0 0 2px rgba(92, 175, 144, 0.2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1023px) {
    .gi-product-buybox {
        position: static;
    }
    
    .gi-thumbnails {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    .gi-product-price .text-3xl {
        font-size: 1.75rem;
    }
    
    .gi-action-secondary span {
        display: none;
    }
    
    .gi-action-secondary {
        flex: 0 0 auto;
        padding: 0.75rem;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.gi-thumb:focus-visible,
.gi-action-secondary:focus-visible,
button:focus-visible {
    outline: 2px solid #5caf90;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Swiper Navigation & Pagination (Related/Upsell)
   ========================================================================== */

/* Navigation Arrows */
.gi-related-slider-wrapper .swiper-button-prev,
.gi-related-slider-wrapper .swiper-button-next,
.gi-upsell-slider-wrapper .swiper-button-prev,
.gi-upsell-slider-wrapper .swiper-button-next {
    width: 40px !important;
    height: 40px !important;
    background: #5caf90 !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(92, 175, 144, 0.3) !important;
    transition: all 0.3s ease !important;
}

.gi-related-slider-wrapper .swiper-button-prev::after,
.gi-related-slider-wrapper .swiper-button-next::after,
.gi-upsell-slider-wrapper .swiper-button-prev::after,
.gi-upsell-slider-wrapper .swiper-button-next::after {
    font-size: 14px !important;
    font-weight: bold !important;
    color: white !important;
}

.gi-related-slider-wrapper .swiper-button-prev:hover,
.gi-related-slider-wrapper .swiper-button-next:hover,
.gi-upsell-slider-wrapper .swiper-button-prev:hover,
.gi-upsell-slider-wrapper .swiper-button-next:hover {
    background: #4b9d7f !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(92, 175, 144, 0.4) !important;
}

.gi-related-slider-wrapper .swiper-button-disabled,
.gi-upsell-slider-wrapper .swiper-button-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

/* Pagination Dots */
.gi-related-slider-wrapper .swiper-pagination,
.gi-upsell-slider-wrapper .swiper-pagination {
    position: relative !important;
    margin-top: 2rem !important;
}

.gi-related-slider-wrapper .swiper-pagination-bullet,
.gi-upsell-slider-wrapper .swiper-pagination-bullet {
    width: 8px !important;
    height: 8px !important;
    background: #d1d5db !important;
    opacity: 1 !important;
    transition: all 0.3s ease !important;
}

.gi-related-slider-wrapper .swiper-pagination-bullet-active,
.gi-upsell-slider-wrapper .swiper-pagination-bullet-active {
    width: 24px !important;
    border-radius: 4px !important;
    background: #5caf90 !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .gi-sticky-atc,
    .gi-pro-actions,
    .gi-action-secondary,
    [data-lightbox-close],
    [data-lightbox-prev],
    [data-lightbox-next] {
        display: none !important;
    }
}

/* ==========================================================================
   Loading States & Skeletons
   ========================================================================== */

.gi-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   Spin Animation
   ========================================================================== */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

