/* --- 前回の変数・基本設定はそのまま継続 --- */
:root {
    --primary-color: #1a1a1a;
    --accent-color: #3498db;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #777777;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* 既存の変数に加えて */
    --input-bg: #ffffff;
    --input-border: #e0e0e0;
    --input-focus: #3498db;
    --text-dark: #1a1a1a;
    --text-light: #777777;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-main); line-height: 1.6; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- Header --- */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { font-size: 1.5rem; letter-spacing: 2px; font-weight: 600; }
.logo-sub { font-weight: 300; color: var(--text-muted); }

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 400;
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav a:hover { color: var(--accent-color); }

.header-icons { display: flex; gap: 1rem; }
.icon-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; position: relative; }
.cart-count {
    position: absolute; top: -8px; right: -10px;
    background: var(--accent-color); color: white;
    font-size: 0.65rem; padding: 2px 5px; border-radius: 10px;
}

/* --- ハンバーガーボタンのスタイル --- */
.hamburger {
    display: none; /* デスクトップでは非表示 */
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 10px;
    transition: var(--transition);
    position: relative;
}

/* ハンバーガーが「X」になるアニメーション */
.hamburger.is-active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger.is-active span:nth-child(2) {
    opacity: 0;
}
.hamburger.is-active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* --- レスポンシブ (モバイル対応) --- */
/* --- レスポンシブ (モバイル対応) の修正版 --- */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: white;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        
        /* --- ここからが重要：高さの自動調整アニメーション --- */
        display: grid;
        grid-template-rows: 0fr; /* 最初は高さ0 */
        transition: grid-template-rows 0.3s ease-out;
        overflow: hidden;
    }

    .nav.is-active {
        grid-template-rows: 1fr; /* 開いた時は中身の高さに合わせる */
    }

    /* 中身のコンテンツが正しく計算されるように設定 */
    .nav-content {
        min-height: 0;
    }

    .nav ul {
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        gap: 1.5rem;
    }

    .nav a {
        font-size: 1.1rem;
        display: block;
        width: 100%;
        text-align: center;
    }
}


/* --- Checkout Layout --- */
.checkout-page {
    padding-top: 40px;
    padding-bottom: 80px;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px; /* 左が広く、右が固定幅 */
    gap: 40px;
    align-items: start;
}

/* --- Form Styles --- */
.section-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.section-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.checkout-form {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

input {
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: var(--input-bg);
}

input:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1); /* フォーカス時の柔らかな光 */
}

input::placeholder {
    color: #ccc;
}

/* --- Summary Card & Button --- */
.summary-card {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky; /* スクロールしてもついてくる */
    top: 100px;
}

.summary-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.free-shipping {
    color: #27ae60;
    font-weight: 600;
}

.summary-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* 決済ボタンのデザイン */
.btn-checkout {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.btn-subtext {
    font-size: 0.7rem;
    font-weight: 300;
    opacity: 0.8;
    margin-top: 4px;
}

.btn-checkout:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.payment-secure-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 15px;
}

/* --- Company Info Section --- */
.company-info-section {
    margin-top: 100px;
    padding: 60px 0;
    border-top: 1px solid #eee;
}

.company-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.company-description {
    color: var(--text-light);
    font-size: 0.9rem;
    max-width: 300px;
    margin-top: 15px;
}

.company-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.info-group h4 {
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-group ul {
    list-style: none;
}

.info-group ul li {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.info-group ul li a {
    text-decoration: none;
    color: var(--text-light);
    transition: var(--transition);
}

.info-group ul li a:hover {
    color: var(--accent-color);
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    .checkout-summary-section {
        order: -1; /* スマホでは合計金額を上に持ってくる */
    }
    .summary-card {
        position: static;
    }
}

@media (max-width: 600px) {
    .company-grid, .company-details, .form-row {
        grid-template-columns: 1fr;
    }
}



/* --- Cart Page Layout --- */
.cart-page {
    padding-top: 40px;
    padding-bottom: 80px;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 40px;
    text-align: center;
}

.cart-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    align-items: start;
}

/* --- Cart Items --- */
.cart-items-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    /* 画像(70px) + 情報(1fr) + 価格(auto) の3カラム構成 */
    display: grid;
    grid-template-columns: 70px 1fr auto; 
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 画像を小さめに設定 */
.cart-item-img img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* これがないと長いテキストでレイアウトが壊れます */
}

.item-main {
    min-width: 0; /* 子要素のテキスト省略を有効にするために必要 */
}

.item-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    color: var(--text-main);
    
    /* テキスト省略の魔法の3行 */
    display: -webkit-box;
    line-clamp: 2; /* ここを 3 にすれば3行まで表示されます */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-category {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 数量セレクター (Custom Quantity Selector) */
.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    width: fit-content;
    overflow: hidden;
}

.qty-btn {
    background: none;
    border: none;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-main);
    transition: background 0.2s;
}

.qty-btn:hover {
    background: #f0f0f0;
}

.qty-input {
    width: 40px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--input-border);
    border-right: 1px solid var(--input-border);
    font-family: inherit;
    font-weight: 600;
    appearance: textfield; /* スピンボタンを消す */
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 価格と削除ボタン */
.cart-item-price {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 100px; /* 価格エリアの最小幅を確保 */
}

.item-price-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.item-price {
    font-weight: 600;
    font-size: 1.1rem;
}

.item-price-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.remove-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

.remove-btn:hover {
    color: #c0392b;
}

/* --- Cart Summary --- */
.cart-summary-section {
    position: sticky;
    top: 100px;
}

.btn-checkout-large {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
    margin-bottom: 20px;
}

.btn-checkout-large:hover {
    background: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.continue-shopping {
    display: block;
    text-align: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition);
}

.continue-shopping:hover {
    color: var(--primary-color);
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .cart-grid {
        grid-template-columns: 1fr;
    }
    .cart-summary-section {
        order: -1; /* スマホでは合計金額を上に */
        position: static;
    }
    .cart-item {
        grid-template-columns: 80px 1fr auto;
        gap: 15px;
    }
    .cart-item-img img {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 600px) {
    .cart-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .cart-item-img {
        display: flex;
        justify-content: center;
    }
    .cart-item-price {
        align-items: center;
        border-top: 1px solid #eee;
        padding-top: 15px;
    }
    .quantity-selector {
        margin: 0 auto;
    }
}

/* --- Info Page Styles --- */
.info-page {
    background-color: #fcfcfc;
}

.info-hero {
    text-align: center;
    padding: 60px 0 20px;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* タブメニューのデザイン */
.tab-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    border-bottom: 1px solid #eee;
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.is-active {
    color: var(--primary-color);
    font-weight: 600;
}

/* タブの下線アニメーション */
.tab-btn.is-active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

/* コンテンツエリア */
.info-content-wrapper {
    max-width: 800px;
    margin: 0 auto 80px;
}

.content-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.content-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.content-text {
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 20px;
}

/* タブコンテンツの表示・非表示 */
.tab-content {
    display: none;
}

.tab-content.is-active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

/* 特定商取引法のリストデザイン (Definition List) */
.legal-list {
    display: flex;
    flex-direction: column;
}

.legal-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.legal-item dt {
    width: 200px; /* ラベルの幅を固定 */
    font-weight: 600;
    color: var(--text-main);
    flex-shrink: 0; /* 幅を維持 */
}

.legal-item dd {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
    flex-grow: 1;
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
    .tab-container {
        gap: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    .tab-btn {
        padding: 12px 5px;
        font-size: 0.85rem;
    }

    .legal-item {
        flex-direction: column; /* スマホでは縦並びに */
        gap: 5px;
    }

    .legal-item dt {
        width: auto;
        font-size: 0.9rem;
    }

    .content-card {
        padding: 25px 20px;
    }
}


/* --- 確認画面 (Confirmation) のスタイル --- */

.review-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.review-header h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.edit-link {
    font-size: 0.8rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.review-content {
    padding: 20px;
}

.review-content p {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem !important;
}

/* 確認画面用の商品リスト */
.review-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.review-item img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.item-info {
    flex-grow: 1;
}

.item-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.item-qty {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-price {
    font-weight: 600;
}

/* 確定ボタン (Place Order) */
.btn-confirm {
    width: 100%;
    background: #27ae60; /* 確定は「成功・進む」を意味する緑色 */
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.btn-confirm:hover {
    background: #219150;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3);
}

/* --- 完了画面 (Success) のスタイル --- */

.success-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.success-card {
    background: white;
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-hover);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

/* チェックマークのアニメーション */
.success-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.success-icon {
    width: 100%;
    height: 100%;
}

.success-circle {
    stroke: #27ae60;
    stroke-width: 2;
    stroke-dasharray: 170;
    stroke-dashoffset: 170;
    animation: stroke 0.6s ease-in-out forwards;
}

.success-check {
    stroke: #27ae60;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s ease-in-out 0.3s forwards;
}

@keyframes stroke {
    to { stroke-dashoffset: 0; }
}

.success-title {
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.success-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.order-info-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.order-id-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.order-id-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-secondary {
    display: block;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline {
    display: block;
    background: transparent;
    color: var(--primary-color);
    text-decoration: none;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid var(--primary-color);
    transition: var(--transition);
}

.btn-outline:hover {
    background: rgba(26, 26, 26, 0.05);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    .checkout-summary-section {
        order: -1;
    }
    .success-card {
        padding: 40px 20px;
    }
}


/* --- 以下、前回と同じ（Hero, Grid, Card, Footer） --- */
.hero { padding: 60px 0; text-align: center; }
.hero h2 { font-size: 2.5rem; margin-bottom: 10px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px; padding-bottom: 60px; }
.product-card { background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: var(--transition); }
.product-card:hover { transform: translateY(-10px); box-shadow: var(--shadow-hover); }
.product-image { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.product-card:hover .product-image img { transform: scale(1.05); }
.badge { position: absolute; top: 12px; left: 12px; background: var(--primary-color); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; z-index: 1; }
.badge.sale { background: #e74c3c; }
.product-info { padding: 20px; }
.product-title { font-size: 1.1rem; margin-bottom: 5px; }
.product-category { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; }

.product-price { font-weight: 600; font-size: 1.1rem; }
.add-to-cart { background: var(--primary-color); color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.add-to-cart:hover { background: var(--accent-color); }
.footer { text-align: center; padding: 40px 0; color: var(--text-muted); font-size: 0.8rem; border-top: 1px solid #eee; }

/* --- Product Footer の修正 --- */
.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center; /* 価格が2行になってもボタンが中央にくるように */
    gap: 10px;
}

/* 価格を包むコンテナ */
.price-container {
    display: flex;
    flex-direction: column; /* 縦に並べる */
    align-items: flex-start; /* 左寄せ（中央寄せにしたい場合は center） */
}

/* 税込価格（メイン） */
.product-price-incl {
    font-weight: 600;
    font-size: 1.15rem; /* 少し大きく */
    color: var(--text-main);
    line-height: 1.2;
}

/* 税別価格（サブ） */
.product-price-excl {
    font-size: 0.65rem; /* 小さく */
    color: var(--text-muted); /* 色を薄くして目立たせない */
    line-height: 1.2;
}

.product-price-excl small {
    font-size: 0.65rem;
    margin-left: 2px;
}

/* --- ボタンの微調整 --- */
.add-to-cart {
    /* 以前のコードのまま、必要に応じて高さを調整 */
    padding: 8px 16px;
}
