/* ==========================================================================
   Simultaneous Purchase Plugin - 100% Theme-Independent & High Specificity CSS
   ========================================================================== */

body.sp-modal-open {
    overflow: hidden;
}

#sp-modal-overlay.sp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    margin: 0;
}

#sp-modal-overlay.sp-modal-overlay.sp-modal-show {
    display: flex;
}

#sp-modal-overlay * {
    box-sizing: border-box;
}

#sp-modal-overlay .sp-modal {
    background: #ffffff;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    color: #333333;
    margin: 0;
    padding: 0;
    border: none;
}

/* Header */
#sp-modal-overlay .sp-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eeeeee;
    background: #fafafa;
    margin: 0;
}

#sp-modal-overlay .sp-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #222222;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

#sp-modal-overlay .sp-modal-discount-banner {
    display: inline-block;
    background-color: #dc3545;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    margin-top: 6px;
    letter-spacing: 0.5px;
    line-height: 1.2;
    border: none;
}

#sp-modal-overlay .sp-modal-close {
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #999999;
    padding: 0;
    margin: -4px -4px 0 0;
    box-shadow: none;
    outline: none;
}

#sp-modal-overlay .sp-modal-close:hover {
    color: #333333;
}

/* Body */
#sp-modal-overlay .sp-modal-body {
    padding: 16px 20px;
    max-height: 60vh;
    overflow-y: auto;
    margin: 0;
    background: #ffffff;
}

#sp-modal-overlay .sp-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#sp-modal-overlay .sp-related-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 0;
    margin: 0;
    list-style: none;
}

#sp-modal-overlay .sp-related-item:last-child {
    border-bottom: none;
}

#sp-modal-overlay .sp-related-label,
#sp-modal-overlay .sp-related-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    width: 100%;
}

#sp-modal-overlay .sp-related-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    accent-color: #0d6efd;
    flex-shrink: 0;
}

#sp-modal-overlay .sp-related-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eaeaea;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

#sp-modal-overlay .sp-related-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 0;
    text-align: left;
}

#sp-modal-overlay .sp-related-name {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    line-height: 1.3;
    margin: 0;
    display: block;
}

#sp-modal-overlay .sp-related-price-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin: 0;
}

#sp-modal-overlay .sp-price-original {
    text-decoration: line-through;
    color: #888888;
    font-size: 12px;
    font-weight: normal;
}

#sp-modal-overlay .sp-price-discounted {
    color: #dc3545;
    font-weight: 700;
    font-size: 14px;
}

#sp-modal-overlay .sp-price-normal {
    color: #333333;
    font-weight: 700;
    font-size: 13px;
}

#sp-modal-overlay .sp-related-note {
    font-size: 11px;
    color: #888888;
    margin: 0;
}

#sp-modal-overlay .sp-related-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #555555;
    margin: 0;
    white-space: nowrap;
}

#sp-modal-overlay .sp-related-quantity {
    width: 52px;
    height: 32px;
    padding: 2px 6px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    background: #ffffff;
    color: #333333;
    box-shadow: none;
    margin: 0;
}

/* Footer */
#sp-modal-overlay .sp-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #eeeeee;
    background: #fafafa;
    display: flex;
    gap: 10px;
    margin: 0;
}

#sp-modal-overlay .sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.4;
    text-decoration: none;
    box-shadow: none;
    outline: none;
    margin: 0;
}

#sp-modal-overlay .sp-btn-secondary {
    background-color: #f8f9fa;
    border-color: #cccccc;
    color: #444444;
}

#sp-modal-overlay .sp-btn-secondary:hover {
    background-color: #e9ecef;
    border-color: #bbbbbb;
    color: #222222;
}

#sp-modal-overlay .sp-btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

#sp-modal-overlay .sp-btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #ffffff;
}

#sp-modal-overlay .sp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #sp-modal-overlay .sp-modal-footer {
        flex-direction: column;
    }
}