/**
 * Digital Farmers Widgets Styles
 * 
 * @package Astra Child
 * @category DigitalFarmers
 * @version 1.0.0
 */

/* Cart Icon Widget Styles */
.cart-icon-widget {
    display: inline-block;
    position: relative;
}

.cart-icon-widget a {
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.cart-icon-container {
    position: relative;
    display: inline-block;
    line-height: 1;
}

.cart-icon-widget i,
.cart-icon-widget svg {
    display: block;
    transition: all 0.3s ease;
}

/* Counter Styles */
.cart-counter {
    position: absolute;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    padding: 2px 4px;
    border-radius: 50%;
    background-color: #ff0000;
    color: #ffffff;
    line-height: 1;
    z-index: 10;
    opacity: 1 !important;
    visibility: visible !important;
}
.cart-counter:hover{
    animation: counterPulse 2s infinite;
}

/* Counter Position Classes */
.cart-counter.counter-top-right {
    top: -8px;
    right: -8px;
}

.cart-counter.counter-top-left {
    top: -8px;
    left: -8px;
}

.cart-counter.counter-bottom-right {
    bottom: -8px;
    right: -8px;
}

.cart-counter.counter-bottom-left {
    bottom: -8px;
    left: -8px;
}

/* Counter Animation */
@keyframes counterPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Hover Effects */
.cart-icon-widget:hover .cart-counter {
    animation: counterBounce 0.6s ease;
}

@keyframes counterBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-counter {
        font-size: 10px;
        min-width: 16px;
        height: 16px;
        padding: 1px 3px;
    }
    
    .cart-counter.counter-top-right,
    .cart-counter.counter-top-left {
        top: -6px;
    }
    
    .cart-counter.counter-bottom-right,
    .cart-counter.counter-bottom-left {
        bottom: -6px;
    }
    
    .cart-counter.counter-top-right,
    .cart-counter.counter-bottom-right {
        right: -6px;
    }
    
    .cart-counter.counter-top-left,
    .cart-counter.counter-bottom-left {
        left: -6px;
    }
}

/* Accessibility */
.cart-icon-widget:focus-within .cart-counter {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cart-counter {
        border: 2px solid #000000;
    }
}

/* Cart Count Update Animation */
.cart-counter.cart-count-updated {
    animation: cartCountUpdate 0.3s ease;
}

@keyframes cartCountUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Elementor Editor Styles */
.elementor-editor-active .elementor-widget-cart-icon-widget .elementor-widget-icon {
    position: relative;
}

.elementor-editor-active .elementor-widget-cart-icon-widget .elementor-widget-icon:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23FFD700"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.3));
}

/* Add to Cart Widget Styles */
.add-to-cart-container {
    display: inline-block;
}

.add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background-image: radial-gradient(
      116.94% 246.47% at 0% 50.03%, 
      #DC9E17 0%, 
      #DBB133 33.65%, 
      #FEF387 67.31%, 
      #FED24C 100%
    );
    background-size: 200% auto;
    background-position: 0% 0;
    color: #000000;
    border: none;
    border-radius: 12px;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.5s ease;
    text-decoration: none;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    animation-play-state: paused;
    animation: moveBackground 3s linear infinite;
}

.add-to-cart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-to-cart-btn svg,
.add-to-cart-btn i {
    width: 24px;
    height: 24px;
    font-size: 24px;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-to-cart-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.add-to-cart-btn .btn-text {
    display: none;
}

.add-to-cart-btn.loading .btn-icon {
    display: none;
    opacity: 0;
}
.add-to-cart-btn.loading .loading-spinner{
    display: block !important;
    opacity: 1;
}

.add-to-cart-btn.success {
    background-color: #10B981;
    color: white;
}

.add-to-cart-btn.success svg,
.add-to-cart-btn.success i {
    color: white;
}

.add-to-cart-btn.success .btn-text {
    display: none;
}

.add-to-cart-btn.success .btn-icon {
    animation: successPulse 0.6s ease-out;
}

.add-to-cart-btn.disabled {
    background-image: linear-gradient(45deg, #E5E7EB, #D1D5DB);
    color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: none;
}

.add-to-cart-btn.disabled:hover {
    background-image: linear-gradient(45deg, #E5E7EB, #D1D5DB);
    transform: none;
    box-shadow: none;
    animation: none;
}

.add-to-cart-btn.disabled svg,
.add-to-cart-btn.disabled i {
    color: #9CA3AF;
}

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

@keyframes successPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes cartBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.cart-bounce {
    animation: cartBounce 0.8s ease-out;
}

/* Cart Icon Widget Bounce Animation */
.cart-icon-widget .cart-bounce {
    animation: cartBounce 0.8s ease-out;
}

.cart-counter.cart-bounce {
    animation: cartBounce 0.8s ease-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-shake {
    animation: errorShake 0.5s ease-in-out;
}

/* Loading spinner */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.add-to-cart-btn.loading .loading-spinner {
    opacity: 1;
}

/* Success checkmark */
.success-check {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.add-to-cart-btn.success .success-check {
    opacity: 1;
}

/* Add to Cart Notifications */
.add-to-cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: white;
}

.add-to-cart-notification.success {
    background: #10B981;
}

.add-to-cart-notification.error {
    background: #EF4444;
}

/* DigitalFarmers Category Icon in Editor */
.elementor-editor-active .elementor-panel-category-digitalfarmers .elementor-panel-category-icon {
    position: relative;
}

.elementor-editor-active .elementor-panel-category-digitalfarmers .elementor-panel-category-icon:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23FFD700"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.3));
}




/* Only the active FAQ item changes color */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}
.faq-item.faq-active {
    border-color: #DBB133;
}
.faq-item.faq-active .faq-question {
    color: #2E2728;
}
.faq-item {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 0;
    position: relative;
    width: 100%;
}
.faq-item:hover {
    box-shadow: none;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: transparent !important; /* Blue background */
    border: none !important;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #2E2728; /* White text */
    text-align: left;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    min-height: 20px;
    box-shadow: none !important;
}

.faq-question:hover {
    background-color: transparent !important; /* Darker blue on hover */
    color: #2E2728;
}

.faq-question.open {
    background-color: transparent !important;
}

.faq-question-text {
    flex: 1;
    margin-right: 15px;
    line-height: 1.4;
    pointer-events: none;
    word-wrap: break-word;
}

.faq-icon {
    font-size: 12px;
    font-weight: normal;
    color: #2E2728;
    transition: transform 0.3s ease;
    min-width: 20px;
    text-align: center;
    position: relative;
    pointer-events: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq-icon svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    fill: currentColor;
}

.faq-question.open .faq-icon svg {
    transform: rotate(90deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    padding: 0 20px;
    color: #666;
    line-height: 1.6;
    opacity: 0;
    font-size: 14px;
    font-weight: 400;
    position: relative;
    z-index: 1;
    background: transparent;
}

.faq-answer.open {
    max-height: 500px;
    padding: 0 20px 16px 20px;
    opacity: 1;
}

.faq-answer p {
    margin: 0 0 10px 0;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

/* Animation class for smooth transitions */
.faq-answer.faq-animating {
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

/* Load More Button Styles */
.faq-load-more-wrapper {
    text-align: center;
    margin-top: 20px;
}

.faq-load-more-btn {
    background-color: #2E2728;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.faq-load-more-btn:hover {
    background-color: #DBB133;
    color: #ffffff;
}

.faq-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.faq-load-more-btn.loading {
    pointer-events: none;
}

/* FAQ Widget Responsive */
@media (max-width: 768px) {
    .faq-question {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .faq-answer {
        padding: 0 16px;
        font-size: 13px;
    }
    
    .faq-answer.open {
        padding: 0 16px 14px 16px;
    }

    .faq-load-more-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}