/*
 Theme Name:   Storefront Child v3.9.3
 Description:  manaable Marketplace用の子テーマ
 Author:       B-CREATE
 Template:     storefront
 Version:      3.9.3 (manaable Green Brand UI)
*/

/* =========================================
   0. 変数の定義 (一括管理)
   ========================================= */
:root {
    --manaable-green: #2ea3f2;
    /* メインカラー (青) */
    --manaable-green-dark: #0073aa;
    /* 濃い青 (ホバー時など) */
    --manaable-light-bg: #f0f7fa;
    /* 薄い背景 (青系) */
    --manaable-border: #2ea3f2;
    /* ボーダー色 */
}

/* =========================================
   1. レイアウト強制 (Grid System)
   ========================================= */

@media (min-width: 992px) {
    .woocommerce-page .site-content>.col-full {
        display: grid !important;
        grid-template-columns: 1fr 260px !important;
        gap: 40px !important;
        max-width: 1200px;
        margin: 0 auto;
        padding-top: 0;
    }

    /* clearfix の疑似要素をグリッドアイテムから除外 */
    .woocommerce-page .site-content>.col-full::before,
    .woocommerce-page .site-content>.col-full::after {
        display: none !important;
    }

    /* サイドバーなしページ (cart/checkout/account) は #primary を全幅に */
    .woocommerce-cart .site-content>.col-full #primary,
    .woocommerce-checkout .site-content>.col-full #primary,
    .woocommerce-account .site-content>.col-full #primary {
        grid-column: 1 / -1 !important;
    }

    /* 左：メインコンテンツ */
    .woocommerce-page #primary {
        grid-column: 1 / 2;
        width: 100% !important;
        margin: 0 !important;
    }

    /* 右：サイドバー */
    .woocommerce-page #secondary {
        grid-column: 2 / 3;
        width: 100% !important;
        margin: 0 !important;
        border-left: 1px solid #eee;
        padding-left: 20px;
    }

    /* パンくずリストを全幅にする */
    .woocommerce-breadcrumb,
    .breadcrumb {
        grid-column: 1 / -1 !important;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 万が一、元の位置（グリッド内）にパンくずが出ている場合は消す */
    .site-content>.col-full>.woocommerce-breadcrumb {
        display: none !important;
    }
}

/* パンくずリストのmargin-bottomを半分に縮小 */
.storefront-breadcrumb {
    margin-bottom: 0.809em !important;
}

/* =========================================
   2. 商品サムネイル (16:9・全幅表示)
   ========================================= */

/* 一覧ページのサムネイル */
.woocommerce ul.products li.product a img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* 一覧ページ テキストエリア (タイトル・提供・カテゴリー) */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 1rem;
    padding: 10px 15px 5px;
    margin: 0;
    line-height: 1.4;
    flex: 1; /* タイトルを伸縮させてメタ・価格を下部に押しやる */
}

.woocommerce ul.products li.product .manaable-loop-meta {
    font-size: 0.9em;
    color: #666;
    padding: 0 15px 8px;
    margin: 0;
}

.woocommerce ul.products li.product .loop-provider {
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

/* =========================================
   3. 商品詳細ページ (画像なし・シンプル化)
   ========================================= */

/* 画像エリアを完全に消す */
.woocommerce div.product div.images {
    display: none !important;
}

/* 右側の詳細エリアを横幅いっぱいに広げる */
.woocommerce div.product div.summary {
    width: 100% !important;
    float: none !important;
    padding: 0 20px;
}

/* 商品タイトル */
.woocommerce div.product .product_title {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

/* 価格表示 */
.woocommerce div.product p.price {
    font-size: 20px;
    color: var(--manaable-green) !important;
    font-weight: bold;
    border-bottom: 1px solid var(--manaable-green);
    display: inline-block;
    padding-bottom: 5px;
}

/* =========================================
   4. ボタン・UIパーツ (manaable Green)
   ========================================= */

/* すべてのメインボタン */
button,
input[type="submit"],
.button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce button.button.alt,
.woocommerce #respond input#submit {
    background-color: var(--manaable-green) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px;
    padding: 10px 20px;
    font-weight: bold;
}

/* ホバー時（マウスを置いた時） */
button:hover,
.button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce button.button.alt:hover,
.woocommerce #respond input#submit:hover {
    background-color: var(--manaable-green-dark) !important;
    color: #fff !important;
}

/* 一覧ページの「ボタン」位置調整 */
ul.products li.product .button {
    margin: 0 15px 15px 15px !important;
    text-align: center;
    width: calc(100% - 30px);
    display: block;
}

/* ハンバーガーメニューボタン: 汎用buttonスタイルの上書き復元 */
button.menu-toggle {
    background-color: transparent !important;
    color: inherit !important;
    border: 2px solid rgba(0, 0, 0, 0) !important;
    border-radius: 2px !important;
    padding: .6180469716em .875em .6180469716em 2.617924em !important;
    box-shadow: none !important;
    float: right;
}

button.menu-toggle:hover {
    background-color: transparent !important;
    background-image: none !important;
}

/* =========================================
   5. モバイルナビゲーション
   ========================================= */

/* モバイル時: .primary-navigation をデフォルト非表示 → トグルで表示 */
@media (max-width: 767px) {
    .main-navigation .primary-navigation {
        display: none;
    }

    .main-navigation.toggled .primary-navigation {
        display: block;
    }

    /* メニュー項目を縦並びに */
    .main-navigation .primary-navigation ul,
    .main-navigation .primary-navigation ul li {
        float: none !important;
        width: 100% !important;
    }
}

/* =========================================
   6. カートページ固有
   ========================================= */

/* 個数入力・調整ボタンを非表示（クラシックカート） */
.woocommerce-cart .woocommerce-cart-form td.product-quantity .quantity {
    display: none !important;
}

/* 個数入力・調整ボタンを非表示（ブロックカート：削除ボタンは残す） */
.wc-block-components-quantity-selector {
    display: none !important;
}

/* 「項目を削除」ボタン化（ブロックカート：金額セル内に縦並びで配置） */
.wc-block-cart-item__total {
    vertical-align: top !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
}

.wc-block-cart-item__remove-link {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: 8px !important;
    width: 32px !important;
    height: 32px !important;
    border: 1px solid #e74c3c !important;
    background-color: #fff !important;
    color: #e74c3c !important;
    padding: 0 !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    cursor: pointer !important;
    line-height: 1 !important;
}

.wc-block-cart-item__remove-link svg {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
    display: block !important;
    margin: 0 !important;
}

.wc-block-cart-item__remove-link:hover {
    background-color: #e74c3c !important;
    color: #fff !important;
}

/* 「×」削除リンクをボタン化（クラシックカート） */
.woocommerce-cart .woocommerce-cart-form td.product-remove a.remove {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #e74c3c !important;
    background-color: #fff !important;
    color: #e74c3c !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 4px !important;
    font-size: 1.2em !important;
    font-weight: bold !important;
    line-height: 1 !important;
    text-decoration: none !important;
}

.woocommerce-cart .woocommerce-cart-form td.product-remove a.remove:hover {
    background-color: #e74c3c !important;
    color: #fff !important;
}

/* =========================================
   7. 全体調整・罫線
   ========================================= */

body {
    color: #333;
    font-family: "Helvetica Neue", Arial, sans-serif;
}

/* リンク色 */
a {
    color: var(--manaable-green);
}

a:hover {
    color: var(--manaable-green-dark);
}

/* 商品カードの枠線・高さ揃え（一覧画面） */
.woocommerce ul.products {
    display: flex !important;
    flex-wrap: wrap;
    align-items: stretch;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none;
}

ul.products li.product {
    border: 1px solid #eee;
    padding-bottom: 10px;
    transition: border-color 0.3s;
    display: flex;
    flex-direction: column;
}

/* 商品リンク（画像＋タイトル＋メタ＋価格）を縦に伸ばしてボタンを底部へ */
.woocommerce ul.products li.product > a:not(.button) {
    flex: 1;
    display: flex;
    flex-direction: column;
}

ul.products li.product:hover {
    border-color: var(--manaable-green);
}

/* --- アコーディオン (Details/Summary) --- */
.manaable-accordion-list {
    margin-top: 15px;
    border-top: 1px dashed var(--manaable-green);
    padding-top: 15px;
    width: 100%;
}

details.lesson-accordion {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
    width: 100%;
}

details.lesson-accordion summary {
    padding: 12px 15px;
    background: var(--manaable-light-bg);
    color: var(--manaable-green);
    font-weight: bold;
    cursor: pointer;
    list-style: none;
    /* デフォルトの矢印を消す */
    position: relative;
    border-bottom: 1px solid #eee;
}

/* 矢印の代わり */
details.lesson-accordion summary::after {
    content: "▼";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
}

details.lesson-accordion[open] summary::after {
    content: "▲";
}

.accordion-content {
    padding: 15px;
    font-size: 0.95em;
    line-height: 1.6;
    background: #fff;
}

/* =========================================
   8. カートページ：研修ごとの開始日・終了日フィールド
   ========================================= */

.manaable-date-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-bottom: 10px;
}

@media (max-width: 767px) {
    .manaable-date-fields {
        grid-template-columns: 1fr !important;
    }
}

.manaable-date-label {
    display: flex;
    flex-direction: column;
    font-size: 0.8em;
    color: #666;
    gap: 4px;
    font-weight: normal;
}

.manaable-date-label input[type="datetime-local"],
.manaable-date-label select,
.manaable-date-label input[type="number"],
.manaable-date-label input[type="text"] {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.9em;
    color: #333;
    background: #fff;
    cursor: pointer;
}

.manaable-date-label input[type="datetime-local"]:focus,
.manaable-date-label select:focus,
.manaable-date-label input[type="number"]:focus,
.manaable-date-label input[type="text"]:focus {
    border-color: var(--manaable-green);
    outline: none;
    box-shadow: 0 0 0 2px rgba(46, 163, 242, 0.2);
}

.manaable-req-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.manaable-req-row input[type="number"] {
    width: 70px;
}

.manaable-req-unit {
    font-size: 0.9em;
    color: #555;
    white-space: nowrap;
}

/* =========================================
   9. カートページ：資料カスタム項目名フィールド
   ========================================= */

.manaable-key-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-top: 8px;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

@media (max-width: 767px) {
    .manaable-key-fields {
        grid-template-columns: 1fr !important;
    }
}

.wc-block-cart-item__quantity {
    display: block !important;
}

.manaable-key-section-title {
    grid-column: 1 / -1;
    font-size: 0.8em;
    font-weight: bold;
    color: #555;
    margin-bottom: 2px;
}

.manaable-key-section-desc {
    grid-column: 1 / -1;
    font-size: 0.8em;
    color: #666;
    margin-bottom: 6px;
}

.manaable-date-label input[type="text"].manaable-key-input {
    width: 100%;
    box-sizing: border-box;
}

.manaable-date-label input[type="text"].manaable-key-input.manaable-key-empty {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

.manaable-key-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9em;
    color: #856404;
    margin-bottom: 8px;
}

/* カートアイテム: タイトル下の金額を非表示 */
.wc-block-cart-item__product .wc-block-components-product-price,
.wc-block-cart-item__prices {
    display: none !important;
}

/* カートアイテム: 固定ヒントテキスト */
.manaable-cart-hint {
    font-size: 0.85em;
    color: #555;
    margin: 20px 0 8px;
}

/* 取り込み履歴・マイアカウント: manaable 再同期ボタン */
.manaable-resync { background: #0073aa !important; border-color: #0073aa !important; color: #fff !important; }
.manaable-resync:hover { background: #005177 !important; border-color: #005177 !important; }
.manaable-resync-success { color: #155724; }
.manaable-resync-error   { color: #721c24; }

/* 更新通知バッジ（インライン） */
.manaable-update-notice {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

/* 更新通知バッジ（ブロック） */
.manaable-update-notice-block {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* 取り込み履歴一覧: 操作列のボタンを横並びにする */
td[data-title="操作"] {
    white-space: nowrap;
}
td[data-title="操作"] .button,
td[data-title="操作"] a.button {
    display: inline-block !important;
    width: auto !important;
    margin: 0 4px 0 0 !important;
}
td[data-title="操作"] .manaable-resync-msg {
    display: block;
    white-space: normal;
    margin-top: 6px;
}

/* 一時措置: カートページのカスタム項目入力欄を非表示 */
.manaable-key-fields { display: none !important; }

/* カスタム項目入力欄の代替案内テキスト */
.manaable-key-fields-note {
    font-size: 0.85em;
    color: #555;
    margin: 8px 0 4px;
    line-height: 1.5;
}

/* カスタム項目確認チェックボックス */
.manaable-custom-key-confirm {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: #333;
    margin: 4px 0 12px;
    cursor: pointer;
}
.manaable-custom-key-confirm input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ReactのチェックアウトボタンをCSSで完全非表示（独自ボタンに差し替えるため） */
.wc-block-cart__submit-container a:not(#manaable-import-btn),
.wc-block-cart__submit-container button:not(#manaable-import-btn) {
    display: none !important;
}
/* 請求一覧 除外申込ID サブ行 */
.billing-exclusion-detail td {
    font-size: 0.82em;
    color: #72777c;
    padding-top: 2px !important;
    padding-bottom: 8px !important;
    border-top: none !important;
}

/* 取り込み履歴 テーブル: padding 3割減 + 罫線 + 列幅固定 */
.my_account_orders {
    border-collapse: collapse !important;
    border: 1px solid #aaa !important;
    table-layout: fixed !important;
    width: 100% !important;
}
.my_account_orders th:nth-child(1) { width: auto; }
.my_account_orders th:nth-child(2) { width: 7em; }
.my_account_orders th:nth-child(3) { width: 6em; }
.my_account_orders th:nth-child(4) { width: 6.5em; }
.my_account_orders th:nth-child(5) { width: 15em; }
.my_account_orders th,
.my_account_orders td {
    padding: 6px 8px !important;
    border-right: 1px solid #e0e0e0 !important;
}
.my_account_orders th:last-child,
.my_account_orders td:last-child {
    border-right: none !important;
}
.my_account_orders thead th {
    border-bottom: 2px solid #999 !important;
}
.my_account_orders tbody td {
    border-top: 1px solid #ccc !important;
}
.my_account_orders tbody tr:first-child td {
    border-top: none !important;
}

/* 取り込み履歴 操作列: 主要ボタン flex between */
.manaable-op-main-btns {
    display: flex;
    justify-content: space-between;
}

/* 取り込み履歴 操作列: アコーディオンボタンを縦並び・控えめスタイル */
.manaable-accordion-toggle {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: normal;
    color: #888;
    background: none;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1.6;
}
.manaable-accordion-toggle:hover {
    color: #555;
    border-color: #aaa;
    background: #f5f5f5;
}

/* 取り込み履歴 アコーディオン */
.manaable-accordion-inner {
    padding: 10px 12px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
}
.manaable-accordion-inner input[type="text"],
.manaable-accordion-inner input[type="datetime-local"] {
    width: 100%;
    max-width: 220px;
    margin-bottom: 6px;
    font-size: 12px;
}
/* カスタム項目名確認テーブル */
.manaable-cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.6;
}
.manaable-cf-table th,
.manaable-cf-table td {
    padding: 3px 6px;
    border: 1px solid #ccc;
}
.manaable-cf-table th {
    text-align: left;
    white-space: nowrap;
}

.manaable-acc-success { color: #2e7d32; }
.manaable-acc-error   { color: #c62828; }
.manaable-accordion-msg {
    display: block;
    margin-top: 4px;
    width: 100%;
    word-break: break-word;
    white-space: normal;
}
