/**
 * お気に入りハートボタンのスタイル
 * Xのいいねボタンスタイルを参考にした可愛いアニメーション実装
 */

.iro-favorite-container {
    display: inline-block;
    margin: 20px 0;
}

/* ハートボタン本体 */
.iro-favorite-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.iro-favorite-btn:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #ef4444;
}

/* アクティブ状態（お気に入り済み） */
.iro-favorite-btn.is-favorite {
    background: #fef2f2;
    border-color: #f43f5e;
    color: #f43f5e;
}

.iro-favorite-btn.is-favorite:hover {
    background: #ffe4e6;
    border-color: #e11d48;
}

/* ハートアイコン */
.iro-favorite-icon {
    position: relative;
    width: 20px;
    height: 20px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ハートSVG */
.iro-favorite-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: all 0.3s ease;
}

/* お気に入り済みのハート（塗りつぶし） */
.iro-favorite-btn.is-favorite .iro-favorite-icon svg {
    fill: currentColor;
    stroke: currentColor;
}

/* クリック時のアニメーション */
.iro-favorite-btn.is-animating .iro-favorite-icon {
    animation: heartBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartBounce {
    0% {
        transform: scale(1);
    }
    15% {
        transform: scale(1.3);
    }
    30% {
        transform: scale(0.9);
    }
    45% {
        transform: scale(1.15);
    }
    60% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* パーティクルアニメーション（Xスタイル） */
.iro-favorite-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.iro-favorite-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
}

/* パーティクルアニメーション実行 */
.iro-favorite-btn.is-animating .iro-favorite-particle {
    animation: particleBurst 0.8s ease-out forwards;
}

/* パーティクル1（右上） */
.iro-favorite-particle:nth-child(1) {
    background: #f43f5e;
    animation-delay: 0s;
}

/* パーティクル2（右） */
.iro-favorite-particle:nth-child(2) {
    background: #fb7185;
    animation-delay: 0.05s;
}

/* パーティクル3（右下） */
.iro-favorite-particle:nth-child(3) {
    background: #fda4af;
    animation-delay: 0.1s;
}

/* パーティクル4（左下） */
.iro-favorite-particle:nth-child(4) {
    background: #fecdd3;
    animation-delay: 0.15s;
}

/* パーティクル5（左） */
.iro-favorite-particle:nth-child(5) {
    background: #fb7185;
    animation-delay: 0.2s;
}

/* パーティクル6（左上） */
.iro-favorite-particle:nth-child(6) {
    background: #f43f5e;
    animation-delay: 0.25s;
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(1);
        opacity: 0;
    }
}

/* 各パーティクルの飛び散る方向 */
.iro-favorite-particle:nth-child(1) { --tx: 30px; --ty: -30px; }
.iro-favorite-particle:nth-child(2) { --tx: 40px; --ty: 0px; }
.iro-favorite-particle:nth-child(3) { --tx: 30px; --ty: 30px; }
.iro-favorite-particle:nth-child(4) { --tx: -30px; --ty: 30px; }
.iro-favorite-particle:nth-child(5) { --tx: -40px; --ty: 0px; }
.iro-favorite-particle:nth-child(6) { --tx: -30px; --ty: -30px; }

/* ローディング状態 */
.iro-favorite-btn.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.iro-favorite-btn.is-loading .iro-favorite-icon {
    animation: heartPulse 1s ease-in-out infinite;
}

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

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .iro-favorite-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .iro-favorite-icon {
        width: 18px;
        height: 18px;
    }
}

/* アクセシビリティ: focus状態 */
.iro-favorite-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.iro-favorite-btn:focus:not(:focus-visible) {
    outline: none;
}

/* ダークモード対応（将来的に） */
@media (prefers-color-scheme: dark) {
    .iro-favorite-btn {
        border-color: #374151;
        color: #9ca3af;
    }

    .iro-favorite-btn:hover {
        background: #1f2937;
        border-color: #f87171;
        color: #f87171;
    }

    .iro-favorite-btn.is-favorite {
        background: #1f2937;
        border-color: #fb7185;
        color: #fb7185;
    }
}

/* トーストメッセージ（オプション） */
.iro-favorite-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: #1f2937;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.iro-favorite-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.iro-favorite-toast.hide {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
}
