.confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog-content {
    background-color: white;
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 980px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { 
        transform: translateY(20px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.dialog-content h3 {
    margin: 0 0 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    color: #212529;
    font-size: 1.75rem;
    font-weight: 600;
    position: relative;
}

.dialog-content h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 3px;
    background: #0066cc;
    border-radius: 2px;
}

.dialog-content h4 {
    margin: 2rem 0 1rem;
    color: #495057;
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dialog-content h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.2em;
    background: #0066cc;
    border-radius: 2px;
}

.estimate-section {
    margin-bottom: 2.5rem;
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    transition: box-shadow 0.2s ease;
}

.estimate-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.estimate-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.estimate-table th,
.estimate-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    text-align: left;
}

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

.estimate-table tbody tr:last-child td {
    border-bottom: none;
}

.estimate-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estimate-table tbody tr {
    transition: background-color 0.15s ease;
}

.estimate-table tbody tr:hover {
    background-color: #f8f9fa;
}

.estimate-table tfoot {
    font-weight: bold;
    background-color: #f8f9fa;
}

.estimate-table tfoot td {
    border-top: 2px solid #ddd;
}

.total-section {
    margin-top: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.total-section .estimate-table {
    max-width: 500px;
    margin-left: auto;
    border: none;
    background: transparent;
}

.total-section .estimate-table th {
    width: 60%;
    background: transparent;
    font-weight: 500;
    color: #6c757d;
}

.total-section .estimate-table td {
    text-align: right;
    font-weight: 600;
    color: #212529;
}

.grand-total td {
    padding: 1rem;
    font-size: 1.125rem;
}

.tax-included td {
    color: #0066cc;
    font-size: 1.375rem;
    font-weight: 700;
    padding: 1.25rem 1rem;
}

.shipping-row td {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: normal;
}

.selected-items-list {
    margin: 1.5rem 0;
}

.selected-item {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.selected-item:last-child {
    border-bottom: none;
}

.product-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.color-info, .size-qty, .price {
    margin: 0.25rem 0;
    color: #666;
}

.order-summary {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid #eee;
    font-weight: bold;
}

.dialog-buttons {
    margin-top: 2.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 2rem 0 0;
    border-top: 1px solid #e9ecef;
}

/* ボタンの順序を調整（PC版） */
#cancel-selection-final {
    order: 1;
}

#add-more-items {
    order: 2;
    background: #ffb800!important;
}

#confirm-selection-final {
    order: 3;
}

.btn-primary, .btn-secondary {
    padding: 0.875rem 2rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #0066cc;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.btn-primary:hover {
    background-color: #0052a3;
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 102, 204, 0.2);
}

.btn-secondary {
    background-color: #fff;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

#cancel-selection-final {
    font-size: 0.875rem;
    padding: 0.75rem 1.5rem;
}

/* ログイン/会員登録モーダル */
.login-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 20000;
}

.login-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 480px;
    z-index: 20001;
}

.modal-header {
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #0066cc;
    border-bottom: 2px solid #0066cc;
}

.modal-content {
    padding: 20px;
    overflow: scroll;
    max-height: 80vh;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 14px;
    color: #666;
}

.form-group input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus {
    border-color: #0066cc;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.btn-primary {
    background-color: #0066cc;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #0052a3;
}

.btn-primary:active {
    background-color: #004080;
}

/* 注意文言のスタイル */
.note {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #0066cc;
}

/* 注意事項コンテナ */
.notes-container {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.note-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.note-item:hover {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.note-item.important {
    background: #fff5f5;
    border-color: #feb2b2;
}

.note-item.info {
    background: #ebf8ff;
    border-color: #90cdf4;
}

.note-icon {
    font-style: normal;
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 0.125rem;
}

.note-content {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #495057;
}

.note-content strong {
    display: block;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

/* トースト通知のスタイル */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1002;
    animation: fadeInUp 0.3s ease-out;
}

.toast.error {
    background-color: #dc3545;
}

.toast.success {
    background-color: #28a745;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
} 

/* 数量コントロール（インライン版） */
.quantity-control-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 2px;
}

.qty-btn-inline {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
}

.qty-btn-inline:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.qty-btn-inline:active {
    background: #dee2e6;
}

.qty-input-inline {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    padding: 3px;
    height: 24px;
}

.qty-input-inline:focus {
    outline: none;
    border-color: #0066cc;
}

/* 削除ボタン */
.item-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    vertical-align: middle;
}

.item-delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.item-delete-btn:active {
    transform: scale(0.95);
}

/* 小計セルの調整 */
.item-subtotal {
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

/* 小計列のレイアウト調整 */
.estimate-table td:last-child {
    white-space: nowrap;
}

/* PC版で削除ボタンが段落ちしないように */
@media (min-width: 601px) {
    .estimate-table tbody td:last-child {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    
    .item-subtotal {
        flex: 0 0 auto;
        margin-right: 0;
    }
}

/* カスタムスクロールバー */
.dialog-content::-webkit-scrollbar {
    width: 8px;
}

.dialog-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.dialog-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.dialog-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Firefox用のスクロールバー */
.dialog-content {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* プリント加工費用の内訳表示 */
.print-total-breakdown td {
    padding: 0 !important;
    border: none !important;
}

.breakdown-cell {
    background: #f8f9fa;
}

.cost-breakdown {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #dee2e6;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item.total {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 2px solid #0066cc;
    border-bottom: none;
    font-weight: bold;
}

.breakdown-label {
    flex: 0 0 auto;
    color: #495057;
    font-weight: 500;
}

.breakdown-value {
    flex: 0 0 auto;
    color: #212529;
    font-weight: bold;
    font-size: 1.1em;
}

.breakdown-detail {
    flex: 1;
    color: #6c757d;
    font-size: 0.9em;
    text-align: right;
}

.repeat-discount {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-left: 8px;
}

.print-subtotal {
    background: #f0f0f0;
}

@media (max-width: 600px) {
    /* モバイル版のダイアログコンテンツ調整 */
    .dialog-content {
        padding: 1rem;
        padding-bottom: 20px;
    }
    
    /* モバイル版のestimate-section調整 */
    .estimate-section {
        margin-bottom: 1.5rem;
        background: transparent;
        border-radius: 0;
        padding: 0;
        border: none;
        box-shadow: none;
    }
    
    .estimate-section:hover {
        box-shadow: none;
    }
    
    /* モバイル版の見出し調整 */
    .dialog-content h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .dialog-content h4 {
        font-size: 1rem;
        margin: 1rem 0 0.75rem;
    }
    
    /* モバイル版のテーブル調整 */
    .estimate-table {
        border-radius: 4px;
        font-size: 0.875rem;
    }
    
    /* 合計セクションの調整 */
    .total-section {
        background: #f8f9fa;
        padding: 1rem;
        margin-top: 1.5rem;
    }
    
    /* ダイアログボタンのモバイル最適化 */
    .dialog-buttons {
        flex-direction: column-reverse;
        gap: 0.75rem;
        margin: 1.5rem -1rem -1rem -1rem;
        padding: 1rem;
        background-color: #f8f9fa;
        border-top: 1px solid #e9ecef;
    }
    
    .dialog-buttons .btn-primary {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border: none;
    }
    
    .dialog-buttons .btn-secondary {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        background-color: #fff!important;
        color: #666!important;
        border: 1px solid #dee2e6!important;;
        font-weight: normal!important;;
    }
    
    .dialog-buttons .btn-secondary:hover {
        background-color: #f8f9fa;
        border-color: #adb5bd;
    }
    
    /* 「他のアイテムも選択」ボタンがある場合 */
    .dialog-buttons #add-more-items {
        order: 2;
        color: #495057;
        border: 1px solid #dee2e6;
        background: #ffb800!important;
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
    
    .dialog-buttons #confirm-selection-final {
        order: 3;
    }
    
    .dialog-buttons #cancel-selection-final {
        order: 1;
        font-size: 0.8125rem;
        color: #6c757d;
        padding: 0.625rem 1rem;
        margin-top: 1.5rem;
        position: relative;
    }
    
    /* キャンセルボタンの上に区切り線を追加 */
    .dialog-buttons #cancel-selection-final::before {
        content: '';
        position: absolute;
        top: -0.75rem;
        left: 20%;
        right: 20%;
        height: 1px;
        background-color: #dee2e6;
    }
    
    /* 注意文言のモバイル調整 */
    .note {
        font-size: 0.75rem;
        padding: 0.75rem;
        margin: 0.75rem 0;
        border-left-width: 2px;
    }
    
    /* 注意事項コンテナのモバイル調整 */
    .notes-container {
        margin: 1rem 0;
        gap: 0.75rem;
    }
    
    .note-item {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .note-icon {
        font-size: 1rem;
    }
    
    .note-content {
        font-size: 0.8125rem;
    }
    
    .note-content strong {
        font-size: 0.875rem;
        margin-bottom: 0.125rem;
    }
    
    /* 内訳表示のモバイル調整 */
    .cost-breakdown {
        background: #f8f9fa;
        border-radius: 4px;
        margin: 0.5rem 0;
    }
    
    .estimate-table:not(.simple),
  .estimate-table:not(.simple) thead,
  .estimate-table:not(.simple) tbody,
  .estimate-table:not(.simple) tfoot,
  .estimate-table:not(.simple) th,
  .estimate-table:not(.simple) td,
  .estimate-table:not(.simple) tr {
    display: block;
    width: 100%;
  }
  .estimate-table:not(.simple) thead {
    display: none;
  }
  .estimate-table:not(.simple) tr {
    margin-bottom: 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    padding: 1rem 0.5rem;
  }
  .estimate-table:not(.simple) td {
    position: relative;
    padding-left: 40%;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-right: 0.5rem;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 0.875rem;
    min-height: 36px;
    box-sizing: border-box;
  }
  .estimate-table:not(.simple) td:last-child {
    border-bottom: none;
  }
  .estimate-table:not(.simple) td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.75rem;
    top: 0;
    width: 40%;
    font-weight: bold;
    color: #111;
    font-size: 0.95rem;
    white-space: normal;
    padding-top: 0.75rem;
    line-height: 1.2;
  }
  .estimate-table:not(.simple) tfoot {
    display: block !important;
    width: 100% !important;
    background: #f8f9fa;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
  }
  
  .estimate-table:not(.simple) tfoot tr:not(.print-total-breakdown) {
    display: table-row !important;
    width: 100%;
  }
  .estimate-table:not(.simple) tfoot td {
    display: table-cell !important;
    width: auto;
    padding: 0.75rem 0.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-bottom: none;
    background: #f8f9fa;
    color: #333;
    position: static;
  }
  .estimate-table:not(.simple) tfoot td[colspan] {
    text-align: left;
  }

  /* 2列テーブル（袋詰め・合計金額など）は横並び維持 */
   .estimate-table.simple tr {
    display: table-row;
  }
  .estimate-table.simple th,
  .estimate-table.simple td {
    display: table-cell;
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    border-bottom: 1px solid #eee;
    background: #fff;
    color: #333;
    text-align: left;
    position: static;
  }
  .estimate-table.simple tr:last-child th,
  .estimate-table.simple tr:last-child td {
    border-bottom: none;
  }
  .estimate-table.simple th {
    width: 60%;
    font-weight: bold;
    color: #111;
    background: #f8f9fa;
  }
  .estimate-table.simple td {
    text-align: right;
    font-weight: bold;
  }
  
  /* 重要な項目は少し大きく */
  .estimate-table.simple .grand-total th,
  .estimate-table.simple .grand-total td {
    font-size: 0.8125rem;
  }
  
  .estimate-table.simple .tax-included th,
  .estimate-table.simple .tax-included td {
    font-size: 0.875rem;
    font-weight: bold;
  }
  
  .estimate-table.simple .tax-included td {
    color: #0066cc;
  }
  .estimate-table.simple {
    table-layout: fixed;
    width: 100%;
  }
  .estimate-table.simple th {
    width: 60%;
    min-width: 120px;
    max-width: 70%;
    word-break: break-all;
    white-space: normal;
  }
  .estimate-table.simple td {
    width: 40%;
    min-width: 60px;
    max-width: 40%;
    word-break: break-all;
    white-space: normal;
  }
  
  /* モバイル用の数量コントロールスタイル */
  .quantity-control-inline {
    justify-content: flex-end;
    padding: 0;
    background: transparent;
  }
  
  .item-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
  
  /* モバイル用プリント加工内訳 */
  .cost-breakdown {
    padding: 12px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .breakdown-cell {
    width: 100% !important;
    display: block !important;
  }
  
  .breakdown-item {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .breakdown-label {
    flex: 1 1 100%;
    font-size: 0.9rem;
    margin-bottom: 4px;
  }
  
  .breakdown-value {
    font-size: 1rem;
  }
  
  .breakdown-detail {
    flex: 1 1 auto;
    font-size: 0.8rem;
  }
  
  /* プリント加工明細のフッター行を見やすく */
  .estimate-table:not(.simple) tfoot tr.print-subtotal td {
    background: #f0f0f0 !important;
    font-weight: bold;
    border-bottom: 1px solid #dee2e6;
  }
  
  .estimate-table:not(.simple) tfoot tr.print-total-breakdown {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .estimate-table:not(.simple) tfoot tr.print-total-breakdown td {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    display: block !important;
    width: 100% !important;
    position: static !important;
    padding-left: 0 !important;
  }
  
  .estimate-table:not(.simple) tfoot tr.print-total-breakdown .breakdown-cell {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }
  
  .estimate-table:not(.simple) tfoot tr.print-total-breakdown .cost-breakdown {
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  
  /* 送料表示のモバイル対応 */
  .shipping-row td {
    white-space: normal !important;
    line-height: 1.4 !important;
    font-size: 0.8rem !important;
    padding: 0.75rem 0.5rem !important;
  }
  
  /* 送料の地域別表示を改行で見やすく */
  @media (max-width: 600px) {
    .shipping-row td br {
      display: block !important;
      content: "" !important;
      margin: 0.25rem 0 !important;
    }
  }
}