/**
 * Custom Shopping Cart Styles
 *
 * @package     Joomla.Plugin
 * @subpackage  System.CustomCart
 * @copyright   Copyright (C) 2025 Custom Development
 * @license     GNU General Public License version 2 or later
 */

/* Cart Wrapper - Floating Cart Button */
.customcart-wrapper {
    position: fixed;
    z-index: 999;
}

.customcart-wrapper.cart-top-right {
    top: 20px;
    right: 20px;
}

.customcart-wrapper.cart-top-left {
    top: 20px;
    left: 20px;
}

.customcart-wrapper.cart-bottom-right {
    bottom: 20px;
    right: 20px;
}

.customcart-wrapper.cart-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Cart Toggle Button */
.customcart-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.customcart-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Cart Badge */
.customcart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border-radius: 10px;
    background: #f0506e;
    color: #fff;
    transition: all 0.3s ease;
}

.customcart-badge.uk-hidden {
    opacity: 0;
    transform: scale(0);
}

/* Cart Modal */
#customcart-modal {
    /* Ensure modal appears above cart icon button */
    z-index: 1001;
}

#customcart-modal .uk-modal-dialog {
    max-width: 600px;
}

/* Cart Items */
.customcart-item {
    transition: all 0.3s ease;
}

.customcart-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.customcart-item img {
    object-fit: cover;
}

/* Loading Overlay */
.customcart-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.customcart-loading.uk-hidden {
    display: none;
}

/* Product Modal Styles */
.customcart-product-modal .uk-modal-dialog {
    max-width: 700px;
}

.customcart-product-options {
    margin-top: 20px;
}

.customcart-file-upload {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.customcart-file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.customcart-file-preview {
    margin-top: 15px;
}

.customcart-file-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Price Display */
.customcart-price {
    font-size: 32px;
    font-weight: bold;
    color: #2a9543;
}

/* Options List */
.customcart-option {
    display: block;
    margin-bottom: 10px;
}

.customcart-option input[type="radio"],
.customcart-option input[type="checkbox"] {
    margin-right: 10px;
}

.customcart-option label {
    cursor: pointer;
    display: block;
    margin: 0;
}

/* Quantity Selector */
.customcart-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.customcart-quantity button {
    width: 35px;
    height: 35px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.customcart-quantity input {
    width: 60px;
    text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
    .customcart-wrapper.cart-top-right,
    .customcart-wrapper.cart-bottom-right {
        right: 10px;
    }

    .customcart-wrapper.cart-top-left,
    .customcart-wrapper.cart-bottom-left {
        left: 10px;
    }

    .customcart-wrapper.cart-top-right,
    .customcart-wrapper.cart-top-left {
        top: 10px;
    }

    .customcart-wrapper.cart-bottom-right,
    .customcart-wrapper.cart-bottom-left {
        bottom: 10px;
    }

    .customcart-toggle {
        width: 50px;
        height: 50px;
    }

    #customcart-modal .uk-modal-dialog,
    .customcart-product-modal .uk-modal-dialog {
        margin: 10px;
    }

    .customcart-item .uk-grid-small > * {
        padding-left: 10px;
    }

    /* Smaller cart item images on mobile */
    .customcart-item-img {
        width: 60px !important;
        height: 60px !important;
    }
}

/* Animation for adding items */
@keyframes cartBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.customcart-badge.bounce {
    animation: cartBounce 0.5s ease;
}

/* Empty cart message */
#customcart-items .uk-text-muted {
    padding: 8px 0px;
}

/* Checkout button styling */
#customcart-checkout {
    font-size: 1.1rem;
    font-weight: bold;
}

#customcart-checkout:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Off-Canvas Styling */
#customcart-offcanvas {
    /* Ensure offcanvas appears above cart icon button */
    z-index: 1001;
}

/* Custom width for offcanvas bar - ONLY override width, let UIkit handle positioning */
/* Override YOOtheme Pro's @s breakpoint (640px+) which sets 350px */
#customcart-offcanvas .uk-offcanvas-bar {
    width: 600px !important;
    max-width: 100vw !important;
}

/* For reveal mode - override UIkit's .uk-open > .uk-offcanvas-reveal width */
#customcart-offcanvas.uk-open > .uk-offcanvas-reveal {
    width: 600px !important;
    max-width: 100vw !important;
}

/* Mobile - full width */
@media (max-width: 639px) {
    #customcart-offcanvas .uk-offcanvas-bar {
        width: 100vw !important;
    }

    #customcart-offcanvas.uk-open > .uk-offcanvas-reveal {
        width: 100vw !important;
    }
}

/* Close button - white color for dark backgrounds */
#customcart-offcanvas .uk-offcanvas-close,
#customcart-modal .uk-modal-close-default,
.customcart-product-modal .uk-modal-close-default {
    color: #fff;
    transition: transform 0.2s ease;
}

#customcart-offcanvas .uk-offcanvas-close:hover,
#customcart-modal .uk-modal-close-default:hover,
.customcart-product-modal .uk-modal-close-default:hover {
    color: #fff;
    transform: rotate(90deg);
}

/* Mobile-specific cart icon positioning */
@media (max-width: 639px) {
    .customcart-wrapper.cart-mobile-top-right {
        top: 10px !important;
        right: 10px !important;
        left: auto !important;
        bottom: auto !important;
    }

    .customcart-wrapper.cart-mobile-top-left {
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
        bottom: auto !important;
    }

    .customcart-wrapper.cart-mobile-bottom-right {
        bottom: 10px !important;
        right: 10px !important;
        top: auto !important;
        left: auto !important;
    }

    .customcart-wrapper.cart-mobile-bottom-left {
        bottom: 10px !important;
        left: 10px !important;
        top: auto !important;
        right: auto !important;
    }
}

/* ==========================================================================
   MFA (Multi-Factor Authentication) Page Styles
   Target: /component/users/methods (com_users MFA view)
   ========================================================================== */

/* Card header text white for dark backgrounds */
.com-users-methods .uk-card-header,
.com-users-methods .uk-card-header .uk-card-title,
.com-users-methods .uk-card-header h3,
.com-users-methods .uk-card-header h4,
.com-users-methods .uk-card-primary .uk-card-header,
.com-users-methods .uk-card-primary .uk-card-header .uk-card-title,
.com-users-methods .uk-card-secondary .uk-card-header,
.com-users-methods .uk-card-secondary .uk-card-header .uk-card-title {
    color: #fff !important;
}

/* Also target via body class for com_users */
body.com_users .uk-card-primary .uk-card-header,
body.com_users .uk-card-primary .uk-card-header .uk-card-title,
body.com_users .uk-card-primary .uk-card-header h3,
body.com_users .uk-card-primary .uk-card-header h4,
body.com_users .uk-card-secondary .uk-card-header,
body.com_users .uk-card-secondary .uk-card-header .uk-card-title,
body.com_users .uk-card-secondary .uk-card-header h3,
body.com_users .uk-card-secondary .uk-card-header h4 {
    color: #fff !important;
}
