/**
 * Custom CSS for OWNSKIN Application
 * Contains custom styles for wishlist and other components
 */

/* ========================================
   WISHLIST BUTTON STYLES
   ======================================== */

/* Wishlist Button Base Styles */
.wishlist-btn {
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.wishlist-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wishlist-btn i {
    font-size: 18px;
    transition: all 0.3s ease;
    color: #6c757d;
}

/* Wishlist Button States */
.wishlist-btn[data-in-wishlist="true"] i {
    color: #dc3545;
    transform: scale(1.2);
}

.wishlist-btn[data-in-wishlist="true"] {
    background: rgba(220, 53, 69, 0.1);
    border: 2px solid #dc3545;
}

/* Wishlist Button Animations */
.wishlist-btn.adding {
    animation: wishlistPulse 0.6s ease-in-out;
}

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

/* Loading State */
.wishlist-btn.loading i {
    animation: wishlistSpin 1s linear infinite;
}

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

/* Success Animation */
.wishlist-btn.success {
    animation: wishlistSuccess 0.5s ease-in-out;
}

@keyframes wishlistSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background: rgba(40, 167, 69, 0.2); }
    100% { transform: scale(1); }
}

/* Error State */
.wishlist-btn.error {
    animation: wishlistError 0.5s ease-in-out;
}

@keyframes wishlistError {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* Product Card Hover Effect */
.product-card:hover .wishlist-btn {
    opacity: 1;
    visibility: visible;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .wishlist-btn {
        width: 35px;
        height: 35px;
    }

    .wishlist-btn i {
        font-size: 16px;
    }
}

/* ========================================
   WISHLIST PAGE STYLES
   ======================================== */

/* Ensure all wishlist cards have equal height */
.wishlist-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px; /* Set minimum height for consistency */
}

.wishlist-item .position-relative {
    flex-shrink: 0; /* Prevent image from shrinking */
}

.wishlist-item h6,
.wishlist-item p {
    flex-shrink: 0; /* Prevent text from shrinking */
}

.wishlist-item .d-flex.justify-content-between {
    flex-shrink: 0; /* Prevent price/rating from shrinking */
}

.wishlist-item .mt-3 {
    margin-top: auto !important; /* Push buttons to bottom */
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Ensure consistent spacing */
.wishlist-item .mb-3 {
    margin-bottom: 1rem !important;
}

.wishlist-item .mb-2 {
    margin-bottom: 0.5rem !important;
}

/* Loading and empty state styles */
#loading-wishlist, #empty-wishlist {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Product image placeholder */
.product-image-placeholder {
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
}

/* ========================================
   TOAST NOTIFICATION STYLES
   ======================================== */

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    max-width: 400px;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toastSlideIn 0.3s ease-out;
}

.toast-notification.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.toast-notification.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.toast-notification.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.toast-notification.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   LOADING SPINNER STYLES
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Mobile-first responsive design */
@media (max-width: 576px) {
    .wishlist-btn {
        width: 32px;
        height: 32px;
    }

    .wishlist-btn i {
        font-size: 14px;
    }

    .toast-notification {
        min-width: 280px;
        right: 10px;
        top: 10px;
    }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
    .wishlist-btn {
        width: 38px;
        height: 38px;
    }

    .wishlist-btn i {
        font-size: 17px;
    }
}

/* Desktop enhancements */
@media (min-width: 1200px) {
    .wishlist-btn {
        width: 42px;
        height: 42px;
    }

    .wishlist-btn i {
        font-size: 19px;
    }
}

/* ========================================
   FLOATING WHATSAPP BUTTON STYLES
   ======================================== */

/* Floating WhatsApp Button Base Styles */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    animation: whatsappPulse 2s infinite;
    bottom: 20px;
    right: 20px;
}

.whatsapp-float:hover {
    background-color: #128C7E;
    color: white;
    text-decoration: none;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.6);
}

.whatsapp-float i {
    font-size: 28px;
    transition: all 0.3s ease;
}

/* WhatsApp Button Animation */
@keyframes whatsappPulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 10px rgba(37, 211, 102, 0.1);
    }
    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
}

/* Responsive WhatsApp Button */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    .whatsapp-float i {
        font-size: 24px;
    }
}

@media (max-width: 576px) {
    .whatsapp-float {
        width: 45px;
        height: 45px;
        bottom: 10px;
        right: 10px;
    }

    .whatsapp-float i {
        font-size: 22px;
    }
}

/* ========================================
   CUSTOM PRELOADER OVERRIDES
   ======================================== */

.preloader {
    background-color: var(--main-color);
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

.preloader .animation-preloader .logo-ring {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.preloader .animation-preloader .logo-ring .logo {
    width: 110px;
    height: auto;
    display: block;
    z-index: 2;
    position: relative;
    bottom: 3px;
}

/* Outer ring uses existing spinner keyframes for smooth rotation */
.preloader .animation-preloader .logo-ring .spinner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    animation: spinner 1s linear infinite;
    z-index: 1;
}

/* Loading text positioned in center of ring */
.preloader .animation-preloader .logo-ring::after {
    content: "Loading";
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-chap);
    text-transform: uppercase;
    letter-spacing: 4px;
    opacity: 0.9;
    z-index: 3;
}

/* Hide the original loading text */
.preloader p.text-center {
    display: none;
}

/* Add transparent background transition effect */
.preloader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.1) 100%);
    animation: preloaderShimmer 2s ease-in-out infinite;
    z-index: 0;
}

@keyframes preloaderShimmer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

@media (max-width: 568px) {
    .preloader .animation-preloader .logo-ring .logo {
    bottom: 15px !important;
    width: 90px !important;
}
}

/* Smooth exit remains handled by .preloader.loaded in main.css */

/* ========================================
   REDEEM BUTTON HOVER STYLES
   ======================================== */

#btn-redeem:hover {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    transition: all 0.3s ease;
}

#btn-checkout:hover {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    transition: all 0.3s ease;
}

/* Mulai Belanja button hover effect */
a.btn.btn-primary[href="/products"]:hover {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    transition: all 0.3s ease;
}

/* Claim button hover effect */
.btn.btn-claim:hover {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    transition: all 0.3s ease;
}
