/**
 * PCK Alternatives Styles
 *
 * @package PCK_WOO_Sync
 */

/* Force tilvalg til å vises som egen blokk over quantity/add-to-cart */
.pck-alternatives-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 1.5em 0 !important;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    clear: both !important;
    float: none !important;
    display: block !important;
    flex: 0 0 100% !important;
    order: -1 !important;
}

/* Hvis form bruker flexbox, tving wrapping */
form.cart,
.woocommerce form.cart {
    flex-wrap: wrap !important;
}

/* Sikre at quantity og button kommer etter tilvalg */
form.cart .quantity,
form.cart button.single_add_to_cart_button,
.woocommerce form.cart .quantity,
.woocommerce form.cart button.single_add_to_cart_button {
    order: 1 !important;
}

.pck-alternatives-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #e5e7eb;
}

.pck-alternatives-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pck-alternatives-header h4::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236366f1' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 6v6m0 0v6m0-6h6m-6 0H6'/%3E%3C/svg%3E") no-repeat center;
}

.pck-alternatives-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #6b7280;
}

.pck-alternatives-header:hover .pck-alternatives-toggle {
    background: #d1d5db;
    color: #374151;
}

.pck-alternatives-toggle[aria-expanded="false"] {
    transform: rotate(-90deg);
}

.pck-alternatives-content {
    padding: 16px 18px;
}

.pck-alternatives-content.collapsed {
    display: none;
}

.pck-alternatives-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pck-alternative-item {
    margin: 0;
}

.pck-alternative-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.15s ease;
    background: #fff;
}

.pck-alternative-label:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.pck-alternative-label:has(input:checked) {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Skjul standard checkbox */
.pck-alternative-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom checkbox */
.pck-alternative-checkmark {
    position: relative;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    margin-right: 14px;
    transition: all 0.15s ease;
}

.pck-alternative-label:hover .pck-alternative-checkmark {
    border-color: #9ca3af;
}

.pck-alternative-checkbox:checked + .pck-alternative-checkmark {
    background: #6366f1;
    border-color: #6366f1;
}

.pck-alternative-checkbox:checked + .pck-alternative-checkmark::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.pck-alternative-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 12px;
}

.pck-alternative-description {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.pck-alternative-price {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 6px;
}

.pck-alternative-price.positive {
    color: #dc2626;
    background: #fef2f2;
}

.pck-alternative-price.negative {
    color: #059669;
    background: #ecfdf5;
}

/* Summary */
.pck-alternatives-summary {
    margin-top: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pck-alternatives-total-label {
    font-size: 14px;
    font-weight: 500;
    color: #713f12;
}

.pck-alternatives-total-price {
    font-size: 16px;
    font-weight: 700;
    color: #b45309;
}

/* Responsive */
@media (max-width: 480px) {
    .pck-alternative-text {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .pck-alternative-price {
        font-size: 13px;
    }
    
    .pck-alternatives-header {
        padding: 12px 14px;
    }
    
    .pck-alternatives-content {
        padding: 14px;
    }
}
