/* リセットと基本設定 */
body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f8f8;
    color: #333;
}

/* ---------------------------------- */
/* 🛍️ ヘッダー (デスクトップ・タブレット用) */
/* ---------------------------------- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: white;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 10;
    
    flex-wrap: wrap; /* 折り返しを許可 */
    padding-bottom: 0; 
}

/* HTML構造変更に伴い、デスクトップでのナビ配置を調整 */
.header-nav {
    order: 0; 
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap; 
}

.logo {
    /* デスクトップで左端に固定するロジックを再構築 */
    position: absolute; /* absoluteにすることで、中央配置から除外 */
    left: 20px; 
    margin-right: 0; 
    /* font-size, font-weight, color は画像表示のため削除 */
}

/* ★追加: ロゴ画像自体のスタイルを定義★ */
.logo img {
    height: 30px; /* ロゴの高さを固定 (必要に応じて調整) */
    width: auto;
    vertical-align: middle;
}

/* ナビゲーションコンテナ（nav）はそのまま中央に配置されます */
.header-nav nav {
    display: flex;
    justify-content: center;
}

.header-nav nav a {
    text-decoration: none;
    color: #777;
    margin: 0 15px; 
    padding-bottom: 5px;
    transition: color 0.3s;
}

.header-nav nav a.active {
    color: #000;
    border-bottom: 2px solid #000;
}

.header-icons {
    order: 2; /* デスクトップで右端に配置 */
    margin-left: auto; 
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icons a {
    font-size: 1.3em;
    color: #333;
    text-decoration: none;
}


/* ---------------------------------- */
/* 📸 自動スクロールバナー ... (中略) */
/* ---------------------------------- */
.hero-slider-container {
    width: 100%;
    overflow: hidden; 
    position: relative;
    height: 850px; 
}

.slider-track {
    display: flex;
    width: 250%; 
    height: 100%;
    animation: autoScroll 30s linear infinite;
}

.slide-item {
    min-width: 50%;
    position: relative;
    overflow: hidden;
}

.slide-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slide-text {
    position: absolute;
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
}

@keyframes autoScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-150%); }
}

/* ---------------------------------- */
/* 👕 商品一覧 ... (中略) */
/* ---------------------------------- */
.product-list-page {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.section-title {
    text-align: center;
    margin-bottom: 40px; 
    font-size: 2em;
    font-weight: lighter;
    text-transform: uppercase;
    margin-top: 0; 
}

main .section-title:nth-of-type(n + 2) {
    margin-top: 80px; 
}

.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.product-card {
    width: calc(33.333% - 14px); 
    min-width: 280px; 
    background-color: white;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.product-image-area {
    position: relative;
    width: 100%; 
    padding-bottom: 120%;
    overflow: hidden;
}

.product-image-area img {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; 
    object-fit: cover; 
    display: block;
}

.color-options {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 8px;
}

.color-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid #ddd;
    box-shadow: 0 0 0 2px white; 
}

.color-dot.active {
    box-shadow: 0 0 0 2px #000;
}

.color-dot.black { background-color: black; }
.color-dot.white { background-color: white; }
.color-dot.gray { background-color: #a9a9a9; }
.color-dot.purple { background-color: #afa2b5; }
.color-dot.pastelblue { background-color: #889aaf; }
.color-dot.beige { background-color: #d3c4b2; }
.color-dot.plus {
    width: auto;
    height: auto;
    background: none;
    border: none;
    box-shadow: none;
    font-size: 1.1em;
    line-height: 1;
    color: #777;
}

.product-info {
    padding: 10px 15px 20px;
}

.product-info h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.product-info .description {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.product-info .price {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.product-info .size {
    font-size: 0.8em;
    color: #999;
}

/* ---------------------------------- */
/* 👕 商品詳細ページ専用のスタイル ... (中略) */
/* ---------------------------------- */
.product-detail-page {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.detail-container {
    display: flex;
    gap: 30px;
}

.detail-image-gallery {
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.thumbnail-grid img {
    width: 100%;
    cursor: pointer;
    border: 1px solid #eee;
}

.detail-info-area {
    width: 50%;
    padding: 10px 0;
}

#product-name {
    font-size: 2.5em;
    margin-top: 0;
    margin-bottom: 5px;
}

.product-price-display {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 20px;
}

.option-section {
    margin-bottom: 20px;
}

.detail-info-area .color-selection .color-options {
    position: static; 
    bottom: auto;
    left: auto;
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.option-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.size-btn {
    display: inline-block;
    padding: 10px 15px;
    margin-right: 10px;
    border: 1px solid #ccc;
    cursor: pointer;
    background-color: white;
    transition: background-color 0.1s, border-color 0.1s;
}

.size-btn:hover {
    border-color: black;
}

.size-btn.active {
    background-color: black;
    color: white;
    border-color: black;
}

.color-options .color-dot.active {
    box-shadow: 0 0 0 2px #000;
}

.buy-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.total-price-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #cc0000;
}

.add-to-cart {
    background-color: black;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.add-to-cart:hover {
    background-color: #333;
}

.product-description-box {
    margin-top: 30px;
    padding: 10px 0;
    font-size: 0.9em;
    color: #555;
}

.description-title {
    font-weight: bold;
    color: #333;
    margin-top: 15px;
}

.spec-list {
    list-style-type: disc;
    padding-left: 20px;
}

.sub-section-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 40px;
    margin-bottom: 20px;
}

/* ---------------------------------- */
/* 📱 メディアクエリ (タブレット・スマホ共通) */
/* ---------------------------------- */
@media (max-width: 900px) {
    /* 商品一覧: 2列表示 */
    .product-card {
        width: calc(50% - 15px);
        min-width: unset; 
    }
}


/* ---------------------------------- */
/* 📱 スマホ専用 (max-width: 600px) */
/* ヘッダー2段、商品一覧2列、商品詳細レイアウト変更 */
/* ---------------------------------- */
@media (max-width: 600px) {
    
    /* --- ヘッダーの修正 (2段構成) --- */
    .main-header {
        flex-direction: row; 
        flex-wrap: wrap; 
        padding: 10px 20px 0; 
        border-bottom: none; 
        background-color: white; 
    }
    
    /* 1. ナビコンテナ全体 (.header-nav) を上段左側と2段目として制御 */
    .header-nav {
        order: 0; 
        width: auto; /* ★修正★: 幅はコンテンツに合わせる */
        flex: 1 1 auto; 
        
        display: flex; 
        align-items: center; 
        
        /* ロゴとナビの分離 */
        flex-wrap: wrap; 
        justify-content: flex-start; 
        
        /* 区切り線のリセット */
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    
    .logo {
        /* ロゴは header-nav の中で上段左に固定 */
        position: static; 
        flex-shrink: 0; 
        order: 0; 
        /* margin-right: auto; を削除し、アイコン側にマージンを持たせる */
        margin-right: 20px; 
    }

    .header-nav nav {
        /* ナビゲーションをheader-nav内で下に折り返す */
        order: 2; 
        width: 100%; /* header-navの全幅を使用 */
        
        /* 2段目のための区切り線とマージン */
        margin-top: 10px; 
        padding-top: 10px;
        border-top: 1px solid #eee; 
        border-bottom: 1px solid #eee; /* 2段目の下に線を追加 */
        
        /* 横スクロール対応 (維持) */
        display: flex;
        justify-content: flex-start;
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch;
        white-space: nowrap; 
        padding-bottom: 5px; 
    }
    
    .header-icons {
        /* 2. アイコンコンテナ (.header-icons) を上段右端に固定 */
        order: 1; /* 2番目に配置 (header-navの隣、上段) */
        flex-shrink: 0;
        margin-left: auto; /* ★修正★: ロゴがマージンを持たないため、アイコンを右端に配置 */
        width: auto; 
        display: flex; 
    }
    
    /* Navリンクの調整 (そのまま維持) */
    .header-nav nav a {
        flex-shrink: 0;
        margin: 0 10px;
        padding-bottom: 5px;
    }
    .header-nav nav a:first-of-type {
        margin-left: 0;
    }
    .header-nav nav a.active {
        border-bottom: 2px solid #000;
    }

    /* --- 商品一覧の修正 (2列表示) --- */
    .product-list-page {
        padding: 0 10px; 
    }
    .product-grid {
        gap: 10px; 
    }
    .product-card {
        width: calc(50% - 5px); 
        min-width: unset; 
    }
    .product-image-area {
        padding-bottom: 120%; 
    }
    
    /* --- 商品詳細ページの修正 (縦積み) --- */
    .product-detail-page {
        padding: 0 10px; 
    }
    .detail-container {
        flex-direction: column;
        gap: 0;
    }
    .detail-image-gallery {
        width: 100%;
        padding-bottom: 20px; 
    }
    .main-image-wrapper {
        max-height: 400px;
        overflow: hidden;
    }
    .main-image-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .detail-info-area {
        width: 100%;
        padding: 20px 0; 
    }
    .buy-section {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .add-to-cart {
        width: 100%;
        padding: 15px 20px;
        font-size: 1.1em;
    }
    
    /* 2段目のナビゲーションがヘッダー下端からはみ出さないよう調整 */
    .product-list-page, .product-detail-page {
        padding-top: 10px; /* ナビの下に少し空間を開ける */
    }
}

/* ---------------------------------- */
/* 🛒 カートページ専用のスタイル */
/* ---------------------------------- */
.cart-page-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}
.cart-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    gap: 20px;
}
.cart-item-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
}
.cart-item-info {
    flex-grow: 1;
}
.cart-item-info p {
    margin: 3px 0;
    font-size: 0.9em;
    color: #555;
}
.cart-item-info .item-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}
.cart-item-price {
    font-weight: bold;
    font-size: 1.1em;
    min-width: 100px;
    text-align: right;
}
.remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
}
.remove-btn:hover {
    color: #cc0000;
}
.cart-summary {
    margin-top: 30px;
    text-align: right;
    border-top: 2px solid #333;
    padding-top: 20px;
}
.cart-summary p {
    font-size: 1.3em;
    font-weight: bold;
    margin: 5px 0;
}
/* カートが空の場合のメッセージ */
.empty-cart-message {
    text-align: center;
    padding: 50px 0;
    color: #777;
}

/* PayPalボタンのコンテナ */
#paypal-button-container {
    margin-top: 20px;
    text-align: center;
}


/* ---------------------------------- */
/* 🔴 カートバッジ（数字）のスタイル */
/* ---------------------------------- */
.header-icons a {
    position: relative; /* バッジの位置の基準にするため追加 */
    display: inline-block;
    text-decoration: none;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background-color: #cc0000;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75em;
    font-weight: bold;
    display: none; /* 初期状態は非表示（JSで個数がある時だけ表示させる） */
}


/* ---------------------------------- */
/* 🍞 トースト通知 (アラートの代わり) */
/* ---------------------------------- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.95em;
    opacity: 0;
    transform: translateY(20px);
    /* 表示して3秒後に消えるアニメーション */
    animation: toastIn 0.3s forwards, toastOut 0.3s forwards 2.7s; 
}

@keyframes toastIn {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(-20px); }
}

/* ---------------------------------- */
/* 🛒 空カートの戻るボタン */
/* ---------------------------------- */
.back-to-shop-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 30px;
    background-color: black;
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.back-to-shop-btn:hover {
    background-color: #333;
}


/* ---------------------------------- */
/* ⏳ カミングスーン表示用のスタイル */
/* ---------------------------------- */
.coming-soon-message {
    width: 100%;
    text-align: center;
    padding: 100px 20px;
    color: #777;
}

.coming-soon-message h2 {
    font-size: 3.5em;
    font-weight: lighter;
    letter-spacing: 0.1em;
    margin-bottom: 15px;
    color: #ddd; /* 薄いグレーでおしゃれに */
}

.coming-soon-message p {
    font-size: 1.1em;
    line-height: 1.8;
}