/**
 * Frontend styles for OC Product Add-Ons
 */

/* Remove any sticky/fixed positioning */
.oc-product-addons-wrapper {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
    transform: none !important;
    margin: 20px 0;
    padding: 20px;
    background: #2c2c2c;
    border-radius: 8px;
    border: 1px solid #444;
    box-sizing: border-box;
}

.oc-addons-title {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
}

.oc-product-addons {
    margin-bottom: 15px;
}

/* Individual addon item */
.oc-addon-item {
    display: flex;
    flex-direction: row;
    gap: 15px;
    padding: 15px;
    margin-bottom: 12px;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.oc-addon-item:last-child {
    margin-bottom: 0;
}

.oc-addon-item:hover {
    border-color: #777;
}

.oc-addon-item.has-selection {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Addon image */
.oc-addon-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.oc-addon-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Addon details */
.oc-addon-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.oc-addon-header-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

/* Addon name */
.oc-addon-name {
    font-weight: 600;
    font-size: 1em;
    color: #fff;
}

/* Addon price - white for dark background box */
.oc-addon-price {
    color: #fff;
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
}

.oc-addon-percentage {
    font-size: 0.85em;
    color: #ccc;
    font-weight: normal;
}

/* VAT label */
.oc-addon-vat {
    font-size: 0.85em;
    color: #ccc;
    font-weight: normal;
}

/* "each" label for quantity items */
.oc-addon-each {
    font-size: 0.85em;
    color: #aaa;
    font-weight: normal;
}

/* Required badge */
.oc-addon-required-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.65em;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

/* Addon description */
.oc-addon-description {
    margin: 0;
    padding: 0;
    font-size: 0.85em;
    color: #bbb;
    line-height: 1.4;
}

/* Choice buttons container */
.oc-addon-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

/* Individual choice button */
.oc-addon-choice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: #4a4a4a;
    border: 2px solid #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    min-width: 100px;
}

.oc-addon-choice:hover {
    border-color: #888;
    background: #555;
}

.oc-addon-choice.selected {
    border-color: #2271b1;
    background: #1e3a5f;
}

.oc-addon-choice-yes.selected {
    border-color: #16a34a;
    background: #14532d;
}

.oc-addon-choice-yes.selected .oc-choice-label {
    color: #4ade80;
}

.oc-addon-choice-no.selected {
    border-color: #888;
    background: #4a4a4a;
}

/* Unselected state */
.oc-addon-choice-yes:not(.selected) {
    background: #4a4a4a;
    border-color: #666;
}

.oc-addon-choice-yes:not(.selected):hover {
    background: #1e3a5f;
    border-color: #2271b1;
}

/* Hide actual radio button */
.oc-addon-choice input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.oc-choice-label {
    font-size: 0.9em;
    color: #fff;
}

/* Included badge for required items */
.oc-addon-included {
    display: inline-block;
    padding: 6px 12px;
    background: #dcfce7;
    color: #16a34a;
    font-size: 0.85em;
    font-weight: 600;
    border-radius: 6px;
}

/* Quantity selector */
.oc-addon-quantity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.oc-addon-quantity label {
    font-size: 0.85em;
    color: #ccc;
    font-weight: 500;
    margin: 0;
}

.oc-addon-qty-input {
    width: 50px;
    padding: 6px;
    border: 2px solid #555;
    border-radius: 6px;
    font-size: 0.9em;
    text-align: center;
    background: #4a4a4a;
    color: #fff;
    -moz-appearance: textfield;
}

.oc-addon-qty-input::-webkit-outer-spin-button,
.oc-addon-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.oc-addon-qty-input:focus {
    outline: none;
    border-color: #2271b1;
}

/* Cart addon styling */
.oc-addon-qty {
    display: inline-block;
    padding: 4px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    font-weight: 500;
}

/* Total price section */
.oc-total-price-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 2px solid #555;
}

.oc-total-label {
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
}

.oc-total-price {
    font-size: 1.3em;
    font-weight: 700;
    color: #4fc3f7;
}

/* Animation for price update */
.oc-total-price.updating {
    animation: priceUpdate 0.3s ease;
}

@keyframes priceUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ==================== */
/* MOBILE RESPONSIVE    */
/* ==================== */

@media screen and (max-width: 600px) {
    .oc-product-addons-wrapper {
        padding: 12px;
        margin: 12px 0;
        border-radius: 6px;
    }
    
    .oc-addons-title {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    /* Keep horizontal layout on mobile but smaller */
    .oc-addon-item {
        flex-direction: row;
        padding: 10px;
        gap: 10px;
    }
    
    /* Smaller image on mobile */
    .oc-addon-image {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
    
    .oc-addon-details {
        gap: 4px;
    }
    
    .oc-addon-header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .oc-addon-name {
        font-size: 0.9em;
        line-height: 1.2;
    }
    
    .oc-addon-price {
        font-size: 0.85em;
    }
    
    .oc-addon-vat {
        font-size: 0.75em;
        display: block;
        margin-top: 1px;
    }
    
    .oc-addon-description {
        font-size: 0.8em;
        line-height: 1.3;
    }
    
    .oc-addon-choices {
        gap: 6px;
        margin-top: 6px;
    }
    
    .oc-addon-choice {
        padding: 6px 12px;
        min-width: 80px;
        flex: 1;
    }
    
    .oc-choice-label {
        font-size: 0.8em;
    }
    
    .oc-addon-quantity {
        margin-top: 4px;
    }
    
    .oc-addon-quantity label {
        font-size: 0.8em;
    }
    
    .oc-addon-qty-input {
        width: 45px;
        padding: 5px;
        font-size: 0.85em;
    }
    
    .oc-total-price-wrapper {
        padding-top: 10px;
        margin-top: 10px;
    }
    
    .oc-total-label {
        font-size: 1em;
    }
    
    .oc-total-price {
        font-size: 1.15em;
    }
    
    .oc-addon-included {
        padding: 4px 8px;
        font-size: 0.75em;
    }
    
    .oc-addon-required-badge {
        font-size: 0.6em;
        padding: 2px 4px;
    }
}

/* Very small screens */
@media screen and (max-width: 400px) {
    .oc-product-addons-wrapper {
        padding: 10px;
        margin: 10px 0;
    }
    
    .oc-addon-item {
        padding: 8px;
        gap: 8px;
    }
    
    .oc-addon-image {
        width: 50px;
        height: 50px;
    }
    
    .oc-addon-name {
        font-size: 0.85em;
    }
    
    .oc-addon-price {
        font-size: 0.8em;
    }
    
    .oc-addon-choice {
        padding: 5px 8px;
        min-width: 70px;
    }
    
    .oc-choice-label {
        font-size: 0.75em;
    }
}
