/* ============================================================
   Custom Float Button - Frontend Styles v1.1.0
   ★ WP Super Cache対応: デザイン切り替えはJS側で実行
   ★ Pochipp対応: 商品ボックスとの重なり防止CSS追加
   ============================================================ */

/* コンテナ共通 */
#cfb-float-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    text-align: center;
    padding: 12px 16px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    transform: translateY(0);
    opacity: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#cfb-float-container.cfb-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* 初期アニメーション */
#cfb-float-container.cfb-enter {
    transform: translateY(100%);
    opacity: 0;
}

/* マイクロコピー */
.cfb-micro-text {
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    animation: cfb-micro-bounce 2s ease-in-out infinite;
}

@keyframes cfb-micro-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* ボタン共通 */
.cfb-button {
    display: inline-block;
    padding: 14px 48px;
    color: #fff !important;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.cfb-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    color: #fff !important;
    filter: brightness(1.1);
}

.cfb-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ボタン光るエフェクト */
.cfb-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.3),
        transparent
    );
    transform: skewX(-25deg);
    animation: cfb-shine 3s ease-in-out infinite;
}

@keyframes cfb-shine {
    0% { left: -60%; }
    20% { left: 120%; }
    100% { left: 120%; }
}

/* 円形ボタン */
.cfb-btn-circle {
    width: 64px;
    height: 64px;
    padding: 0;
    font-size: 13px;
    line-height: 64px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 閉じるボタン */
.cfb-close-btn {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.cfb-close-btn:hover {
    color: #fff;
}

/* ============================================================
   デザインバリエーション
   ★ デザインクラスはJSで動的に適用される（WP Super Cache対応）
   ============================================================ */

/* デザイン1: 角丸バー */
.cfb-design-design1 {
    border-radius: 12px 12px 0 0;
    max-width: 600px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

.cfb-design-design1.cfb-hidden {
    transform: translateX(-50%) translateY(100%);
}

/* デザイン2: フルワイドバー */
.cfb-design-design2 {
    border-radius: 0;
    max-width: 100%;
}

/* デザイン3: コンパクト右下/中央 */
.cfb-design-design3 {
    left: auto;
    right: 20px;
    bottom: 20px;
    border-radius: 12px;
    max-width: 280px;
    padding: 16px;
}

.cfb-design-design3.cfb-hidden {
    transform: translateY(calc(100% + 20px));
}

/* デザイン4: 帯付きバー */
.cfb-design-design4 {
    border-radius: 0;
    padding: 16px;
    border-top: 3px solid rgba(255,255,255,0.3);
}

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 768px) {
    .cfb-button {
        padding: 12px 32px;
        font-size: 15px;
    }

    .cfb-btn-circle {
        width: 56px;
        height: 56px;
        line-height: 56px;
        font-size: 12px;
        padding: 0;
    }

    .cfb-design-design1 {
        max-width: calc(100% - 20px);
    }

    .cfb-design-design3 {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: 10px;
        max-width: calc(100% - 20px);
    }

    .cfb-design-design3.cfb-hidden {
        transform: translateX(-50%) translateY(calc(100% + 20px));
    }

    .cfb-micro-text {
        font-size: 12px;
    }

    #cfb-float-container {
        padding: 10px 12px;
    }
}

/* ============================================================
   SWELLテーマとの互換性
   ============================================================ */
body.admin-bar #cfb-float-container {
    /* 管理バー表示時の位置調整不要（bottomに固定のため） */
}

/* SWELLの固定ボタン（トップへ戻る等）との干渉防止 */
.p-fixBtnWrap {
    bottom: 80px !important;
}

/* ============================================================
   ★ Pochipp対応: 商品ボックスとの重なり防止
   フロートボタン表示時に、ページ下部にpaddingを追加して
   Pochippの商品ボックスがボタンに隠れないようにする
   ============================================================ */
body.cfb-active {
    padding-bottom: 80px;
}

/* Pochippの商品リンクボックスがフロートボタンの背面に回らないよう調整 */
.pochipp-box {
    position: relative;
    z-index: 1;
}

/* Pochippのインライン商品リンクとの共存 */
.pochipp-box--inline {
    margin-bottom: 16px;
}

/* ============================================================
   ★ SWELLフッター固定メニューとの共存
   SWELLのフッター固定メニューが表示される場合、
   フロートボタンの位置を上にずらす
   ============================================================ */
@media (max-width: 768px) {
    /* SWELLのフッター固定バー */
    .l-fixFooter ~ #cfb-float-container,
    .p-fixFooter ~ #cfb-float-container {
        bottom: 56px;
    }
}
