/* 
 * Precious Metals Plugin - Frontend Styles
 * 
 * Styles for the frontend display including image carousel and price display
 */

/* Price Display Styles */
.pm-price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 15px 0;
}

.pm-price {
    font-size: 24px;
    font-weight: bold;
    color: #28a745;
    line-height: 1.2;
}

.pm-metal-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: #6c757d;
}

.pm-metal-badge.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #333;
}

.pm-metal-badge.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
    color: #333;
}

.pm-metal-badge.platinum {
    background: linear-gradient(135deg, #e5e4e2 0%, #d3d3d3 100%);
    color: #333;
}

.pm-metal-badge.palladium {
    background: linear-gradient(135deg, #4a4a4a 0%, #2c2c2c 100%);
    color: #fff;
}

.pm-spot-info {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    line-height: 1.3;
}

/* Image Carousel Styles */
.pm-image-carousel {
    max-width: 600px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.pm-carousel-container {
    position: relative;
}

.pm-carousel-main {
    position: relative;
    background: #f8f9fa;
    text-align: center;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pm-carousel-main-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
}

.pm-carousel-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

.pm-carousel-nav button {
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.pm-carousel-nav button:hover:not(:disabled) {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.pm-carousel-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.pm-carousel-nav button:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.pm-carousel-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.pm-carousel-thumbnails {
    display: flex;
    padding: 15px;
    gap: 10px;
    overflow-x: auto;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #d4af37 #f1f1f1;
}

.pm-carousel-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.pm-carousel-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pm-carousel-thumbnails::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
}

.pm-carousel-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #b8860b;
}

.pm-thumbnail {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: none;
    padding: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.pm-thumbnail.active {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3);
}

.pm-thumbnail:hover {
    border-color: #d4af37;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.pm-thumbnail:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.pm-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.pm-thumbnail:hover img {
    transform: scale(1.1);
}

/* Loading state for carousel */
.pm-carousel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f8f9fa;
}

.pm-carousel-loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #d4af37;
    border-radius: 50%;
    animation: pm-carousel-spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .pm-image-carousel {
        margin: 15px 10px;
        border-radius: 8px;
    }
    
    .pm-carousel-main {
        min-height: 250px;
    }
    
    .pm-carousel-main-image {
        max-height: 300px;
    }
    
    .pm-carousel-nav {
        padding: 0 15px;
    }
    
    .pm-carousel-nav button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .pm-thumbnail {
        width: 56px;
        height: 56px;
    }
    
    .pm-carousel-thumbnails {
        padding: 12px;
        gap: 8px;
    }
    
    .pm-carousel-counter {
        bottom: 12px;
        right: 12px;
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .pm-price-container {
        align-items: center;
        text-align: center;
    }
    
    .pm-price {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .pm-carousel-main {
        min-height: 200px;
    }
    
    .pm-carousel-main-image {
        max-height: 250px;
    }
    
    .pm-thumbnail {
        width: 48px;
        height: 48px;
    }
    
    .pm-carousel-thumbnails {
        padding: 10px;
        gap: 6px;
    }
    
    .pm-price {
        font-size: 18px;
    }
    
    .pm-metal-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .pm-carousel-main-image,
    .pm-carousel-nav button,
    .pm-thumbnail,
    .pm-thumbnail img {
        transition: none;
    }
    
    .pm-carousel-loading::after {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pm-image-carousel {
        border: 2px solid #000;
    }
    
    .pm-carousel-nav button {
        background: #000;
        border: 2px solid #fff;
    }
    
    .pm-thumbnail {
        border: 2px solid #000;
    }
    
    .pm-thumbnail.active {
        border: 3px solid #000;
        background: #ff0;
    }
}

/* Cart Price Update Animations */
.woocommerce-cart .product-price,
.woocommerce-cart .product-subtotal {
    transition: background-color 0.3s ease;
    border-radius: 4px;
    padding: 5px;
}

.woocommerce-cart .price-updated {
    background: rgba(212, 175, 55, 0.2) !important;
    animation: cartPriceFlash 1s ease-in-out;
}

@keyframes cartPriceFlash {
    0% { 
        background: transparent;
        transform: scale(1);
    }
    50% { 
        background: rgba(212, 175, 55, 0.3);
        transform: scale(1.02);
    }
    100% { 
        background: rgba(212, 175, 55, 0.2);
        transform: scale(1);
    }
}

/* Cart updating indicator */
.pm-cart-updating {
    background: linear-gradient(135deg, #e7f3ff 0%, #cce7ff 100%);
    border: 1px solid #0073aa;
    color: #0073aa;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
    animation: fadeInSlide 0.3s ease-out;
}

@keyframes fadeInSlide {
    0% { 
        opacity: 0;
        transform: translateY(-10px);
    }
    100% { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Precious metals cart item styling */
.woocommerce-cart .cart_item .product-price .amount,
.woocommerce-cart .cart_item .product-subtotal .amount {
    font-weight: 700;
    color: #d4af37;
}

/* Live pricing indicator for cart */
.cart-live-pricing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #28a745;
    margin-left: 10px;
}

.cart-live-dot {
    width: 6px;
    height: 6px;
    background: #28a745;
    border-radius: 50%;
    animation: cartPulse 2s infinite;
}

@keyframes cartPulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* Cart totals update animation */
.cart_totals {
    transition: opacity 0.3s ease;
}

.cart_totals.updating {
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pm-cart-updating {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .cart-live-pricing {
        font-size: 0.7rem;
        margin-left: 5px;
    }
}

/* Bank Account Selection Styles */
.pm-account-selection {
    margin: 15px 0;
}

.pm-account-selection h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1rem;
}

.pm-account-option {
    display: block;
    margin: 8px 0;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    background: #f9f9f9;
    transition: all 0.2s ease;
}

.pm-account-option:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.pm-account-option input[type="radio"] {
    margin-right: 8px;
}

.pm-account-name {
    color: #333;
    font-weight: 600;
}

.pm-account-mask {
    color: #666;
}

.pm-account-balance {
    color: #28a745;
    font-weight: 500;
    font-size: 0.9rem;
}

#pm-confirm-account {
    margin-top: 15px;
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

#pm-confirm-account:hover {
    background: #005a87;
}

/* Identity Verification Account Page Styles */
.woocommerce-MyAccount-content-box {
    background: var(--wc-background-color, #f8f9fa);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--wc-border-color, #e0e0e0);
    border-radius: 4px;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .woocommerce-MyAccount-content-box {
        background: #2c2c2c;
        border-color: #444;
        color: #fff;
    }
}

.pm-progress-bar {
    border-radius: 4px;
    overflow: hidden;
}

/* Ensure text is visible in all themes */
.woocommerce-MyAccount-content-box h3,
.woocommerce-MyAccount-content-box h4,
.woocommerce-MyAccount-content-box p {
    color: inherit;
    background: transparent;
}

/* Status colors that work with light/dark themes */
.pm-status-verified {
    color: #00a32a !important;
}

.pm-status-pending {
    color: #dba617 !important;
}

.pm-status-failed {
    color: #d63638 !important;
}

.pm-status-expired {
    color: #d63638 !important;
}

.pm-status-not-verified {
    color: #646970 !important;
}