:root {
    --bg-main: #f4f7f9;
    --bg-panel: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.15);
    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.1);
    --warning: #f59e0b;
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.15);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.75rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #f4f7f9;
    color: var(--text-main);
    line-height: 1.6;
}
    .pc{
        display: block;
    }
    .sp{
        display: none;
    }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 15px 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header img {
    max-height: 40px;
}

/* Page Title */
.page-title {
    text-align: center;
    color: #0e172a;
    margin: 40px 0 20px;
    font-size: 2rem;
    font-weight: 900;
}

/* Order Details Header */
.order-details-header h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.order-details-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 15px 0 25px 0;
}

/* Purchase Method Section */
.purchase-method-title {
    font-size: 1.1rem;
    color: #0f172a;
    margin-bottom: 15px;
}
.purchase-type-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}
.purchase-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #475569;
    font-size: 1.1rem;
    font-weight: bold;
    gap: 10px;
}
.purchase-card i {
    font-size: 1.8rem;
    color: #64748b;
}
.purchase-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.purchase-card.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
}
.purchase-card.active i {
    color: #2563eb;
}

/* Custom Select Section */
.custom-select-section {
    padding: 40px 0;
}
.custom-select-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
.custom-select-items {
    flex: 6;
    width: 60%;
    background: #fff;
    padding: 20px;
    border-radius: var(--radius);

    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-normal);
}
.custom-summary-panel {
    position: sticky;
    top: 90px;
    flex: 4;
    width: 40%;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-normal);
}

/* Responsive styles moved to bottom */

/* Rows (Card layout based on mockup) */
.custom-select-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: #fff;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.row-top {
    display: flex;
    align-items: center;
    gap: 15px;
}
.row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.row-bottom-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.row-number {
    font-weight: bold;
    color: var(--secondary-color);
    background: #f0ecf5;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.custom-product-select-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.row-product-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}
.custom-product-select {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1.1rem;
    background: #fdfdfd;
    min-width: 0;
    max-width: 100%;
    text-overflow: ellipsis;
}
.row-product-price {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.row-original-prices {
    color: #999;
    font-size: 0.85rem;
}
.row-campaign-price {
    color: var(--text-main);
    font-size: 1rem;
}
.row-campaign-price strong {
    font-weight: 900;
    color: var(--secondary-color);
}
.custom-save-text {
    color: var(--danger);
    font-size: 0.95rem;
    font-weight: bold;
    margin-left: 5px;
}

/* Quantity Selector */
.custom-item-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    overflow: hidden;
    background: #fff;
}
.selector-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    color: var(--primary-color);
    transition: background 0.2s;
}
.selector-btn:hover {
    background: #f3f6fd;
}
.selector-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}
.selector-value {
    width: 30px;
    text-align: center;
    font-weight: bold;
}

/* Delete button */
.btn-delete-row {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
}
.btn-delete-row:hover {
    color: var(--danger);
}

/* Empty State Message */
.empty-state-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    color: #94a3b8; /* gray-400 */
}
.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    color: #e2e8f0; /* lighter gray */
}
.empty-state-message p {
    font-size: 1.1rem;
    font-weight: bold;
    color: #8c9bb0; /* gray text */
}

/* Add Row Button */
.btn-add-row {
    width: 100%;
    background: #f8fafc;
    border: 2px dotted #2563eb;
    color: #2563eb;
    padding: 10px 15px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s;
}
.btn-add-row:hover {
    background: #eff6ff;
}

/* Summary Panel */
.summary-title {
    font-size: 1.3rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* Free Shipping Progress */
.free-shipping-progress-container {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}
.free-shipping-text {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 10px;
}
.free-shipping-text strong {
    color: var(--danger);
    font-size: 1.3rem;
    margin: 0 5px;
}
.progress-bar-bg {
    background: #e2e8f0;
    border-radius: 10px;
    height: 10px;
    width: 100%;
    overflow: hidden;
}
.progress-bar-fill {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1rem;
    color: #333;
}
.summary-bags strong {
    font-size: 1.3rem;
    color: var(--primary-color);
}
.summary-discount {
    background-color: #e6f4ea;
    color: #129d5b;
    padding: 4px 7px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 900;
    display: inline-block;
}
.summary-discount strong {
    font-size: inherit;
    color: inherit;
}
.summary-price {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--secondary-color);
}
.summary-breakdown-box {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.95rem;
    text-align: center;
}
.btn-primary {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #d83d81 100%);
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s;
}
.btn-primary:hover {
    transform: translateY(-2px);
}
.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Custom Order Button */
.btn-custom-order {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, rgb(245, 158, 11), rgb(239, 68, 68));
    color: #fff;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}
.btn-custom-order i {
    margin-right: 8px;
    font-size: 1.3rem;
    vertical-align: text-bottom;
}
.btn-custom-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}
.btn-custom-order:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.summary-warning {
    color: var(--danger);
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-align: center;
}

/* Discount Table Info */
.discount-info-panel {
    background: #f9f9f9;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #d4d4d4;
}
.discount-info-panel h3 {
    color: #334e68;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

/* Shipping Info Section in Discount Panel */
.shipping-info-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed #ccc;
}
.shipping-info-title {
    text-align: center;
    color: #334e68;
    margin-bottom: 15px;
    font-size: 1.15rem;
}
.shipping-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
}
.shipping-row-regular {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #334e68;
}
.shipping-row-subscription {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334e68;
}
.tax-text {
    font-size: 0.85em;
    font-weight: normal;
}
.shipping-free-notice {
    text-align: center;
    color: #e53e3e;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 15px;
}
.free-shipping-badge {
    background: #fff5f5;
    padding: 3px 10px;
    border-radius: 4px;
    display: inline-block;
    margin-left: 5px;
}

.discount-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}
.discount-table th, .discount-table td {
    text-align: center;
    padding: 15px 5px;
    vertical-align: middle;
}
.discount-table th {
    font-size: 1.1rem;
    color: #fff;
    border: 2px solid #fff;
}
.discount-table .th-empty {
    background: transparent;
    border: none;
}
.discount-table .th-1bag {
    background: #fff;
    color: #333;
    border: 2px solid #e2e8f0;
}
.discount-table .th-2to4 {
    background: #4a9be8;
}
.discount-table .th-5to9 {
    background: #4a9be8;
}
.discount-table .th-10plus {
   background: linear-gradient(135deg, rgb(245, 158, 11), rgb(239, 68, 68));
}

/* Row Styling */
.discount-table tbody tr {
    border-top: 1px dashed #cbd5e1;
}
.discount-table tbody tr:first-child {
    border-top: 2px solid #e2e8f0;
}
.discount-table td {
    font-weight: bold;
}
.discount-table .td-label {
    color: #334e68;
    font-size: 0.95rem;
    text-align: left;
    padding-left: 10px;
    background: #ffffff;
}
.discount-table #row-subscription .td-label {
    background: #f8fafc;
}

/* Background colors based on column and row */
.discount-table #row-regular .td-1bag { background: #ffffff; color: #334e68; }
.discount-table #row-regular .td-2to4 { background: #f8fafc; }
.discount-table #row-regular .td-5to9 { background: #e0f2fe; }
.discount-table #row-regular .td-10plus { background: #fff7ed; }

.discount-table #row-subscription .td-1bag { background: #f8fafc; }
.discount-table #row-subscription .td-2to4 { background: #e0f2fe; }
.discount-table #row-subscription .td-5to9 { background: #bae6fd; }
.discount-table #row-subscription .td-10plus { background: #ffedd5; }

/* Text styling for discount rates */
.discount-table .discount-rate {
    font-size: 1.3rem;
    color: #e53e3e; /* Red color for percentage */
    font-weight: 900;
}
.discount-table .discount-text {
    font-size: 0.75rem;
    color: #64748b; /* Gray text for "割引" */
    margin-left: 2px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.show {
    display: flex;
}
.modal-content {
    background: #fff;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
}
.close-modal:hover { color: #333; }

/* Product Selection Grid in Modal */
.modal-filter-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.search-input-wrapper {
    flex: 1;
    position: relative;
}
.search-input-wrapper i {
    position: absolute;
    top: 50%; left: 15px;
    transform: translateY(-50%);
    color: #999;
}
#product-search {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
}
.category-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 5px;
}
.category-tab {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 50px;
    cursor: pointer;
    white-space: nowrap;
}
.category-tab.active {
    background: #2663eb;
    color: #fff;
    border-color: var(--secondary-color);
}
.product-selection-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 5px;
}
.product-card {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.added-badge {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #94a3b8;
    color: white;
    padding: 5px 10px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 2;
}
.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}
.product-card.selected {
    border-color: var(--accent-primary);

}
.product-card-img {
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}
.product-card-name {
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 5px;
    height: 3em;
    overflow: hidden;
}
.product-card-price {
    color: var(--text-light);
    font-size: 0.9rem;
}
.modal-selection-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.selection-status {
    font-weight: bold;
}
.btn-outline {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
}

/* Modal Footer Custom Buttons */
.btn-modal-add {
    flex: 2;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
        box-shadow: 0 3px 12px rgb(63 81 181 / 70%);
}
.btn-modal-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(218, 69, 143, 0.5);
}
.btn-modal-add:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-modal-cancel {
    flex: 1;
    background: #fff;
    color: #333;
    border: 1px solid #d1d5db;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}
.btn-modal-cancel:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.modal-action-buttons {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
    max-width: 400px;
}

/* Swipe Hint */
.swipe-hint {
    display: none;
}
@keyframes swipeGestureAnim {
    0% { transform: translateX(10px); opacity: 0.7; }
    50% { transform: translateX(-10px); opacity: 1; }
    100% { transform: translateX(10px); opacity: 0.7; }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .pc{
        display: none;
    }
    .sp{
        display: block;
    }
    .custom-select-container {
        flex-direction: column;
    }
    .custom-select-items {
        width: 100%;
        padding: 1.5rem 10px;
    }
    .custom-summary-panel {
        width: 100%;
        position: static;
        padding: 1.5rem 1rem;
    }
    .page-title {
        font-size: 1.4rem;
        margin: 20px 0 15px;
    }
    .purchase-type-cards {
        flex-direction: row;
        gap: 10px;
    }
    .discount-table-container {
        overflow-x: auto;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
    .discount-table {
        min-width: 500px;
    }
    .discount-table th, .discount-table td {
        padding: 10px 5px;
        font-size: 0.9rem;
    }
    .discount-table .discount-rate {
        font-size: 1.1rem;
    }
    .shipping-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .row-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .row-bottom-right {
        width: 100%;
        justify-content: space-between;
    }
    .modal-content {
        padding: 20px 15px;
        width: 95%;
        max-height: 95vh;
    }
    .product-selection-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .modal-filter-row {
        flex-direction: column;
        gap: 10px;
    }
    .category-tabs {
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
    .btn-custom-order {
        padding: 15px;
        font-size: 1.1rem;
    }
    .modal-action-buttons {
        flex-direction: column;
    }
    .modal-selection-footer {
        display: block;
    }
    
    .discount-table-wrapper {
        position: relative;
    }
    .swipe-hint {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: rgba(60, 64, 67, 0.9);
        color: #fff;
        padding: 15px 25px;
        border-radius: 12px;
        z-index: 10;
        pointer-events: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        white-space: nowrap;
        transition: opacity 0.4s ease;
    }
    .swipe-hint.hidden {
        opacity: 0;
    }
    .swipe-icons {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 10px;
        animation: swipeGestureAnim 2s infinite ease-in-out;
    }
    .swipe-hint i {
        font-size: 1.8rem;
    }
    .swipe-text {
        font-size: 0.9rem;
        font-weight: bold;
    }
}
