/**
 * FUNDiT Conversion Boost Popup - フロントエンドCSS
 * リッチデザイン版 v2.0
 */

/* ========================================
   アニメーション定義
   ======================================== */

@keyframes fcbpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fcbpSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

@keyframes fcbpGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fcbpButtonShine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

@keyframes fcbpPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes fcbpFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes fcbpBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fcbpParticle {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% {
        transform: translateY(-80px) translateX(30px);
        opacity: 0;
    }
}

/* ========================================
   基本スタイル
   ======================================== */

.fcbp-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcbp-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fcbpFadeIn 0.3s ease-out;
}

/* スクロール無効化 */
body.fcbp-popup-open {
    overflow: hidden;
}

/* ========================================
   グラデーション枠（メイン効果）
   ======================================== */

.fcbp-popup-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    animation: fcbpSlideIn 0.5s cubic-bezier(0.68, -0.3, 0.265, 1.3);
    z-index: 1000000;
}

.fcbp-gradient-border {
    background: linear-gradient(45deg, #f093fb, #f5576c, #4facfe, #00f2fe, #f093fb);
    background-size: 400% 400%;
    animation: fcbpGradientShift 4s ease infinite;
    padding: 3px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.fcbp-popup-inner {
    background: #fff;
    border-radius: 17px;
    padding: 35px 30px;
    position: relative;
    max-height: calc(85vh - 6px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* パーティクルエフェクト */
.fcbp-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.fcbp-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    border-radius: 50%;
    animation: fcbpParticle 6s infinite;
}

.fcbp-particle:nth-child(1) { left: 10%; top: 80%; animation-delay: 0s; }
.fcbp-particle:nth-child(2) { left: 30%; top: 90%; animation-delay: 1s; }
.fcbp-particle:nth-child(3) { left: 50%; top: 85%; animation-delay: 2s; }
.fcbp-particle:nth-child(4) { left: 70%; top: 90%; animation-delay: 3s; }
.fcbp-particle:nth-child(5) { left: 90%; top: 80%; animation-delay: 4s; }

/* ========================================
   閉じるボタン
   ======================================== */

.fcbp-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    background: #333;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    color: #fff;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.fcbp-close-btn:hover {
    background: #ff4444;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 5px 20px rgba(255, 68, 68, 0.4);
}

.fcbp-close-btn span {
    display: block;
}

/* ========================================
   コンテンツスタイル
   ======================================== */

.fcbp-popup-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.fcbp-popup-header {
    margin-bottom: 25px;
    animation: fcbpSlideUp 0.6s ease-out 0.2s both;
}

.fcbp-image-wrapper {
    margin-bottom: 20px;
    animation: fcbpSlideUp 0.6s ease-out 0.3s both;
}

.fcbp-popup-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    animation: fcbpFloat 4s ease-in-out infinite;
}

.fcbp-popup-title {
    font-size: 1.75em;
    font-weight: bold;
    margin: 0 0 12px;
    line-height: 1.3;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fcbpPulse 3s ease-in-out infinite;
}

.fcbp-popup-subtitle {
    font-size: 1.1em;
    margin: 0 0 8px;
    color: #666;
    animation: fcbpSlideUp 0.6s ease-out 0.4s both;
}

.fcbp-popup-description {
    font-size: 0.95em;
    margin-bottom: 25px;
    line-height: 1.8;
    color: #555;
    animation: fcbpSlideUp 0.6s ease-out 0.5s both;
}

/* CTA前のラベル */
.fcbp-cta-label {
    text-align: center;
    color: #ff6b6b;
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 14px;
    animation: fcbpBlink 2s ease-in-out infinite;
}

/* ========================================
   CTAボタン（リッチ版）
   ======================================== */

.fcbp-cta-section {
    animation: fcbpSlideUp 0.6s ease-out 0.5s both;
}

.fcbp-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 35px;
    font-size: 1.15em;
    font-weight: bold;
    text-decoration: none;
    border: none;
    cursor: pointer;
    border-radius: 50px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    box-shadow: 0 10px 35px rgba(102, 126, 234, 0.4);
}

.fcbp-cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: fcbpButtonShine 3s infinite;
}

.fcbp-cta-button:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 45px rgba(102, 126, 234, 0.5);
    color: #fff !important;
}

.fcbp-cta-button .fcbp-button-icon {
    font-size: 1.2em;
    animation: fcbpFloat 1.5s ease-in-out infinite;
}

.fcbp-cta-note {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 12px;
}

/* 複数ボタン横並び */
.fcbp-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.fcbp-buttons-row .fcbp-cta-button {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
    padding: 14px 24px;
    font-size: 1em;
}

/* セカンダリボタン */
.fcbp-cta-button.fcbp-btn-secondary {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.fcbp-cta-button.fcbp-btn-secondary:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

/* ========================================
   区切り線
   ======================================== */

.fcbp-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
    color: #999;
    font-size: 14px;
}

.fcbp-divider::before,
.fcbp-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
}

.fcbp-divider::before { left: 0; }
.fcbp-divider::after { right: 0; }

/* ========================================
   ランキングレイアウト
   ======================================== */

.fcbp-ranking-list {
    text-align: left;
    animation: fcbpSlideUp 0.6s ease-out 0.4s both;
}

.fcbp-ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ecf8 100%);
    border-radius: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.fcbp-ranking-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    transition: left 0.5s ease;
}

.fcbp-ranking-item:hover {
    transform: translateX(8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.fcbp-ranking-item:hover::before {
    left: 100%;
}

.fcbp-ranking-badge {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fcbp-ranking-item[data-rank="1"] .fcbp-ranking-badge {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #333;
}

.fcbp-ranking-item[data-rank="2"] .fcbp-ranking-badge {
    background: linear-gradient(135deg, #e0e0e0, #b0b0b0);
    color: #333;
}

.fcbp-ranking-item[data-rank="3"] .fcbp-ranking-badge {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    color: #fff;
}

.fcbp-ranking-image {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fcbp-ranking-info {
    flex: 1;
    min-width: 0;
}

.fcbp-ranking-name {
    font-size: 1.05em;
    font-weight: bold;
    margin: 0 0 6px;
    color: #333;
}

.fcbp-ranking-desc {
    font-size: 0.85em;
    margin: 0;
    color: #666;
    line-height: 1.4;
}

.fcbp-ranking-btn {
    flex-shrink: 0;
    padding: 10px 18px;
    font-size: 0.85em;
    border-radius: 25px;
}

/* ========================================
   比較表レイアウト
   ======================================== */

.fcbp-comparison-table-wrapper {
    overflow-x: auto;
    margin: 0 -15px;
    padding: 0 15px;
    animation: fcbpSlideUp 0.6s ease-out 0.4s both;
}

.fcbp-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.fcbp-comparison-table th,
.fcbp-comparison-table td {
    padding: 14px 12px;
    text-align: center;
}

.fcbp-comparison-table thead th {
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.fcbp-comparison-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 0.2s ease;
}

.fcbp-comparison-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.fcbp-comparison-table .fcbp-field-label {
    text-align: left;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    background: #f8f9ff;
}

.fcbp-comparison-table tfoot td {
    padding-top: 18px;
    border-bottom: none;
    background: #f8f9ff;
}

.fcbp-comparison-table .fcbp-cta-button {
    padding: 10px 16px;
    font-size: 0.85em;
    width: auto;
}

/* ========================================
   カウントダウンレイアウト
   ======================================== */

.fcbp-countdown-section {
    animation: fcbpSlideUp 0.6s ease-out 0.3s both;
}

.fcbp-countdown {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 25px 0;
}

.fcbp-countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 65px;
}

.fcbp-countdown-number {
    font-size: 2.2em;
    font-weight: bold;
    line-height: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 12px;
    min-width: 55px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.fcbp-countdown-label {
    font-size: 0.75em;
    margin-top: 8px;
    color: #666;
    font-weight: 500;
}

.fcbp-countdown-expired {
    padding: 25px;
    font-size: 1.15em;
    color: #e74c3c;
    font-weight: bold;
    background: #fff5f5;
    border-radius: 12px;
}

/* ========================================
   閉じ方のヒント
   ======================================== */

.fcbp-close-hint {
    font-size: 11px;
    color: #aaa;
    text-align: center;
    margin-top: 20px;
}

/* ========================================
   テーマバリエーション
   ======================================== */

/* ビューティーテーマ */
.fcbp-theme-beauty .fcbp-gradient-border {
    background: linear-gradient(45deg, #ff9a9e, #fecfef, #ffecd2, #ff9a9e);
}

.fcbp-theme-beauty .fcbp-popup-title {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
}

.fcbp-theme-beauty .fcbp-cta-button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 10px 35px rgba(240, 147, 251, 0.4);
}

/* 金融テーマ */
.fcbp-theme-finance .fcbp-gradient-border {
    background: linear-gradient(45deg, #1a5f7a, #159895, #57c5b6, #1a5f7a);
}

.fcbp-theme-finance .fcbp-popup-title {
    background: linear-gradient(135deg, #1a5f7a, #159895);
    -webkit-background-clip: text;
}

.fcbp-theme-finance .fcbp-cta-button {
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    box-shadow: 0 10px 35px rgba(26, 95, 122, 0.4);
}

/* ゲーミングテーマ */
.fcbp-theme-gaming .fcbp-gradient-border {
    background: linear-gradient(45deg, #a855f7, #ec4899, #f59e0b, #a855f7);
}

.fcbp-theme-gaming .fcbp-popup-title {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
}

.fcbp-theme-gaming .fcbp-cta-button {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    box-shadow: 0 10px 35px rgba(168, 85, 247, 0.4);
}

/* ========================================
   レスポンシブ対応
   ======================================== */

/* タブレット */
@media (max-width: 768px) {
    .fcbp-popup-container {
        max-width: 95%;
    }

    .fcbp-popup-inner {
        padding: 30px 25px;
    }

    .fcbp-popup-title {
        font-size: 1.5em;
    }

    .fcbp-cta-button {
        padding: 16px 28px;
        font-size: 1.05em;
    }

    .fcbp-ranking-item {
        flex-wrap: wrap;
    }

    .fcbp-ranking-btn {
        width: 100%;
        text-align: center;
        margin-top: 12px;
    }
}

/* スマートフォン */
@media (max-width: 480px) {
    .fcbp-popup-container {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
    }

    .fcbp-gradient-border {
        border-radius: 16px;
    }

    .fcbp-popup-inner {
        border-radius: 14px;
        padding: 25px 20px 30px;
        max-height: calc(85vh - 6px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fcbp-popup-title {
        font-size: 1.35em;
        padding-right: 35px;
    }

    .fcbp-popup-subtitle {
        font-size: 1em;
    }

    .fcbp-close-btn {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .fcbp-cta-button {
        width: 100%;
        padding: 16px 24px;
        font-size: 1em;
    }

    .fcbp-buttons-row {
        flex-direction: column;
    }

    .fcbp-buttons-row .fcbp-cta-button {
        max-width: none;
    }

    .fcbp-countdown {
        gap: 8px;
    }

    .fcbp-countdown-item {
        min-width: 55px;
    }

    .fcbp-countdown-number {
        font-size: 1.8em;
        padding: 10px 12px;
        min-width: 45px;
    }

    .fcbp-ranking-item {
        padding: 15px;
    }

    .fcbp-ranking-image {
        width: 55px;
        height: 55px;
    }

    .fcbp-ranking-badge {
        width: 38px;
        height: 38px;
        font-size: 0.8em;
    }
}

/* ========================================
   アクセシビリティ
   ======================================== */

.fcbp-popup-wrapper:focus-within .fcbp-popup-container {
    outline: 3px solid #007cba;
    outline-offset: 3px;
}

.fcbp-cta-button:focus,
.fcbp-close-btn:focus {
    outline: 3px solid #007cba;
    outline-offset: 3px;
}

/* アニメーション無効化（prefers-reduced-motion） */
@media (prefers-reduced-motion: reduce) {
    .fcbp-popup-container,
    .fcbp-gradient-border,
    .fcbp-cta-button::before,
    .fcbp-popup-title,
    .fcbp-popup-image,
    .fcbp-particle {
        animation: none !important;
    }

    .fcbp-cta-button,
    .fcbp-close-btn,
    .fcbp-ranking-item {
        transition: none !important;
    }
}

/* ダークモード対応（オプトイン方式 - .fcbp-dark クラスで有効化） */
.fcbp-dark .fcbp-popup-inner {
    background: #1e1e1e;
    color: #f0f0f0;
}

.fcbp-dark .fcbp-popup-subtitle,
.fcbp-dark .fcbp-popup-description {
    color: #ccc;
}

.fcbp-dark .fcbp-ranking-item {
    background: linear-gradient(135deg, #2a2a3a 0%, #1e1e2e 100%);
}

.fcbp-dark .fcbp-ranking-name {
    color: #fff;
}

.fcbp-dark .fcbp-ranking-desc {
    color: #aaa;
}

.fcbp-dark .fcbp-comparison-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.15);
}

.fcbp-dark .fcbp-comparison-table .fcbp-field-label,
.fcbp-dark .fcbp-comparison-table tfoot td {
    background: #252530;
}
