/**
 * EP Tax Switch v4.2.0
 */

/* Price wrappers */
.ep-price-wrap,
.ep-label-wrap {
    display: inline;
}

.ep-price-wrap .ep-active,
.ep-label-wrap .ep-active {
    display: inline !important;
}

.ep-price-wrap .ep-inactive,
.ep-label-wrap .ep-inactive {
    display: none !important;
}

.ep-price-container {
    display: inline;
}

.ep-tax-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    vertical-align: super;
    margin-left: 1px;
    position: relative;
    top: -0.3em;
}

/* ========================================
   FLIP CALENDAR ANIMATION
   Like airport departure board / calendar
   ======================================== */

/* Flip container */
.ep-flip-container {
    display: inline-block;
    position: relative;
    perspective: 300px;
}

.ep-flip-digit {
    display: inline-block;
    position: relative;
    width: 0.6em;
    height: 1.2em;
    margin: 0 1px;
    perspective: 200px;
}

.ep-flip-digit-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Flip animation keyframes - calendar page turn */
@keyframes ep-flip-top {
    0% {
        transform: rotateX(0deg);
    }
    100% {
        transform: rotateX(-90deg);
    }
}

@keyframes ep-flip-bottom {
    0% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

/* Full flip animation */
@keyframes ep-calendar-flip {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateX(-90deg);
        opacity: 0;
    }
    51% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

/* Staggered flip for each character */
.ep-flipping .ep-flip-char {
    display: inline-block;
    animation: ep-calendar-flip 0.6s ease-in-out forwards;
    transform-origin: center center;
    backface-visibility: hidden;
}

.ep-flipping .ep-flip-char:nth-child(1) { animation-delay: 0ms; }
.ep-flipping .ep-flip-char:nth-child(2) { animation-delay: 50ms; }
.ep-flipping .ep-flip-char:nth-child(3) { animation-delay: 100ms; }
.ep-flipping .ep-flip-char:nth-child(4) { animation-delay: 150ms; }
.ep-flipping .ep-flip-char:nth-child(5) { animation-delay: 200ms; }
.ep-flipping .ep-flip-char:nth-child(6) { animation-delay: 250ms; }
.ep-flipping .ep-flip-char:nth-child(7) { animation-delay: 300ms; }
.ep-flipping .ep-flip-char:nth-child(8) { animation-delay: 350ms; }
.ep-flipping .ep-flip-char:nth-child(9) { animation-delay: 400ms; }
.ep-flipping .ep-flip-char:nth-child(10) { animation-delay: 450ms; }

/* Simple flip for whole price element */
.ep-flip-animate {
    animation: ep-calendar-flip 0.5s ease-in-out;
    transform-style: preserve-3d;
    display: inline-block;
}

/* Cart widget flip animation */
.cart-widget-side .woocommerce-Price-amount.ep-flipping,
.widget_shopping_cart .woocommerce-Price-amount.ep-flipping,
.mini_cart_item .woocommerce-Price-amount.ep-flipping,
.wd-cart-widget .woocommerce-Price-amount.ep-flipping,
.wd-header-cart .woocommerce-Price-amount.ep-flipping {
    animation: ep-calendar-flip 0.5s ease-in-out;
    display: inline-block;
    transform-style: preserve-3d;
}

/* Electric glow after flip */
@keyframes ep-glow-pulse {
    0% {
        filter: brightness(1);
    }
    30% {
        filter: brightness(1.3);
        text-shadow: 0 0 8px rgba(245, 166, 35, 0.8);
    }
    100% {
        filter: brightness(1);
        text-shadow: none;
    }
}

.ep-glow-after-flip {
    animation: ep-glow-pulse 0.4s ease-out 0.5s;
}

/* Toggle container */
.ep-tax-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

/* Buttons */
.ep-toggle-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.ep-toggle-btn:first-child {
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.ep-toggle-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.ep-toggle-btn:hover {
    background: #e8e8e8;
}

.ep-toggle-btn.ep-active {
    background: #F5A623;
    border-color: #F5A623;
    color: #000;
}

/* Switch */
.ep-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ep-switch-label {
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

.ep-switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ep-switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.3s;
}

.ep-switch-slider:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ep-switch-input:checked + .ep-switch-slider {
    background: #F5A623;
}

.ep-switch-input:checked + .ep-switch-slider:after {
    transform: translateX(20px);
}

/* Dropdown */
.ep-tax-select {
    padding: 6px 28px 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.ep-tax-select:hover,
.ep-tax-select:focus {
    border-color: #F5A623;
    outline: none;
}

/* ========================================
   FLOATING TOGGLE - DESKTOP
   ======================================== */
.ep-floating-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* ========================================
   FLOATING TOGGLE - MOBILE
   ======================================== */
@media (max-width: 768px) {
    /* Hide default floating on mobile */
    .ep-floating-toggle {
        bottom: 80px;
        left: 10px;
        right: auto;
        padding: 8px 10px;
        border-radius: 25px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
    
    /* Compact buttons for mobile floating */
    .ep-floating-toggle .ep-toggle-btn {
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 600;
    }
    
    /* Compact switch for mobile floating */
    .ep-floating-toggle .ep-switch {
        gap: 6px;
    }
    
    .ep-floating-toggle .ep-switch-label {
        font-size: 12px;
        font-weight: 600;
    }
    
    .ep-floating-toggle .ep-switch-slider {
        width: 38px;
        height: 22px;
    }
    
    .ep-floating-toggle .ep-switch-slider:after {
        width: 18px;
        height: 18px;
    }
    
    .ep-floating-toggle .ep-switch-input:checked + .ep-switch-slider:after {
        transform: translateX(16px);
    }
    
    /* General mobile toggle adjustments */
    .ep-toggle-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* White switch labels on mobile */
    .ep-switch-label {
        color: #fff;
    }
}

/* ========================================
   MOBILE STICKY BAR STYLE (optional class)
   Usage: [ep_tax_switch class="ep-mobile-sticky"]
   ======================================== */
.ep-mobile-sticky {
    display: none;
}

@media (max-width: 768px) {
    .ep-mobile-sticky {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        background: #fff;
        padding: 10px 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        justify-content: center;
        align-items: center;
        border-top: 1px solid #eee;
    }
    
    .ep-mobile-sticky .ep-toggle-btn {
        flex: 1;
        max-width: 120px;
        text-align: center;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .ep-mobile-sticky .ep-switch {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   MOBILE FAB STYLE (Floating Action Button)
   Usage: [ep_tax_switch class="ep-mobile-fab"]
   ======================================== */
.ep-mobile-fab {
    display: none;
}

@media (max-width: 768px) {
    .ep-mobile-fab {
        display: flex !important;
        position: fixed;
        bottom: 80px;
        right: 15px;
        left: auto;
        z-index: 9999;
        background: #F5A623;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
        justify-content: center;
        align-items: center;
        cursor: pointer;
    }
    
    /* Hide buttons, show only current mode text */
    .ep-mobile-fab .ep-toggle-btn {
        display: none;
    }
    
    .ep-mobile-fab .ep-toggle-btn.ep-active {
        display: flex;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        padding: 0;
        width: 100%;
        height: 100%;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
    }
    
    .ep-mobile-fab .ep-switch,
    .ep-mobile-fab .ep-tax-select {
        display: none;
    }
}

/* ========================================
   WOODMART THEME INTEGRATION
   ======================================== */
.whb-header .ep-tax-toggle {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Woodmart mobile header */
.whb-sticky-header .ep-tax-toggle,
.whb-clone .ep-tax-toggle {
    display: flex;
    align-items: center;
}

/* ========================================
   PRINT - HIDE ALL TOGGLES
   ======================================== */
@media print {
    .ep-tax-toggle,
    .ep-floating-toggle,
    .ep-react-toggle-root,
    .ep-mobile-sticky,
    .ep-mobile-fab {
        display: none !important;
    }
}
