/**
 * Product Control Pro - Frontend Styles
 * Professional frontend styling for stock badges and messages
 */

/* ============================================
   Hide Default WooCommerce Stock Display
   ============================================ */
.product .stock,
p.stock,
.woocommerce-variation-availability,
.woocommerce-product-details__short-description .stock,
.summary .stock,
.availability,
span.availability {
    display: none;
}

/* Hide WooCommerce out-of-stock badges/overlays on shop/archive pages */
.outofstock-badge,
.out-of-stock-badge,
span.onsale.outofstock,
.woocommerce ul.products li.product .outofstock-badge,
.woocommerce-loop-product__title .stock,
li.product .stock.out-of-stock,
.product-thumbnail .out-of-stock,
.woocommerce .products .product .images .out-of-stock,
.out-of-stock-overlay,
.out-of-stock-label,
.out-of-stock-label.sold_out,
div.out-of-stock-label {
    display: none;
    opacity: 0;
    visibility: hidden;
}

/* Hide "OUT OF STOCK" text overlays on product images */
.woocommerce ul.products li.product.outofstock::before,
.woocommerce ul.products li.product.outofstock::after,
.woocommerce ul.products li.product.out-of-stock::before,
.woocommerce ul.products li.product.out-of-stock::after {
    display: none;
    content: none;
    opacity: 0;
    visibility: hidden;
}

/* If your theme uses specific selectors, add them here */
.product-badge.out-of-stock,
.stock-badge.out-of-stock,
.product-label.outofstock,
.outofstock .onsale,
.product.outofstock .onsale,
li.outofstock .onsale,
li.product.outofstock span.onsale {
    display: none;
}

/* Target common theme implementations */
.products .product .onsale,
.products .product-small .onsale,
.product-small.outofstock .badge,
.product-small.outofstock .onsale,
.box-image .onsale {
    display: none;
}

/* ============================================
   Stock Badge Base Styles
   ============================================ */
.pcp-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    margin: 15px 0;
    border: 1px solid;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pcp-badge-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.pcp-badge-text {
    flex: 1;
}

/* ============================================
   Stock Status Variants
   ============================================ */
.pcp-out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.pcp-low-stock {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.pcp-backorder {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.pcp-in-stock {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* Alternative badge styles */
.pcp-stock-badge.pcp-style-danger {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.pcp-stock-badge.pcp-style-warning {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.pcp-stock-badge.pcp-style-info {
    background-color: #0dcaf0;
    color: #000;
    border-color: #0dcaf0;
}

.pcp-stock-badge.pcp-style-success {
    background-color: #198754;
    color: #fff;
    border-color: #198754;
}

/* ============================================
   Restock Information
   ============================================ */
.pcp-restock-date,
.pcp-restock-countdown {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.9;
}

.pcp-countdown-label {
    font-weight: 600;
    margin-right: 6px;
}

.pcp-countdown-timer {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 3px;
    display: inline-block;
}

/* ============================================
   Waitlist Button
   ============================================ */
.pcp-waitlist-btn {
    margin-top: 12px;
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 280px;
}

.pcp-waitlist-btn:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.pcp-waitlist-btn:active {
    transform: translateY(0);
}

.pcp-waitlist-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Waitlist Modal
   ============================================ */
.pcp-waitlist-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.pcp-waitlist-modal.active {
    display: flex;
}

.pcp-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.pcp-modal-header {
    margin-bottom: 20px;
}

.pcp-modal-header h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #1e1e1e;
}

.pcp-modal-header p {
    margin: 0;
    color: #646970;
    font-size: 14px;
}

.pcp-modal-body {
    margin-bottom: 20px;
}

.pcp-modal-body input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pcp-modal-body input[type="email"]:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.pcp-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.pcp-modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pcp-modal-footer .pcp-btn-primary {
    background: #2271b1;
    color: #fff;
}

.pcp-modal-footer .pcp-btn-primary:hover {
    background: #135e96;
}

.pcp-modal-footer .pcp-btn-secondary {
    background: #f0f0f1;
    color: #50575e;
}

.pcp-modal-footer .pcp-btn-secondary:hover {
    background: #dcdcde;
}

/* ============================================
   Alternative Products
   ============================================ */
.pcp-alternatives {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.pcp-alternatives h4 {
    margin: 0 0 20px;
    font-size: 18px;
    color: #1e1e1e;
    font-weight: 600;
}

.pcp-alternatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.pcp-alternative-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.pcp-alternative-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #2271b1;
}

.pcp-alternative-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.pcp-alternative-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}

.pcp-alt-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1e1e1e;
    margin-bottom: 6px;
    line-height: 1.4;
}

.pcp-alt-price {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #2271b1;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media screen and (max-width: 768px) {
    .pcp-stock-badge {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .pcp-badge-icon {
        font-size: 18px;
    }
    
    .pcp-waitlist-btn {
        max-width: 100%;
    }
    
    .pcp-modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .pcp-alternatives-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .pcp-alternative-item {
        padding: 10px;
    }
    
    .pcp-alt-title {
        font-size: 13px;
    }
    
    .pcp-alt-price {
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .pcp-stock-badge {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .pcp-alternatives-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pcp-modal-footer {
        flex-direction: column;
    }
    
    .pcp-modal-footer button {
        width: 100%;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .pcp-waitlist-btn,
    .pcp-alternatives {
        display: none;
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */
.pcp-stock-badge:focus-within,
.pcp-waitlist-btn:focus,
.pcp-alternative-item a:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pcp-stock-badge {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pcp-stock-badge,
    .pcp-waitlist-btn,
    .pcp-alternative-item,
    .pcp-waitlist-modal,
    .pcp-modal-content {
        transition: none;
        animation: none;
    }
}
