/**
 * NFP Wishlist Navigation Widget Styles
 */

/* Widget container */
.nfp-wishlist-nav-container {
    position: relative;
    display: inline-block;
    text-align: center;
}

/* Icon wrapper */
.nfp-wishlist-nav-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Icon styling */
.nfp-wishlist-nav-icon {
    font-size: 24px;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nfp-wishlist-nav-icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    transition: fill 0.3s ease;
}

/* Badge styling */
.nfp-wishlist-count-badge {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background-color: #ff0000;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1;
}

/* Badge positions */
.nfp-badge-top-right {
    top: -8px;
    right: -8px;
}

.nfp-badge-top-left {
    top: -8px;
    left: -8px;
}

.nfp-badge-bottom-right {
    bottom: -8px;
    right: -8px;
}

.nfp-badge-bottom-left {
    bottom: -8px;
    left: -8px;
}

/* Badge count animation */
@keyframes nfp-badge-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.nfp-wishlist-count-badge.nfp-badge-updated {
    animation: nfp-badge-pulse 0.5s ease;
}

/* Body styling when modal is open */
body.nfp-modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0px); /* Compensate for scrollbar disappearance */
}

/* For mobile devices, we need stronger body control */
@media (max-width: 767px) {
    body.nfp-modal-open {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
}

/* Modal styling */
.nfp-wishlist-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2147483647 !important; /* Maximum possible z-index value */
}

/* Mobile modal styles */
.nfp-wishlist-modal.nfp-modal-mobile {
    align-items: flex-start;
}

.nfp-wishlist-modal.nfp-modal-open {
    display: flex;
}

/* Modal overlay - ensure it covers everything */
.nfp-wishlist-modal-overlay {
    position: fixed; /* Changed from absolute to fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2147483646 !important; /* One less than modal container */
}

.nfp-modal-open .nfp-wishlist-modal-overlay {
    opacity: 1;
}

/* Modal content */
.nfp-wishlist-modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 2147483647 !important; /* Maximum possible z-index */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nfp-modal-open .nfp-wishlist-modal-content {
    opacity: 1;
    transform: translateY(0);
}

/* Modal animations */
@keyframes nfp-modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes nfp-modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes nfp-modal-slide-down {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes nfp-modal-zoom-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.nfp-wishlist-modal-content.nfp-modal-fade-in {
    animation: nfp-modal-fade-in 0.3s ease forwards;
}

.nfp-wishlist-modal-content.nfp-modal-slide-up {
    animation: nfp-modal-slide-up 0.3s ease forwards;
}

.nfp-wishlist-modal-content.nfp-modal-slide-down {
    animation: nfp-modal-slide-down 0.3s ease forwards;
}

.nfp-wishlist-modal-content.nfp-modal-zoom-in {
    animation: nfp-modal-zoom-in 0.3s ease forwards;
}

.nfp-wishlist-modal-content.nfp-modal-no-animation {
    opacity: 1;
    transform: translateY(0);
}

/* Modal closing animation */
.nfp-wishlist-modal-content.nfp-modal-closing {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Modal header */
.nfp-wishlist-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    background-color: #ffffff; /* Ensure it has a background */
    position: relative; /* For proper stacking */
    z-index: 3; /* Above the modal content for sticky behavior */
}

.nfp-wishlist-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.nfp-wishlist-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    width: auto;
    min-width: 24px;
    min-height: 24px;
}

.nfp-wishlist-modal-close:hover {
    color: #333;
}

.nfp-wishlist-modal-close:focus {
    /* outline: 2px solid ##C50F0F; */
    border-radius: 3px;
}

/* For absolute positioned close button */
.nfp-wishlist-modal-close.nfp-absolute-position {
    position: absolute;
    z-index: 11; /* Make sure it's above everything */
}

/* Modal body */
.nfp-wishlist-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
    position: relative;
}

/* Loading state */
.nfp-wishlist-loading {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.nfp-wishlist-loading.nfp-loading-active {
    display: flex;
}

.nfp-wishlist-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: nfp-spinner-rotate 1s linear infinite;
}

@keyframes nfp-spinner-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Wishlist items grid */
.nfp-wishlist-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* Small screen adjustments for grid view */
.nfp-wishlist-small-screen.nfp-wishlist-items {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Wishlist items list */
.nfp-wishlist-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nfp-wishlist-items-list .nfp-wishlist-item {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.nfp-wishlist-items-list .nfp-wishlist-item-image {
    flex: 0 0 100px;
    padding-top: 0;
    height: 100px;
}

.nfp-wishlist-items-list .nfp-wishlist-item-image img {
    position: static;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nfp-wishlist-items-list .nfp-wishlist-item-details {
    flex: 1;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.nfp-wishlist-items-list .nfp-wishlist-item-title {
    height: auto;
    margin-bottom: 10px;
}

.nfp-wishlist-items-list .nfp-wishlist-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.nfp-wishlist-items-list .nfp-wishlist-item-add-to-cart {
    width: auto;
    min-width: 120px;
}

/* Empty state */
.nfp-wishlist-empty-state {
    text-align: center;
    padding: 30px 20px;
    display: none;
}

.nfp-wishlist-empty-state.nfp-empty-active {
    display: block;
}

.nfp-wishlist-empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
    color: #666;
}

.nfp-wishlist-continue-shopping {
    display: inline-block;
    background-color: #c50f0f;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.nfp-wishlist-continue-shopping:hover {
    background-color: #000;
    color: #fff;
}

.nfp-wishlist-continue-shopping:focus {
    outline: 2px solid #c50f0f;
    outline-offset: 2px;
}

/* Wishlist item card */
.nfp-wishlist-item {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.nfp-wishlist-item:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.nfp-wishlist-item-image {
    position: relative;
    padding-top: 100%;
    background-color: #f7f7f7;
}

/* Aspect ratio variations */
.nfp-wishlist-item-image.ratio-1-1 {
    padding-top: 100%; /* 1:1 aspect ratio */
}

.nfp-wishlist-item-image.ratio-4-3 {
    padding-top: 75%; /* 4:3 aspect ratio */
}

.nfp-wishlist-item-image.ratio-3-2 {
    padding-top: 66.67%; /* 3:2 aspect ratio */
}

.nfp-wishlist-item-image.ratio-16-9 {
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

/* Custom ratio is handled via inline styles from widget settings */

.nfp-wishlist-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.nfp-wishlist-item:hover .nfp-wishlist-item-image img {
    transform: scale(1.05);
}

/* Item remove button base styles */
.nfp-wishlist-item-remove {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    font-weight: 400;
    padding: 0;
    margin: 0;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    z-index: 2;
    box-sizing: border-box;
    text-align: center;
}

/* Trash icon within remove button */
.nfp-wishlist-item-remove i {
    font-size: 12px;
    transition: all 0.3s ease;
}

/* Item remove button positions */
.nfp-wishlist-item-remove.position-top-right {
    top: 5px;
    right: 5px;
}

.nfp-wishlist-item-remove.position-top-left {
    top: 5px;
    left: 5px;
}

.nfp-wishlist-item-remove.position-bottom-right {
    bottom: 5px;
    right: 5px;
}

.nfp-wishlist-item-remove.position-bottom-left {
    bottom: 5px;
    left: 5px;
}

.nfp-wishlist-item:hover .nfp-wishlist-item-remove {
    opacity: 1;
}

.nfp-wishlist-item-remove:hover {
    background-color: #ff0000;
    color: #fff;
}

.nfp-wishlist-item-remove:focus {
    opacity: 1;
    outline: 2px solid #c50f0f;
    outline-offset: 2px;
}

.nfp-wishlist-item-details {
    padding: 10px;
}

.nfp-wishlist-item-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 5px;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.nfp-wishlist-item-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nfp-wishlist-item-title a:hover {
    color: #007bff;
}

.nfp-wishlist-item-price {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.nfp-wishlist-item-add-to-cart {
    width: 100%;
    padding: 8px 10px;
    background-color: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.nfp-wishlist-item-add-to-cart:hover {
    background-color: #45a049;
}

.nfp-wishlist-item-add-to-cart:focus {
    outline: 2px solid #2e7d32;
    outline-offset: 2px;
}

.nfp-wishlist-item-add-to-cart:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.nfp-wishlist-item-out-of-stock {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    background-color: #f8d7da;
    color: #721c24;
    font-size: 12px;
    margin-bottom: 10px;
}

/* Animation for item removal */
@keyframes nfp-item-remove {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.nfp-item-removing {
    animation: nfp-item-remove 0.3s ease forwards;
}

/* Custom scrollbar for modal body */
.nfp-wishlist-modal-body::-webkit-scrollbar {
    width: 8px;
}

.nfp-wishlist-modal-body::-webkit-scrollbar-track {
    background-color: #f1f1f1;
    border-radius: 4px;
}

.nfp-wishlist-modal-body::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 4px;
}

.nfp-wishlist-modal-body::-webkit-scrollbar-thumb:hover {
    background-color: #a8a8a8;
}

/* Mobile styles for wishlist items - force list view */
@media (max-width: 767px) {
    /* Modal container styles */
    .nfp-wishlist-modal {
        align-items: flex-start; /* Align to top on mobile */
        padding: 0; /* Remove any padding */
    }
    
    .nfp-wishlist-modal-content {
        width: 100%; /* Full width */
        max-width: 100%; /* Override max-width */
        height: 100vh; /* Full height */
        max-height: 100vh; /* Override max-height */
        border-radius: 0; /* Remove border radius */
        margin: 0; /* Remove any margin */
    }
    
    .nfp-wishlist-modal-body {
        max-height: calc(100vh - 60px); /* Account for header */
        padding: 15px; /* Slightly reduced padding on mobile */
    }
    
    .nfp-wishlist-modal-header {
        padding: 12px 15px; /* Slightly tighter padding */
        position: sticky; /* Sticky header on mobile */
        top: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Shadow for visibility */
        z-index: 10 !important; /* Ensure header stays above content when scrolling */
        background-color: #fff !important; /* Ensure header has background */
    }
    
    .nfp-wishlist-modal-title {
        font-size: 18px; /* Slightly smaller title */
    }
    
    .nfp-wishlist-modal-close {
        font-size: 22px; /* Slightly smaller icon */
        background-color: rgba(255,255,255,0.9); /* Semi-transparent background */
        width: 32px;
        height: 32px;
        border-radius: 50%;
    }
    
    .nfp-wishlist-modal-close.nfp-absolute-position {
        top: 10px;
        right: 10px;
    }

    /* Force list view on mobile regardless of settings */
    .nfp-wishlist-items {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        grid-template-columns: none !important;
    }
    
    /* Style each item as a row */
    .nfp-wishlist-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important;
        position: relative !important;
        margin-bottom: 10px !important;
    }
    
    /* Image container */
    .nfp-wishlist-item-image {
        flex: 0 0 30% !important;
        min-width: 80px !important;
        max-width: 100px !important;
        height: 80px !important;
        padding-top: 0 !important;
        margin-right: 10px !important;
        border-radius: 4px !important;
        overflow: hidden !important;
    }
    
    /* Fix for image positioning */
    .nfp-wishlist-item-image img {
        position: relative !important;
        height: 100% !important;
        width: 100% !important;
        object-fit: cover !important;
    }
    
    /* Content container */
    .nfp-wishlist-item-details {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        padding: 0 !important;
        min-height: 80px !important;
    }
    
    /* Product title */
    .nfp-wishlist-item-title {
        font-size: 14px !important;
        margin-bottom: 5px !important;
        font-weight: 500 !important;
        line-height: 1.3 !important;
        height: auto !important;
        -webkit-line-clamp: 2 !important;
    }
    
    /* Product price */
    .nfp-wishlist-item-price {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    /* Add to cart button */
    .nfp-wishlist-item-add-to-cart {
        width: 100% !important;
        height: 30px !important;
        font-size: 12px !important;
        padding: 0 10px !important;
    }
    
    /* Remove button - make it more visible on mobile */
    .nfp-wishlist-item-remove {
        opacity: 1 !important;
        top: 0 !important;
        right: 0 !important;
        width: 30px !important;
        height: 30px !important;
        background-color: rgba(255, 255, 255, 0.9) !important;
        color: #666 !important;
        z-index: 5 !important;
    }
    
    /* Trash icon in mobile remove button - scale it appropriately */
    .nfp-wishlist-item-remove i {
        font-size: 14px !important; /* Slightly larger for mobile */
    }
    
    /* Push other elements in the DOM behind our modal */
    body.nfp-modal-open * {
        z-index: auto !important;
    }
    
    body.nfp-modal-open .nfp-wishlist-modal,
    body.nfp-modal-open .nfp-wishlist-modal * {
        z-index: 2147483647 !important;
    }
    
    body.nfp-modal-open .nfp-wishlist-modal-overlay {
        z-index: 2147483646 !important;
    }
}

@media (max-width: 479px) {
    /* Maintain full-screen modal */
    .nfp-wishlist-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .nfp-wishlist-items {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .nfp-wishlist-items-list .nfp-wishlist-item {
        flex-direction: column;
    }
    
    .nfp-wishlist-items-list .nfp-wishlist-item-image {
        width: 100%;
        flex-basis: auto;
        padding-top: 100%;
        height: auto;
    }
    
    .nfp-wishlist-items-list .nfp-wishlist-item-image img {
        position: absolute;
    }
    
    .nfp-wishlist-items-list .nfp-wishlist-item-details {
        width: 100%;
    }
}

/* Accessibility improvements */
.nfp-wishlist-nav-icon:focus {
    outline: 2px solid #007bff;
    border-radius: 3px;
}

/* Animation for adding item to cart */
@keyframes nfp-button-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.nfp-wishlist-item-add-to-cart.nfp-adding-to-cart {
    animation: nfp-button-pulse 0.5s infinite;
}

/* Reduce animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .nfp-wishlist-modal-content,
    .nfp-wishlist-modal-content.nfp-modal-fade-in,
    .nfp-wishlist-modal-content.nfp-modal-slide-up,
    .nfp-wishlist-modal-content.nfp-modal-slide-down,
    .nfp-wishlist-modal-content.nfp-modal-zoom-in,
    .nfp-wishlist-modal-content.nfp-modal-closing,
    .nfp-wishlist-count-badge.nfp-badge-updated,
    .nfp-wishlist-item-add-to-cart.nfp-adding-to-cart,
    .nfp-wishlist-item:hover .nfp-wishlist-item-image img {
        animation: none;
        transition: none;
        transform: none;
    }
    
    .nfp-modal-open .nfp-wishlist-modal-content,
    .nfp-wishlist-modal-content.nfp-modal-no-animation {
        opacity: 1;
        transform: none;
    }
}

/* Class for JavaScript-applied mobile list view */
.nfp-wishlist-items.nfp-mobile-list-view {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    grid-template-columns: none !important;
}

.nfp-mobile-list-view .nfp-wishlist-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100% !important;
    position: relative !important;
    margin-bottom: 10px !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 4px !important;
    padding: 5px !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-image {
    flex: 0 0 30% !important;
    min-width: 80px !important;
    max-width: 100px !important;
    height: 80px !important;
    padding-top: 0 !important;
    margin-right: 10px !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    position: relative !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-image img {
    position: relative !important;
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-details {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 0 !important;
    min-height: 80px !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-title {
    font-size: 14px !important;
    margin-bottom: 5px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    height: auto !important;
    -webkit-line-clamp: 2 !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-price {
    font-size: 14px !important;
    margin-bottom: 8px !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-add-to-cart {
    width: 100% !important;
    height: 30px !important;
    font-size: 12px !important;
    padding: 0 10px !important;
}

.nfp-mobile-list-view .nfp-wishlist-item-remove {
    opacity: 1 !important;
    top: 5px !important;
    right: 5px !important;
    width: 25px !important;
    height: 25px !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #666 !important;
    z-index: 5 !important;
}

/* Trash icon in mobile list view remove button */
.nfp-mobile-list-view .nfp-wishlist-item-remove i {
    font-size: 12px !important;
} 