/* =========================================
   Art Frame Visualizer - Front CSS
   ========================================= */

#afv-app {
    max-width: 1200px;
    margin: 0 auto;
    font-family: sans-serif;
    color: #333;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.afv-container-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
    width: 100%;
}

.afv-col-left {
    flex: 1 1 55%;
    min-width: 300px;
}
.afv-col-right {
    flex: 1 1 35%;
    min-width: 300px;
}

@media (max-width: 768px) {
    #afv-app {
        overflow-x: auto;
        padding: 0;
    }
    .afv-container-flex {
        flex-direction: column;
        gap: 20px;
        min-width: 360px;
    }
    .afv-col-left,
    .afv-col-right {
        width: 100%;
        flex: 1 1 100%;
        min-width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }
}

.afv-section {
    margin-bottom: 30px;
}
h3 {
    font-size: 16px;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 15px;
    color: #333;
}

.afv-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.afv-item {
    flex: 0 0 120px;
    cursor: pointer;
    border: 2px solid #ddd;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    transition: 0.2s;
    background: #fff;
    box-sizing: border-box;
    position: relative;
}
.afv-item:hover {
    background: #f9f9f9;
}
.afv-item.active {
    border-color: #0073aa;
    background: #f0f6fc;
}
.afv-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    display: block;
    margin-bottom: 5px;
}
.afv-item span {
    font-size: 12px;
    display: block;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* バリエーションリスト用スタイル */
#afv-art-variations {
    background-color: #fafafa;
    border-radius: 4px;
    padding: 10px;
    border-top: 1px dashed #ddd;
}
.afv-var-item {
    flex: 0 0 80px; /* メインより小さく */
    padding: 4px;
    height: auto;
}
.afv-var-item img {
    height: 60px;
}
.afv-var-item.active {
    border-color: #333;
    background-color: #fff;
}

/* 拡大ボタン等 */
.afv-select-art {
    position: relative;
}
/* --- 作品上の操作ボタン (下部配置・サイズ調整版) --- */

/* 1. ボタンの共通スタイル */
.afv-zoom-btn,
.afv-link-btn {
    /* 配置：中央配置の基準 */
    position: absolute;
    left: 50%;

    /* ★変更: 縦位置を「中央」から「下（文字の上）」へ */
    top: auto; /* top指定を解除 */
    bottom: 45px; /* 下から45px（タイトル文字のすぐ上あたり） */

    /* 最初は隠す */
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 0) scale(0.8); /* 縦方向のズレ補正を削除 */

    /* ★変更: サイズを少し小さくして、画像を見やすくする */
    width: 32px;
    height: 32px;

    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;

    /* アイコン配置 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    text-decoration: none;
}

/* 2. アイコン自体のサイズ調整 */
.afv-zoom-btn .dashicons,
.afv-link-btn .dashicons {
    font-size: 16px; /* 20px -> 16px */
    width: 16px;
    height: 16px;
    line-height: 1;
    margin: 0;
}

/* 3. 左右にずらして並べる（サイズ変更に合わせて調整） */
.afv-zoom-btn {
    margin-left: -18px; /* 左へ (32px幅 + 隙間4px) */
}
.afv-link-btn {
    margin-left: 18px; /* 右へ */
}

/* 4. 親要素ホバー時に表示 */
.afv-select-art:hover .afv-zoom-btn,
.afv-select-art:hover .afv-link-btn {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1); /* ふわっと現れる */
}

/* 5. ホバー色 */
.afv-zoom-btn:hover,
.afv-link-btn:hover {
    background: rgba(0, 115, 170, 0.9) !important;
    color: #fff !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 11;
}

/* ステージ */
.afv-stage-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #eee;
    border-radius: 4px;
    touch-action: none;
}
#afv-stage {
    position: relative;
    width: 100%;
    line-height: 0;
    user-select: none;
}
.afv-layer {
    display: block;
    position: absolute;
}
#afv-layer-room {
    position: relative;
    width: 100%;
    height: auto;
    z-index: 1;
}
#afv-frame-container {
    position: absolute;
    z-index: 10;
    line-height: 0;
    cursor: grab;
    transform-origin: 0 0;
}
#afv-frame-container:active {
    cursor: grabbing;
}
#afv-layer-frame {
    position: relative;
    width: 100%;
    height: auto;
    z-index: 30;
    pointer-events: none;
}

#afv-mat-area {
    position: absolute;
    background-color: #fdfdfd;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#afv-mat-area::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
    opacity: 0.4;
}
#afv-art-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 26;
    background-color: #fff;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s;
}
#afv-art-wrapper.no-shadow {
    box-shadow: none !important;
}
#afv-layer-art {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    mix-blend-mode: multiply;
}

/* 4点変形ハンドル */
.afv-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid #333;
    border-radius: 50%;
    z-index: 100;
    cursor: grab;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.1s, background-color 0.2s;
}
#afv-stage:hover .afv-handle,
.afv-handle.ui-draggable-dragging {
    opacity: 1;
    display: block;
}
.afv-handle:active {
    cursor: grabbing;
    background-color: #0073aa;
    border-color: #fff;
    z-index: 101;
    transform: translate(-50%, -50%) scale(1.2);
}

/* ドラッグヒント */
#afv-drag-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.05em;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s ease-out;
}
#afv-drag-hint.fade-out {
    opacity: 0;
}

/* リセットボタン */
#afv-btn-reset-transform {
    font-family: inherit;
    font-size: 13px;
    padding: 8px 16px;
    cursor: pointer;
    background-color: #f9f9f9;
    color: #333;
    border: 1px solid #999;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    justify-content: center;
}
#afv-btn-reset-transform:hover {
    background-color: #333;
    color: #fff;
    border-color: #333;
    transform: translateY(-1px);
}
#afv-btn-reset-transform .dashicons {
    color: inherit;
}

/* その他 */
input[type='range'] {
    width: 100%;
    margin: 8px 0;
}
.afv-mat-color-btn {
    transition: transform 0.2s;
}
.afv-mat-color-btn.active {
    border: 2px solid #0073aa !important;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.afv-list::-webkit-scrollbar {
    height: 8px;
}
.afv-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.afv-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.afv-accordion-trigger {
    cursor: pointer;
    position: relative;
    padding-right: 30px;
    user-select: none;
    transition: background 0.2s;
}
.afv-accordion-trigger:hover {
    color: #0073aa;
}
.afv-accordion-trigger::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: bold;
    color: #999;
}
.afv-accordion-trigger.active::after {
    content: '-';
    color: #0073aa;
}
#afv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}
.afv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}
.afv-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    background: transparent;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}
#afv-modal-img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border: 5px solid #fff;
    background: #fff;
}
.afv-modal-close {
    position: absolute;
    top: -35px;
    right: 0;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.afv-modal-close:hover {
    color: #ccc;
}
.afv-sold-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: rgba(210, 63, 49, 0.9);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 10px;
    border: 2px solid #fff;
    border-radius: 3px;
    z-index: 4;
    pointer-events: none;
    white-space: nowrap;
}
.afv-item.sold-item img {
    opacity: 0.6;
    filter: grayscale(100%);
}
.afv-item.sold-item:hover {
    border-color: #d23f31;
    background: #fff0f0;
}
.simulator-intro-container {
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    margin-bottom: 30px;
    margin-top: 20px;
}
.simulator-message-box {
    background-color: #fff;
    max-width: 1100px;
    margin: 0 auto;
    padding: 25px 30px;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    text-align: center;
    border-top: 3px solid #333;
}
.simulator-message-box .msg-title {
    font-size: 20px;
    margin-bottom: 12px;
    margin-top: 0;
    font-family: inherit;
    color: #333;
    letter-spacing: 0.05em;
    font-weight: bold;
}
.simulator-message-box .msg-body {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 8px;
}
.simulator-message-box .msg-body:last-child {
    margin-bottom: 0;
}
.simulator-message-box strong {
    color: #000;
    font-weight: 600;
    border-bottom: 1px solid #ccc;
}
@media (max-width: 768px) {
    .simulator-message-box {
        padding: 20px 15px;
    }
    .simulator-message-box .msg-title {
        font-size: 18px;
    }
}
.afv-filter-buttons {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.afv-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}
.afv-filter-btn:hover {
    background: #f9f9f9;
    color: #333;
    transform: translateY(-2px);
}
.afv-filter-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(0);
}

/* --- 見積もり金額ボックス --- */
.afv-price-box {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: #f0f6fc;
    border: 2px solid #0073aa;
    border-radius: 5px;
    box-sizing: border-box; /* 枠線を含めて幅計算する（はみ出し防止） */
    width: 100%;
}

.afv-price-label {
    display: block; /* 改行させる */
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

#afv-total-price {
    display: block;
    /* ★変更: 36px -> 28px (少し小さく) */
    font-size: 28px;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
}

.afv-tax-label {
    font-size: 12px;
    color: #777;
}

/* --- アクションボタンエリア --- */
.afv-action-buttons {
    text-align: center;
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap; /* 画面が狭いときは折り返す */
}

/* ボタン共通スタイル */
.afv-btn-common {
    padding: 15px 30px;
    font-size: 16px;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: opacity 0.2s;
    /* デフォルトの背景色はIDで指定 */
}
.afv-btn-common:hover {
    opacity: 0.9;
}

/* 個別の背景色 */
#afv-btn-download {
    background: #333;
}
#afv-btn-inquire {
    background: #d23f31;
}

/* ★スマホ対応: レイアウト調整 */
@media (max-width: 768px) {
    .afv-price-box {
        padding: 15px;
        margin-top: 15px;
        width: 100%;
    }

    #afv-total-price {
        font-size: 24px; /* 金額文字を少し小さく */
    }

    .afv-action-buttons {
        flex-direction: column; /* 縦積みにする */
        gap: 10px;
    }

    .afv-btn-common {
        width: 100% !important; /* 横幅いっぱいに広げる */
        padding: 12px 0; /* 高さを少し抑える */
        font-size: 14px;
    }

    .inside-article {
        padding: 0 !important;
    }

    h1.entry-title {
        padding: 20px;
    }

    h2.simulator-step {
        margin-top: 20px;
        font-size: 22px;
    }

    .simulator-intro-container {
        margin-top: 0;
    }
}

/* --- 作品詳細ページの画像はみ出し防止 (強力版) --- */

/* 1. 親要素が画面幅を超えないように制限 */
.art-detail-container,
.art-intro-section,
.art-intro-image,
.afv-main-display-wrapper {
    max-width: 100%; /* 親要素の幅を超えない */
    width: 100%; /* 幅いっぱい */
    box-sizing: border-box; /* パディングを含めて計算 */
    min-width: 0; /* Flexbox内での縮小を許可 (★重要) */
}

/* 2. 画像自体を強制的に枠内に収める */
#afv-main-img {
    width: 100% !important; /* 強制的に幅100% */
    max-width: 100% !important; /* 絶対に親を超えない */
    height: auto !important; /* アスペクト比を維持 */
    object-fit: contain; /* 枠内に綺麗に収める */
    display: block;
}

h3.afv-fav-title {
    font-size: 16.5px;
    line-height: 17px;
    font-weight: bold;
}

/* 3. スマホ表示時の念押し設定 */
@media (max-width: 768px) {
    .art-intro-image,
    .afv-main-display-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .art-styling-box {
        padding: 15px !important;
    }

    .simulator-intro-container {
        width: 100%;
        padding: 0px;
        margin: 0;
    }
}

/* --- 言語切り替えスイッチ --- */
.lang-switch {
    display: flex;
    gap: 15px;
}

.lang-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.9rem;
    color: #ccc; /* 非アクティブ色 */
    cursor: pointer;
    transition: color 0.3s;
    position: relative;
}

.lang-btn.active {
    color: #333; /* アクティブ色 */
    font-weight: 600;
}

/* アクティブ時の下線 */
.lang-btn.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #333;
}

/* コンテンツの表示制御はJSで行いますが、念のためCSSでも */
.lang-ja {
    display: none;
}
.lang-en {
    display: block;
}

/* --- Styling Title (共通見出しスタイル: H2) --- */
.styling-title {
    font-size: 1.3rem; /* 元1.8rem -> 1.3rem に縮小 */
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px; /* 余白も少し詰める */
    color: #333;
    letter-spacing: 0.05em;
    border: none;

    /* 文字に影を落とす（文字サイズに合わせて少し控えめに） */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- インテリア提案ボックス (Shadow & Rounded) --- */
.art-styling-box {
    border: none; /* 枠線なし */

    /* 影で浮き上がらせる */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

    /* 四隅を丸める */
    border-radius: 12px;

    padding: 30px; /* 40px -> 30px に少し調整 */
    background-color: #fff;
    margin-top: 30px; /* マージンも少し詰める */
}

.art-styling-box p {
    font-size: 0.9rem; /* 元1.05rem -> 0.9rem に縮小 */
    line-height: 1.8;
    color: #555;
    margin: 0;
}

/* レイアウト調整 */
.art-intro-section {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 50px;
}

/* H1のスタイル調整 */
.art-intro-text .entry-title {
    font-size: 1.8rem; /* 元2.4rem -> 1.8rem に縮小 */
    font-weight: 600; /* 太すぎないように調整 */
    border-bottom: none;
    margin-bottom: 20px;
    line-height: 1.3;
}

/* 通常の本文テキスト（説明文）のサイズも合わせる */
.art-intro-text .entry-content {
    font-size: 0.95rem; /* 約15px */
    line-height: 1.8;
    color: #444;
}

/* --- 言語切り替えボタンのスタイル修正 --- */

/* 全ての状態（通常・ホバー・クリック後・アクティブ）で背景を透明にする */
.lang-btn,
.lang-btn:hover,
.lang-btn:focus,
.lang-btn:active,
.lang-btn.active {
    background-color: transparent !important; /* 背景色を強制的に透明に */
    background: none !important;
    box-shadow: none !important; /* ボタンの影も消す */
    border: none !important;
    outline: none !important; /* クリック時の枠線も消す */
    padding: 0 !important; /* 余計な余白を消す */
}

/* ホバー時の挙動（背景は変えず、透明度で反応させる） */
.lang-btn:hover {
    opacity: 0.7;
    color: #333;
}

/* アクティブ時（選択中）のスタイル */
.lang-btn.active {
    color: #333 !important;
    font-weight: 600;
    opacity: 1;
}

/* アクティブ時の下線（前回のコードを維持） */
.lang-btn.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #333;
}
