/* ==========================================================================
   CubeProductCompare Plugin Stylesheet
   Modern, sleek, premium UI for Product Comparison & Floating Bar
   ========================================================================== */

:root {
    --cpc-primary: #2563eb;
    --cpc-primary-hover: #1d4ed8;
    --cpc-secondary: #0f172a;
    --cpc-accent: #f59e0b;
    --cpc-danger: #ef4444;
    --cpc-success: #10b981;
    --cpc-bg-glass: rgba(255, 255, 255, 0.95);
    --cpc-border: #e2e8f0;
    --cpc-diff-highlight: #fffbeb;
    --cpc-diff-badge: #d97706;
    --cpc-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* --------------------------------------------------------------------------
   1. Front Product List & Detail Card Buttons
   -------------------------------------------------------------------------- */
.plg-compare-item-wrapper,
.ec-shelfGrid__item,
:has(> .plg-compare-card-btn) {
    position: relative;
}

.plg-compare-card-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--cpc-border);
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.plg-compare-card-btn:hover {
    color: var(--cpc-primary);
    transform: scale(1.1);
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.plg-compare-card-btn.is-active {
    color: #ffffff;
    border-color: var(--cpc-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.plg-compare-detail-action {
    margin: 15px 0;
}

.plg-compare-btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid var(--cpc-primary);
    background: #ffffff;
    color: var(--cpc-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.plg-compare-btn-detail:hover {
    background: #eff6ff;
    transform: translateY(-1px);
}

.plg-compare-btn-detail.is-active {
    background: var(--cpc-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* --------------------------------------------------------------------------
   2. Floating Comparison Bar (Sticky Bottom)
   -------------------------------------------------------------------------- */
.plg-compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: var(--cpc-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--cpc-border);
    box-shadow: var(--cpc-shadow-lg);
    padding: 12px 20px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.plg-compare-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.plg-compare-bar-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.plg-compare-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--cpc-secondary);
}

.plg-compare-icon {
    color: var(--cpc-primary);
    font-size: 18px;
}

.plg-compare-btn-clear {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.plg-compare-btn-clear:hover {
    color: var(--cpc-danger);
}

.plg-compare-slots-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.plg-compare-slot {
    width: 170px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--cpc-border);
    background: #ffffff;
    display: flex;
    align-items: center;
    padding: 6px 8px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.plg-compare-slot-filled {
    border-color: #cbd5e1;
}

.plg-compare-slot-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8fafc;
    flex-shrink: 0;
}

.plg-compare-slot-info {
    margin-left: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.plg-compare-slot-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.plg-compare-slot-price {
    font-size: 11px;
    color: var(--cpc-primary);
    font-weight: 700;
}

.plg-compare-slot-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #94a3b8;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.plg-compare-slot-remove:hover {
    background: var(--cpc-danger);
}

.plg-compare-slot-empty {
    border: 1.5px dashed #cbd5e1;
    background: #f8fafc;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    outline: none;
}

.plg-compare-slot-empty:hover,
.plg-compare-slot-empty:focus {
    border-color: var(--cpc-primary);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.12);
}

.plg-compare-slot-empty:hover .plg-compare-slot-placeholder,
.plg-compare-slot-empty:focus .plg-compare-slot-placeholder {
    color: var(--cpc-primary);
}

.plg-compare-slot-empty:active {
    transform: translateY(0);
}

.plg-compare-slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.2s;
}

.plg-compare-bar-actions {
    min-width: 150px;
    display: flex;
    justify-content: flex-end;
}

.plg-compare-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    background: var(--cpc-primary);
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.plg-compare-submit-btn:hover,
.plg-compare-submit-btn:focus,
.plg-compare-submit-btn:active {
    background: var(--cpc-primary-hover);
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.plg-compare-submit-btn.is-disabled {
    opacity: 0.5;
    pointer-events: none;
    box-shadow: none;
}

/* --------------------------------------------------------------------------
   3. Comparison Matrix Page (/product/compare)
   -------------------------------------------------------------------------- */
.plg-compare-page-wrap {
    max-width: 1300px;
    margin: 30px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.plg-compare-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.plg-compare-page-title h1 {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.plg-compare-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.plg-compare-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Toggle Switch: Highlight Differences */
.plg-diff-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    background: #f8fafc;
    border: 1px solid var(--cpc-border);
    padding: 8px 14px;
    border-radius: 25px;
    transition: all 0.2s;
}

.plg-diff-toggle-label:hover {
    background: #f1f5f9;
}

.plg-toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.plg-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.plg-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 22px;
}

.plg-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.plg-toggle-switch input:checked+.plg-toggle-slider {
    background-color: var(--cpc-primary);
}

.plg-toggle-switch input:checked+.plg-toggle-slider:before {
    transform: translateX(18px);
}

/* Share & Print Buttons */
.plg-btn-share,
.plg-btn-print {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--cpc-border);
    background: #ffffff;
    color: #475569;
    transition: all 0.2s;
}

.plg-btn-share:hover,
.plg-btn-print:hover {
    background: #f8fafc;
    color: var(--cpc-primary);
    border-color: var(--cpc-primary);
}

/* --------------------------------------------------------------------------
   Matrix Table & Empty State Utilities
   -------------------------------------------------------------------------- */
.plg-compare-page-count {
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
}

.plg-compare-empty-box {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    margin: 40px 0;
}

.plg-compare-empty-icon {
    font-size: 56px;
    color: #94a3b8;
    margin-bottom: 20px;
}

.plg-compare-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.plg-compare-empty-desc {
    font-size: 14px;
    color: #64748b;
    max-width: 480px;
    margin: 0 auto 25px;
}

.plg-compare-empty-action {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
}

.plg-matrix-col-header-target {
    vertical-align: middle;
}

.plg-matrix-target-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.plg-matrix-target-sub {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.plg-matrix-target-alert {
    color: #e11d48;
}

.plg-price-range-sub {
    font-size: 12px;
    color: #64748b;
}

.plg-empty-add-icon {
    font-size: 32px;
    color: #94a3b8;
}

.plg-empty-add-label {
    font-weight: 600;
    color: #475569;
}

.plg-empty-add-max {
    font-size: 12px;
}

.plg-spec-group-icon {
    color: #2563eb;
    margin-right: 6px;
}

.plg-cat-tag {
    font-size: 11.5px;
    padding: 4px 8px;
    margin: 2px;
    display: inline-block;
}

.plg-spec-unit-text {
    font-size: 11px;
    color: #94a3b8;
}

.plg-modal-hint-text {
    text-align: center;
    color: #94a3b8;
    padding: 25px 0;
}

/* --------------------------------------------------------------------------
   Matrix Table
   -------------------------------------------------------------------------- */
.plg-matrix-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--cpc-border);
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.plg-matrix-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.plg-matrix-table th,
.plg-matrix-table td {
    padding: 16px;
    vertical-align: top;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
}

.plg-matrix-table th:last-child,
.plg-matrix-table td:last-child {
    border-right: none;
}

.plg-matrix-col-header {
    width: 240px;
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
    font-size: 14px;
    text-align: left;
}

.plg-matrix-col-product {
    text-align: center;
    background: #ffffff;
    position: relative;
}

/* Product Card in Table Header */
.plg-table-product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

.plg-table-btn-remove {
    position: absolute;
    top: 0;
    right: 0;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.plg-table-btn-remove:hover {
    background: var(--cpc-danger);
    color: #ffffff;
}

.plg-table-img-link {
    display: block;
    width: 160px;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 8px;
}

.plg-table-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.plg-table-img:hover {
    transform: scale(1.05);
}

.plg-table-product-name {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
    line-height: 1.35;
}

.plg-table-product-name:hover {
    color: var(--cpc-primary);
}

.plg-table-price {
    font-size: 18px;
    font-weight: 800;
    color: #e11d48;
}

.plg-table-stock {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

.plg-table-stock.in-stock {
    background: #ecfdf5;
    color: #059669;
}

.plg-table-stock.out-of-stock {
    background: #fef2f2;
    color: #dc2626;
}

.plg-table-btn-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--cpc-primary);
    color: #ffffff !important;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: background 0.2s;
    width: 85%;
    justify-content: center;
}

.plg-table-btn-cart:hover,
.plg-table-btn-cart:focus,
.plg-table-btn-cart:active {
    background: var(--cpc-primary-hover);
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Empty Column Slot */
.plg-table-empty-col {
    background: #fafafa;
    text-align: center;
}

.plg-empty-add-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 250px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    margin: 10px;
    padding: 20px;
    color: #94a3b8;
}

.plg-btn-add-modal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--cpc-primary);
    color: var(--cpc-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.plg-btn-add-modal:hover {
    background: var(--cpc-primary);
    color: #ffffff;
}

/* Spec Group Divider Rows */
.plg-spec-group-row td {
    background: #f1f5f9;
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
}

/* Attribute Spec Rows */
.plg-spec-row td {
    font-size: 13.5px;
    color: #334155;
    line-height: 1.5;
}

.plg-spec-name {
    font-weight: 600;
    color: #475569;
}

.plg-spec-val {
    text-align: center;
    word-break: break-word;
}

.plg-bool-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.2;
}

.plg-bool-badge.is-true {
    background: #ecfdf5;
    color: #059669;
}

.plg-bool-badge.is-false {
    background: #f1f5f9;
    color: #94a3b8;
}

/* Highlights Differences */
.plg-diff-row td {
    background: var(--cpc-diff-highlight);
}

.plg-diff-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--cpc-diff-badge);
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    display: inline-block;
}

/* 「相違点のみ表示」チェック時 */
.hide-identical .plg-identical-row {
    display: none;
}

/* --------------------------------------------------------------------------
   4. Modal Quick Search
   -------------------------------------------------------------------------- */
.plg-compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}

.plg-modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 550px;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.plg-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--cpc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plg-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.plg-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #94a3b8;
}

.plg-modal-search-wrap {
    padding: 16px 20px 12px;
    background: #ffffff;
    border-bottom: 1px solid var(--cpc-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.plg-modal-search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
    margin-bottom: 0;
    outline: none;
    background: #ffffff;
    transition: all 0.2s;
}

.plg-modal-search-input:focus {
    border-color: var(--cpc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.plg-modal-body {
    padding: 12px 20px 20px;
    max-height: 380px;
    overflow-y: auto;
}

/* Fallback if input is direct child of body */
.plg-modal-body>.plg-modal-search-input {
    position: sticky;
    top: -12px;
    z-index: 10;
    background: #ffffff;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.plg-modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.plg-modal-item:hover {
    background: #f8fafc;
}

.plg-modal-item-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8fafc;
}

.plg-modal-item-info {
    flex: 1;
}

.plg-modal-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.plg-modal-item-price {
    font-size: 12px;
    color: var(--cpc-primary);
    font-weight: 700;
}

.plg-modal-btn-select {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--cpc-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

/* Toast Notifications */
.plg-compare-toast {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 100001;
    background: #1e293b;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.plg-compare-toast.is-show {
    opacity: 1;
    transform: translateY(0);
}

.plg-compare-toast.is-error {
    background: #ef4444;
}

.plg-compare-toast.is-success {
    background: #10b981;
}

/* ==========================================================================
   5. Responsive Styles (Tablet & Mobile)
   ========================================================================== */

/* Tablet (<= 991px) */
@media (max-width: 991px) {
    .plg-compare-bar-container {
        gap: 12px;
    }

    .plg-compare-slot {
        width: 145px;
        height: 58px;
        padding: 5px 6px;
    }

    .plg-compare-slot-thumb {
        width: 40px;
        height: 40px;
    }

    .plg-compare-slot-name {
        font-size: 11px;
    }

    .plg-compare-slot-price {
        font-size: 10px;
    }

    .plg-compare-submit-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .plg-matrix-col-header {
        width: 180px;
    }

    .plg-table-img-link {
        width: 120px;
        height: 120px;
    }
}

/* Mobile Devices (<= 768px) */
@media (max-width: 768px) {

    /* 1. Floating Bar on Mobile */
    .plg-compare-bar {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    }

    .plg-compare-bar-container {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px 10px;
        align-items: center;
    }

    .plg-compare-bar-header {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .plg-compare-bar-title {
        font-size: 13.5px;
        white-space: nowrap;
    }

    .plg-compare-bar-actions {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        min-width: 0;
        justify-content: flex-end;
    }

    .plg-compare-submit-btn {
        padding: 7px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .plg-compare-slots-wrap {
        grid-column: 1 / 3;
        grid-row: 2 / 2;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 2px 0 4px;
        gap: 8px;
        scrollbar-width: none;
    }

    .plg-compare-slots-wrap::-webkit-scrollbar {
        display: none;
    }

    .plg-compare-slot {
        flex: 0 0 135px;
        width: 135px;
        height: 52px;
        padding: 4px 6px;
    }

    .plg-compare-slot-thumb {
        width: 36px;
        height: 36px;
    }

    .plg-compare-slot-info {
        margin-left: 6px;
    }

    .plg-compare-slot-name {
        font-size: 11px;
    }

    .plg-compare-slot-price {
        font-size: 10px;
    }

    .plg-compare-slot-placeholder {
        font-size: 10px;
    }

    .plg-compare-slot-remove {
        width: 16px;
        height: 16px;
        font-size: 10px;
        top: -4px;
        right: -4px;
    }

    /* 2. Detail Page Action & Card Buttons */
    .plg-compare-btn-detail {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        padding: 10px 14px;
    }

    .plg-compare-card-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
        top: 6px;
        right: 6px;
    }

    /* 3. Comparison Matrix Page */
    .plg-compare-page-wrap {
        margin: 15px auto;
        padding: 0 10px;
    }

    .plg-compare-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .plg-compare-page-title h1 {
        font-size: 20px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .plg-compare-subtitle {
        font-size: 12.5px;
    }

    .plg-compare-controls {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        justify-content: flex-start;
    }

    .plg-diff-toggle-label {
        font-size: 12px;
        padding: 6px 10px;
    }

    .plg-btn-share {
        font-size: 12px;
        padding: 6px 12px;
    }

    .plg-btn-print {
        display: none; /* モバイル端末では印刷ボタンを非表示 */
    }

    /* Sticky Matrix Table */
    .plg-matrix-table-container {
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .plg-matrix-table {
        min-width: 520px;
    }

    .plg-matrix-table th,
    .plg-matrix-table td {
        padding: 10px 8px;
    }

    .plg-matrix-col-header {
        width: 115px;
        min-width: 115px;
        max-width: 115px;
        font-size: 12px;
        position: sticky;
        left: 0;
        z-index: 2;
        background: #f8fafc;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.06);
    }

    th.plg-matrix-col-header {
        z-index: 3;
    }

    .plg-matrix-col-product {
        min-width: 135px;
        max-width: 165px;
    }

    .plg-table-img-link {
        width: 90px;
        height: 90px;
        padding: 4px;
    }

    .plg-table-product-name {
        font-size: 12px;
        min-height: 32px;
        line-height: 1.3;
    }

    .plg-table-price {
        font-size: 14px;
    }

    .plg-table-stock {
        font-size: 10.5px;
        padding: 2px 6px;
    }

    .plg-table-btn-cart {
        width: 100%;
        font-size: 11.5px;
        padding: 7px 8px;
        gap: 4px;
    }

    .plg-table-btn-remove {
        width: 22px;
        height: 22px;
        font-size: 12px;
        top: -4px;
        right: -4px;
    }

    .plg-empty-add-box {
        min-height: 160px;
        padding: 10px;
        margin: 4px;
        gap: 8px;
    }

    .plg-btn-add-modal {
        padding: 6px 10px;
        font-size: 11px;
    }

    .plg-spec-group-row td {
        padding: 8px 10px;
        font-size: 12px;
        position: sticky;
        left: 0;
    }

    .plg-spec-row td {
        font-size: 12px;
        padding: 8px 6px;
    }

    /* 4. Quick Search Modal on Mobile */
    .plg-modal-content {
        width: 94%;
        max-width: 420px;
        max-height: 85vh;
        border-radius: 10px;
        margin: 10px;
        display: flex;
        flex-direction: column;
    }

    .plg-modal-header {
        padding: 12px 14px;
    }

    .plg-modal-title {
        font-size: 14.5px;
    }

    .plg-modal-search-wrap {
        padding: 10px 14px;
    }

    .plg-modal-search-input {
        font-size: 13px;
        padding: 8px 12px;
    }

    .plg-modal-body {
        padding: 8px 14px 14px;
        max-height: 50vh;
    }

    .plg-modal-item {
        padding: 8px 6px;
        gap: 8px;
    }

    .plg-modal-item-thumb {
        width: 38px;
        height: 38px;
    }

    .plg-modal-item-name {
        font-size: 12px;
    }

    .plg-modal-item-price {
        font-size: 11px;
    }

    .plg-modal-btn-select {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* 5. Toast on Mobile */
    .plg-compare-toast {
        top: 12px;
        left: 12px;
        right: 12px;
        font-size: 12.5px;
        padding: 10px 14px;
        justify-content: center;
        text-align: center;
        border-radius: 6px;
    }
}

/* Extra Small Screens (<= 480px) */
@media (max-width: 480px) {
    .plg-compare-bar-title {
        font-size: 12.5px;
    }

    .plg-compare-submit-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .plg-compare-slot {
        flex: 0 0 120px;
        width: 120px;
        height: 48px;
    }

    .plg-compare-slot-thumb {
        width: 32px;
        height: 32px;
    }

    .plg-matrix-table {
        min-width: 460px;
    }

    .plg-matrix-col-header {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
        font-size: 11px;
    }

    .plg-matrix-col-product {
        min-width: 120px;
        max-width: 140px;
    }

    .plg-table-img-link {
        width: 76px;
        height: 76px;
    }

    .plg-table-price {
        font-size: 13px;
    }
}

/* ==========================================================================
   6. Print Styles (@media print)
   ========================================================================== */
@media print {
    /* 1. 印刷時: ヘッダー、フッター、ナビゲーション、ドロワー等を非表示 */
    header,
    footer,
    nav,
    .ec-layoutRole__header,
    .ec-layoutRole__footer,
    .ec-layoutRole__contentTop,
    .ec-layoutRole__contentBottom,
    .ec-layoutRole__left,
    .ec-layoutRole__right,
    .ec-layoutRole__mainTop,
    .ec-layoutRole__mainBottom,
    .ec-drawerRole,
    .ec-drawerRoleClose,
    .ec-blockTopBtn,
    .ec-overlayRole,
    .ec-headerNav,
    .ec-footerNav,
    .ec-footerTitle,
    .ec-pageTop {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 2. フローティングバーおよび不要な操作ボタン類を非表示 */
    #plgCompareFloatingBar,
    .plg-compare-bar,
    #plgCompareSearchModal,
    .plg-compare-modal,
    .plg-compare-toast,
    .plg-compare-controls,
    .plg-table-btn-remove,
    .plg-table-empty-col,
    .plg-btn-add-modal,
    .plg-table-btn-cart,
    .plg-compare-card-btn,
    .plg-compare-detail-action {
        display: none !important;
        visibility: hidden !important;
    }

    /* 3. 印刷用レイアウト最適化 */
    body,
    .ec-layoutRole,
    .ec-layoutRole__contents,
    .ec-layoutRole__main,
    .plg-compare-page-wrap {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #ffffff !important;
    }

    .plg-compare-page-header {
        border-bottom: 2px solid #0f172a !important;
        margin-bottom: 20px !important;
        padding-bottom: 12px !important;
    }

    .plg-compare-page-title h1 {
        font-size: 22px !important;
        color: #000000 !important;
    }

    .plg-matrix-table-container {
        overflow: visible !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .plg-matrix-table {
        width: 100% !important;
        min-width: 100% !important;
        table-layout: auto !important;
        page-break-inside: auto;
    }

    .plg-matrix-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .plg-matrix-table th,
    .plg-matrix-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 10px 12px !important;
    }

    .plg-matrix-col-header {
        position: static !important;
        box-shadow: none !important;
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .plg-spec-group-row td {
        position: static !important;
        background: #e2e8f0 !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
