/* ============================================
 * WooCommerce Mini Cart Plugin Styles
 * ============================================ */

/* Main wrapper */
.acesoftech-mini-cart-wrapper {
    display: inline-block;
    position: relative;
}

.acesoftech-mini-cart-container {
    position: relative;
}

/* Trigger area */
.acesoftech-mini-cart-trigger {
    cursor: pointer;
}

.acesoftech-cart-link {
    text-decoration: none;
    display: block;
}

/* Cart Icon Container - Updated for count above, price right */
.acesoftech-cart-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

/* Cart Icon */
.acesoftech-cart-icon {
    font-size: 24px;
    line-height: 1;
    position: relative;
    z-index: 1;
}

/* Count Container - Positioned above the icon */
.acesoftech-cart-count-container {
    position: absolute;
    top: -10px;
    left: 15px;
    z-index: 2;
}

.acesoftech-cart-count {
    display: block;
    min-width: 20px;
    height: 20px;
    background: #ff0000;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Price Container - Positioned to the right, touching icon */
.acesoftech-cart-total-container {
    margin-left: 2px;
}

.acesoftech-cart-total {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Dropdown */
.acesoftech-mini-cart-dropdown-container {
    position: absolute;
    top: 100%;
    right: 0;
    width: 400px;
    z-index: 99999;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    margin-top: 10px;
    margin-right: -123px;
}

.acesoftech-mini-cart-container:hover .acesoftech-mini-cart-dropdown-container,
.acesoftech-mini-cart-dropdown-container.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.acesoftech-mini-cart-dropdown-wrapper {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    padding: 15px;
}

.acesoftech-mini-cart-content {
    padding: 20px;
}

/* Cart Items */
.acesoftech-mini-cart-items {
    max-height: 400px;
    overflow-y: auto;
}

/* Individual Cart Item */
.acesoftech-mini-cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    position: relative;
    transition: opacity 0.3s ease, height 0.4s ease, padding 0.4s ease, margin 0.4s ease;
    overflow: hidden;
}

/* Description Left */
.acesoftech-cart-item-details {
    flex: 1;
    min-width: 0;
    padding-right: 15px;
}

.acesoftech-cart-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
}

.acesoftech-cart-item-title a {
    text-decoration: none;
    color: #333;
}

.acesoftech-cart-item-title a:hover {
    color: #007cba;
}

/* Price and Delete Container */
.acesoftech-cart-item-price-delete {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Price */
.acesoftech-cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Delete Button */
.acesoftech-cart-item-remove {
    display: flex;
    align-items: center;
    gap: 5px;
}

.acesoftech-cart-item-remove .remove.acesoftech-remove-from-cart-button,
.acesoftech-cart-item-remove button.acesoftech-remove-cart-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    color: #000000;
    border-radius: 50%;
    text-decoration: none;
    font-size: 16px;
    font-weight: normal;
    line-height: 1;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    padding: 0;
}

.acesoftech-cart-item-remove .remove.acesoftech-remove-from-cart-button:hover,
.acesoftech-cart-item-remove button.acesoftech-remove-cart-item:hover {
    background: #000000;
    color: #ffffff;
}

.acesoftech-cart-item-remove .remove.acesoftech-remove-from-cart-button i,
.acesoftech-cart-item-remove button.acesoftech-remove-cart-item i {
    font-size: 12px;
}

/* Loading indicator - UPDATED for better animation */
.acesoftech-remove-loader {
    display: none;
    color: #666;
    font-size: 12px;
    margin-left: 8px;
}

.acesoftech-remove-loader i {
    animation: fa-spin 1s linear infinite;
}

.acesoftech-mini-cart-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Separator between description and image */
.acesoftech-cart-item-separator {
    width: 1px;
    height: 40px;
    background: #e5e5e5;
    margin: 0 15px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Image Right */
.acesoftech-cart-item-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.acesoftech-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Item Divider */
.acesoftech-cart-item-divider {
    height: 1px;
    background: #e5e5e5;
    margin: 0;
    transition: all 0.3s ease;
}

/* Subtotal */
.acesoftech-cart-subtotal-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 2px solid #e5e5e5;
    margin-top: 10px;
    font-size: 18px;
    font-weight: bold;
}

.acesoftech-cart-subtotal-left {
    color: #333;
}

.acesoftech-cart-subtotal-right {
    color: #007cba;
}

/* Buttons Container */
.acesoftech-cart-buttons-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.acesoftech-cart-button-left,
.acesoftech-cart-button-right {
    flex: 1;
}

.acesoftech-view-cart-button,
.acesoftech-checkout-button {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.3s;
    border: 1px solid;
    color: #ffffff !important; /* Force white text */
}

/* View Cart Button */
.acesoftech-view-cart-button {
    background: #333333;
    border-color: #333333;
}

.acesoftech-view-cart-button:hover {
    background: #666666 !important;
    border-color: #666666 !important;
    color: #ffffff !important;
}

/* Checkout Button */
.acesoftech-checkout-button {
    background: #9F1C31;
    border-color: #9F1C31;
}

.acesoftech-checkout-button:hover {
    background: #FF1E42 !important;
    border-color: #FF1E42 !important;
    color: #ffffff !important;
}

/* Ensure text remains white and not affected by theme styles */
.acesoftech-view-cart-button,
.acesoftech-view-cart-button:hover,
.acesoftech-view-cart-button:focus,
.acesoftech-view-cart-button:active,
.acesoftech-checkout-button,
.acesoftech-checkout-button:hover,
.acesoftech-checkout-button:focus,
.acesoftech-checkout-button:active {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Empty Cart */
.acesoftech-mini-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
    animation: fadeIn 0.5s ease;
}

/* ============================================
 * ANIMATION STYLES - ADDED FOR SMOOTH DELETIONS
 * ============================================ */

/* Temporary message styles - IMPROVED */
.acesoftech-temp-message {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    z-index: 1000;
    animation: slideDown 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.acesoftech-temp-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.acesoftech-temp-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Spinner animation for custom keyframes */
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Slide down animation for messages */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Smooth button hover animation */
.acesoftech-remove-cart-item {
    transition: all 0.2s ease;
}

.acesoftech-remove-cart-item:hover {
    transform: scale(1.1);
}

.acesoftech-remove-cart-item:active {
    transform: scale(0.95);
}

/* Removing state overlay */
.acesoftech-mini-cart-item.removing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
    border-radius: 4px;
    pointer-events: none;
}

/* Loading overlay for entire cart */
.acesoftech-mini-cart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.acesoftech-mini-cart-loading .fa-spinner {
    font-size: 24px;
    color: #333;
}

/* Smooth dropdown animations */
.acesoftech-mini-cart-dropdown-container {
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

/* Cart count animation */
.acesoftech-cart-count {
    transition: transform 0.3s ease;
}

.acesoftech-cart-count.updating {
    transform: scale(1.2);
    background: #ff4444;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .acesoftech-mini-cart-dropdown-container {
        width: 350px;
        margin-right: -175px;
    }
    
    /* Adjust icon container for mobile */
    .acesoftech-cart-icon-container {
        gap: 6px;
    }
    
    .acesoftech-cart-count-container {
        left: 12px;
    }
    
    /* Mobile temp message positioning */
    .acesoftech-temp-message {
        left: 5px;
        right: 5px;
        top: 5px;
        font-size: 12px;
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .acesoftech-mini-cart-dropdown-container {
        width: 300px;
        margin-right: -150px;
        left: auto;
        right: 0;
    }
    
    .acesoftech-mini-cart-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }
    
    .acesoftech-cart-item-separator {
        display: none;
    }
    
    .acesoftech-cart-item-image {
        margin-top: 10px;
        width: 50px;
        height: 50px;
    }
    
    .acesoftech-cart-buttons-container {
        flex-direction: column;
    }
    
    /* Adjust icon container for small mobile */
    .acesoftech-cart-icon-container {
        gap: 4px;
    }
    
    .acesoftech-cart-total {
        font-size: 12px;
    }
    
    .acesoftech-mini-cart-content {
        padding: 15px;
    }
    
    .acesoftech-view-cart-button,
    .acesoftech-checkout-button {
        padding: 10px;
        font-size: 14px;
    }
    
    /* Mobile temp message */
    .acesoftech-temp-message {
        left: 3px;
        right: 3px;
        top: 3px;
        font-size: 11px;
        padding: 6px 8px;
    }
}

/* For very small screens */
@media (max-width: 360px) {
    .acesoftech-mini-cart-dropdown-container {
        width: 280px;
        margin-right: -140px;
    }
}

/* Print styles - hide animations */
@media print {
    .acesoftech-temp-message,
    .acesoftech-remove-loader,
    .acesoftech-mini-cart-item.removing::before {
        display: none !important;
    }
}