/**
 * CCT BackorderPopup Styles
 *
 * Theme-agnostic, accessible styling for backorder warning popup
 *
 * @category  CCT
 * @package   CCT_BackorderPopup
 * @author    Cross Creek Tractor
 * @copyright Copyright (c) 2025 Cross Creek Tractor
 */

/* ========================================
   Overlay & Modal Container
   ======================================== */

.backorder-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.backorder-popup {
    position: relative;
    max-width: 1180px;
    width: 100%;
    background: #fff;
    padding: 30px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    font-family: Arial, sans-serif;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
}

/* ========================================
   Close Button
   ======================================== */

.backorder-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s ease;
}

.backorder-close:hover,
.backorder-close:focus {
    color: #FFFFFF;
    outline: none;
}

/* ========================================
   Header
   ======================================== */

.bo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-right: 40px; /* Space for close button */
}

.bo-warning-icon {
    font-size: 24px;
    color: #d39e00;
    flex-shrink: 0;
}

.bo-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

/* ========================================
   Introduction Text
   ======================================== */

.bo-intro {
    margin: 0 0 20px 0;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

.bo-intro strong {
    font-weight: 700;
}

/* ========================================
   Two Column Content Wrapper
   ======================================== */

.bo-content-wrapper {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

/* ========================================
   Items Container
   ======================================== */

.bo-items-container {
    flex: 1;
    max-height: 400px;
    overflow-y: auto;
    min-width: 0;
}

/* ========================================
   Individual Item
   ======================================== */

.bo-item {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.bo-item:last-child {
    margin-bottom: 0;
}

/* Resolved item state */
.bo-item-resolved {
    border-color: #28a745;
    background: #f0f9f4;
}

.bo-item-updated {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    width: 100%;
    justify-content: center;
}

.bo-success-icon {
    font-size: 24px;
    color: #28a745;
    font-weight: bold;
}

.bo-success-message {
    font-size: 16px;
    color: #28a745;
    font-weight: 600;
}

/* ========================================
   Product Image
   ======================================== */

.bo-image {
    flex: 0 0 120px;
    max-width: 120px;
    margin-right: 20px;
}

.bo-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Product Info
   ======================================== */

.bo-info {
    flex: 1;
    min-width: 250px;
}

.bo-product-name {
    margin: 0 0 8px 0;
    font-size: 17px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.bo-price {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

/* ========================================
   Quantity Box
   ======================================== */

.bo-qty-box {
    background: #f7f7f7;
    padding: 12px;
    font-size: 14px;
    margin-top: 10px;
}

.bo-qty-ordered {
    margin-bottom: 10px;
    color: #333;
}

.bo-qty-backorder-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #ddd;
}

.bo-qty-backorder-label {
    color: #b30000;
    font-weight: 600;
}

.qty-value {
    font-weight: 700;
}

/* ========================================
   Remove Button
   ======================================== */

.bo-remove-btn {
    background: #c0392b;
    color: #fff;
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.bo-remove-btn:hover {
    background: #a02a1f;
    color: #FFFFFF;
}

.bo-remove-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.bo-remove-btn:disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   Why Section
   ======================================== */

.bo-why {
    flex: 1;
    padding: 20px;
    background: #f9f9f9;
    align-self: flex-start;
    min-width: 0;
}

.bo-why-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.bo-why p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px 0;
    color: #555;
}

.bo-why p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Action Buttons
   ======================================== */

.bo-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.bo-btn {
    padding: 12px 24px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.bo-btn-secondary {
    background: #333;
    color: #fff;
}

.bo-btn-secondary:hover {
    background: #1a1a1a;
    color: #FFFFFF;
}

.bo-btn-secondary:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.bo-btn-primary {
    background: #216935;
    color: #fff;
}

.bo-btn-primary:hover {
    background: #1a5429;
    color: #FFFFFF;
}

.bo-btn-primary:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    .backorder-popup {
        padding: 20px;
        max-height: 95vh;
    }

    .bo-header {
        padding-right: 35px;
    }

    .bo-title {
        font-size: 19px;
    }

    .bo-warning-icon {
        font-size: 20px;
    }

    .backorder-close {
        font-size: 28px;
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 768px) {
    .bo-content-wrapper {
        flex-direction: column;
    }

    .bo-items-container {
        max-height: none;
    }

    .bo-why {
        flex: 1;
    }
}

@media (max-width: 600px) {
    .bo-item {
        flex-direction: column;
    }

    .bo-image {
        margin-right: 0;
        margin-bottom: 15px;
        flex-basis: 100%;
        max-width: 100%;
    }

    .bo-info {
        min-width: 100%;
    }

    .bo-qty-backorder-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .bo-remove-btn {
        width: 100%;
        margin-top: 8px;
    }

    .bo-actions {
        flex-direction: column-reverse;
    }

    .bo-btn {
        width: 100%;
        text-align: center;
    }

    .backorder-popup {
        padding: 15px;
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .backorder-popup {
        border: 2px solid #000;
    }

    .bo-item {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .backorder-overlay,
    .bo-item,
    .backorder-close,
    .bo-remove-btn,
    .bo-btn {
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}
