/**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License version 3.0
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
 */

/* Modern Accessories Upsell Section */
.accessories-upsell-modern {
    margin: 20px 0;
    background-color: #f5f6fa;
    border-radius: 8px;
    overflow: hidden;
}

.accessories-container {
    padding: 24px;
}

.accessories-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

/* Info Section */
.accessories-info {
    display: flex;
    align-items: flex-start;
    background-color: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
}

.accessories-info .bi {
    /* background-color: #f39c12; */
    /* color: white; */
    color: var(--steag-about-accent);
    /* border-radius: 50%; */
    /* width: 24px; */
    /* height: 24px; */
    /* display: flex; */
    /* align-items: center; */
    /* justify-content: center; */
    align-self: center;
    font-size: 24px;
    margin-right: 12px;
    /* flex-shrink: 0; */
    /* margin-top: 2px; */
}

.accessories-description {
    color: #5a6c7d;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    font-style: italic;
}

/* Accessories List */
.accessories-list-modern {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accessory-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
}

.accessory-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.accessory-card.accessory-disabled {
    opacity: 0.6;
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.accessory-card.accessory-disabled:hover {
    border-color: #e1e8ed;
    box-shadow: none;
}

.accessory-card.accessory-selected {
    border-color: #3498db;
    background-color: #f0f8ff;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

/* Checkbox */
.accessory-checkbox-wrapper {
    margin-right: 16px;
    flex-shrink: 0;
}

.accessory-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #bdc3c7;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    appearance: none;
    position: relative;
    transition: all 0.2s ease;
}

.accessory-checkbox:checked {
    background-color: #3498db;
    border-color: #3498db;
}

.accessory-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.accessory-checkbox:disabled {
    border-color: #e1e8ed;
    background-color: #f8f9fa;
    cursor: not-allowed;
}

/* Image */
.accessory-image-wrapper {
    margin-right: 16px;
    flex-shrink: 0;
}

.accessory-image-modern {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e1e8ed;
}

.accessory-image-placeholder-modern {
    width: 60px;
    height: 60px;
    background-color: #ecf0f1;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
}

.accessory-image-placeholder-modern .material-icons {
    font-size: 24px;
}

/* Details */
.accessory-details {
    flex: 1;
    min-width: 0;
}

.accessory-name-modern {
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Price */
.accessory-price-wrapper {
    flex-shrink: 0;
    margin-left: 16px;
}

.accessory-price-modern {
    font-size: 16px;
    font-weight: 600;
    color: #27ae60;
}

/* Material Icons Fallback */
.material-icons {
    font-family: 'Material Icons', sans-serif;
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
}

/* Alternative for info icon without Material Icons */
.info-icon:not(.material-icons) {
    font-family: Arial, sans-serif;
    font-weight: bold;
    font-size: 14px;
}

.info-icon:not(.material-icons)::before {
    content: "i";
}

/* Responsive Design */
@media (max-width: 768px) {
    .accessories-container {
        padding: 12px;
    }
    
    .accessories-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .accessories-info {
        padding: 10px;
        margin-bottom: 16px;
    }
    
    .accessories-list-modern {
        gap: 10px;
    }
    
    .accessory-card {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .accessory-checkbox-wrapper {
        margin-right: 0;
        align-self: flex-start;
        order: 1;
    }
    
    .accessory-image-wrapper {
        margin-right: 0;
        align-self: center;
        order: 2;
    }
    
    .accessory-image-modern,
    .accessory-image-placeholder-modern {
        width: 60px;
        height: 60px;
    }
    
    .accessory-details {
        order: 3;
        text-align: center;
        width: 100%;
    }
    
    .accessory-name-modern {
        font-size: 14px;
        white-space: normal;
        text-align: center;
        margin-bottom: 8px;
    }
    
    .accessory-stock-info {
        justify-content: center;
        margin-top: 6px;
    }
    
    .accessory-price-wrapper {
        margin-left: 0;
        margin-top: 8px;
        order: 4;
        align-self: center;
    }
    
    .accessory-price-modern {
        font-size: 16px;
        font-weight: 700;
    }
    
    /* Better card layout for mobile */
    .accessory-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .accessory-checkbox-wrapper {
        order: 1;
        flex-shrink: 0;
    }
    
    .accessory-image-wrapper {
        order: 2;
        flex-shrink: 0;
        margin-right: 12px;
    }
    
    .accessory-details {
        order: 3;
        flex: 1;
        text-align: left;
    }
    
    .accessory-price-wrapper {
        order: 4;
        flex-shrink: 0;
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .accessories-upsell-modern {
        margin: 15px 0;
    }
    
    .accessories-container {
        padding: 8px;
    }
    
    .accessories-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .accessories-info {
        flex-direction: column;
        text-align: center;
        padding: 8px;
        margin-bottom: 12px;
    }
    
    .info-icon {
        margin: 0 auto 8px auto;
    }
    
    .accessories-list-modern {
        gap: 8px;
    }
    
    /* Simplified mobile card layout - work with existing HTML structure */
    .accessory-card {
        padding: 10px;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important; /* Changed from center to flex-start */
        gap: 8px !important;
    }
    
    /* First row: checkbox and name take full width */
    .accessory-checkbox-wrapper {
        order: 1;
        flex: 0 0 auto;
        margin-right: 8px !important;
        align-self: flex-start !important; /* Explicit left alignment */
    }
    
    .accessory-details {
        order: 2;
        flex: 1 1 calc(100% - 40px); /* Full width minus checkbox space */
        min-width: 0;
        text-align: left !important; /* Force left alignment */
        align-self: flex-start !important; /* Explicit left alignment */
        margin-bottom: 8px;
    }
    
    .accessory-name-modern {
        font-size: 13px;
        line-height: 1.3;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        margin: 0 0 4px 0;
        text-align: left !important; /* Force left alignment */
    }
    
    /* Stock info in details area - stack vertically and left-align */
    .accessory-details .accessory-stock-info {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        margin-top: 4px;
        justify-content: flex-start !important; /* Left-align badges */
        align-items: flex-start !important;
    }
    
    /* Second row: image and price */
    .accessory-image-wrapper {
        order: 3;
        flex: 0 0 auto;
        margin-right: 8px !important;
        margin-left: 0px !important; /* Remove margin - align to left */
        align-self: flex-start !important; /* Explicit left alignment */
    }
    
    .accessory-price-wrapper {
        order: 4;
        flex: 0 0 auto;
        margin-left: auto !important; /* Keep price on the right */
        align-self: flex-start !important;
    }
    
    .accessory-price-modern {
        font-size: 14px;
        white-space: nowrap;
        font-weight: 700;
    }
    
    /* Mobile config options - fix text wrapping within fixed container */
    .accessory-config-option {
        display: block !important;
        /* padding: 8px !important; */
        padding: 0px !important;
        margin: 6px 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        width: calc(100vw - 40px) !important; /* Account for container margins + padding */
        max-width: calc(100vw - 40px) !important;
        word-wrap: break-word !important;
    }
    
    .accessory-config-option span {
        display: block !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        hyphens: auto !important;
        line-height: 1.3 !important;
        font-size: 13px !important;
        box-sizing: border-box !important;
    }
    
    .accessory-config-option span .single-accessory-text{
        color: #27AE60 !important;
        font-weight: 600;
        display: inline !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
    }

    /* .accessory-config-option strong { */
    .accessory-config-option .single-accessory-title {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        display: inline !important;
    }
    
    /* Keep summary row on single row with width constraints */
    .accessories-summary-row {
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 8px 0 !important;
        flex-wrap: nowrap !important;
        width: calc(100vw - 40px) !important;
        max-width: calc(100vw - 40px) !important;
        box-sizing: border-box !important;
    }
    
    .accessories-summary-info {
        flex: 1;
        min-width: 0;
        flex-wrap: wrap !important;
        gap: 2px !important;
    }
    
    .accessories-summary-text,
    .accessories-total-price {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        hyphens: auto !important;
    }
    
    .accessories-expand-icon {
        flex-shrink: 0;
        font-size: 16px;
    }
    
    .accessory-detail-item {
        padding: 6px 0 6px 12px !important;
        font-size: 12px !important;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accessory-card {
    animation: fadeInUp 0.3s ease-out;
}

.accessory-card:nth-child(1) { animation-delay: 0.05s; }
.accessory-card:nth-child(2) { animation-delay: 0.1s; }
.accessory-card:nth-child(3) { animation-delay: 0.15s; }
.accessory-card:nth-child(4) { animation-delay: 0.2s; }
.accessory-card:nth-child(5) { animation-delay: 0.25s; }

/* Loading State */
.accessories-loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.accessories-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ecf0f1;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Configuration Options in Footer */
.accessory-config-option {
    /* padding: 8px 12px !important; */
    /* margin: 4px 0 !important; */
    background-color: #f8f9fa !important;
    /* border: 1px solid #e9ecef !important; */
    border-radius: 4px !important;
    font-size: 14px !important;
    color: #495057 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    animation: slideInFromRight 0.3s ease-out;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    flex-wrap: wrap !important;
}

.accessory-config-option span {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
}

.accessory-config-option span .single-accessory-text{
    color: #27AE60 !important;
    font-weight: 600;
    /* display: inline !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: normal !important; */
}


.accessory-config-option .accessory-price {
    font-weight: 600;
    color: #27ae60;
    display: none !important; /* Hide accessory prices */
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}



/* Stock information styling */
.accessory-stock-info {
    margin-top: 4px;
}

.accessory-stock-badge {
    font-size: 12px;
    font-weight: 600;
    color: #28a745;
    background-color: #d4edda;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #c3e6cb;
    display: inline-block;
}

/* Messages container styling */
.accessories-messages-container {
    margin-top: 16px;
    min-height: 0;
}

.accessories-messages-container .accessory-stock-message {
    margin: 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background-color: var(--steag-about-accent);
}

/* Exhausted accessory styling */
.accessory-card.accessory-exhausted {
    opacity: 0.7;
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.accessory-card.accessory-exhausted:hover {
    border-color: #e9ecef;
    box-shadow: none;
}

.accessory-card.accessory-exhausted .accessory-checkbox {
    cursor: not-allowed;
    opacity: 0.6;
}

.accessory-card.accessory-exhausted .accessory-name-modern {
    color: #6c757d;
}

/* Dual badge system */
.accessory-stock-info {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.accessory-available-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid;
    display: inline-block;
    animation: badgeSlideIn 0.3s ease-out;
}

@keyframes badgeSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Expandable accessories list */
.accessories-summary-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer;
    padding: 6px 0 !important;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.accessories-summary-row:hover {
    background-color: #f1f3f4 !important;
}

.accessories-summary-info {
    display: flex !important;
    align-items: center !important;
    flex: 1;
    flex-wrap: wrap !important;
    gap: 4px;
}

.accessories-summary-text {
    font-weight: 500;
    color: #495057 !important;
    margin-right: 4px;
}

.accessories-total-price {
    font-weight: 600;
    color: #27ae60 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.accessories-expand-icon {
    font-size: 18px;
    transition: color 0.2s ease;
    color: #6c757d;
}

.accessories-expand-icon.expanded {
    color: #495057;
}

.accessories-detailed-list {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accessories-detailed-list.collapsed {
    max-height: 0;
}

.accessories-detailed-list.expanded {
    max-height: 500px; /* Generous max-height for smooth animation */
}

.accessory-detail-item {
    padding: 4px 0 4px 16px !important;
    margin: 0 !important;
    font-size: 13px !important;
    color: #6c757d !important;
    border: none !important;
    background: transparent !important;
    animation: none !important;
}