/* === 阿翔電商折扣 加價購 widget === */
.pd-addon-section {
    margin: 24px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.pd-addon-section-title {
    margin: 0 0 14px;
    padding: 0 0 10px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    letter-spacing: 0.2px;
}
.pd-addon-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pd-addon-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.pd-addon-card:hover {
    border-color: #93c5fd;
}
.pd-addon-card.is-selected,
.pd-addon-card:has(input:checked) {
    border-color: #2271b1;
    background: #eff6ff;
}
.pd-addon-card.is-disabled {
    opacity: 0.58;
    cursor: not-allowed;
}
.pd-addon-card.is-disabled:hover {
    border-color: #e5e7eb;
}
.pd-addon-check {
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
}
.pd-addon-card input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}
.pd-addon-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 8px;
    background: #f3f4f6;
}
.pd-addon-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pd-addon-info {
    flex: 1 1 auto;
    min-width: 0;
}
.pd-addon-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.pd-addon-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}
.pd-addon-price del {
    color: #9ca3af;
    font-size: 12px;
}
.pd-addon-special {
    color: #dc2626;
    font-size: 15px;
    font-weight: 700;
}
.pd-addon-trigger-note {
    margin: 0 0 8px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}
.pd-addon-controls {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
}
.pd-addon-variation-field,
.pd-addon-quantity-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.3;
}
.pd-addon-variation-field {
    flex: 1 1 220px;
}
.pd-addon-quantity-field {
    flex: 0 0 96px;
}
.pd-addon-variation-select,
.pd-addon-qty {
    min-height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #111827;
    font-size: 13px;
}
.pd-addon-variation-select {
    width: 100%;
}
.pd-addon-qty {
    width: 100%;
    padding: 4px 8px;
}
.pd-addon-details-btn {
    background: none;
    border: none;
    padding: 0;
    color: #2271b1;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}
.pd-addon-details-btn:hover {
    color: #135e96;
}

/* Dialog/modal styles will be added by E2 alongside addon.js */

/* === Detail modal (<dialog>) === */
.pd-addon-modal {
    max-width: 640px;
    width: calc(100% - 32px);
    max-height: 90vh;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.pd-addon-modal::backdrop {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}
.pd-addon-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0;
}
.pd-addon-detail-header {
    display: flex;
    gap: 18px;
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
}
.pd-addon-detail-header img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #f3f4f6;
}
.pd-addon-detail-header h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.4;
    color: #111827;
}
.pd-addon-detail-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}
.pd-addon-detail-price del {
    color: #9ca3af;
    font-size: 13px;
}
.pd-addon-detail-price strong {
    color: #dc2626;
    font-size: 18px;
    font-weight: 700;
}
.pd-addon-detail-excerpt {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.6;
}
.pd-addon-detail-body {
    padding: 20px 24px;
    color: #374151;
    font-size: 14px;
    line-height: 1.7;
}
.pd-addon-detail-body img {
    max-width: 100%;
    height: auto;
}
.pd-addon-modal-footer {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}
.pd-addon-modal-footer .pd-addon-confirm {
    width: 100%;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 600;
}

/* Fallback for browsers without <dialog> */
.pd-addon-modal-fallback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
}

/* Mobile: stack header image and text */
@media (max-width: 600px) {
    .pd-addon-card {
        align-items: flex-start;
    }
    .pd-addon-thumb {
        width: 64px;
        height: 64px;
    }
    .pd-addon-controls {
        align-items: stretch;
    }
    .pd-addon-variation-field,
    .pd-addon-quantity-field {
        flex: 1 1 100%;
    }
    .pd-addon-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .pd-addon-detail-header img {
        width: 140px;
        height: 140px;
    }
}

.pd-addon-fixed-qty {
    display: inline-block;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
}
