/**
 * せいじのとなり - リアクションボタンスタイル
 * 
 * Design System:
 * - Base: #F9FAFB (light background)
 * - Accent 1: #4A90E2 (trust blue)
 * - Accent 2: #FFD45F (sun yellow)
 * - Sub Accent: #A5D6A7 (mint green)
 * - Text Main: #333333
 * - Text Sub: #666666
 */


/* ==========================================
   Container
   ========================================== */

.stn-reactions {
    position: relative;
    margin: 3rem 0;
    padding: 2rem;
    background-color: #F9FAFB;
    border-radius: 16px;
    border: 2px solid #E3E8EA;
}

.stn-reactions__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #333333;
}

.stn-reactions__title i {
    color: #4A90E2;
    font-size: 1.25rem;
}


/* ==========================================
   Button Group
   ========================================== */

.stn-reactions__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}


/* ==========================================
   Reaction Button
   ========================================== */

.stn-react-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background-color: #FFFFFF;
    border: 2px solid #E3E8EA;
    border-radius: 12px;
    color: #333333;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.stn-react-btn:hover {
    background-color: #4A90E2;
    border-color: #4A90E2;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.stn-react-btn:focus {
    outline: 3px solid #FFD45F;
    outline-offset: 2px;
}

.stn-react-btn:active {
    transform: translateY(0);
}

.stn-react-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* Reacted state */

.stn-react-btn.stn-reacted,
.stn-react-btn[aria-pressed="true"] {
    background-color: #A5D6A7;
    border-color: #A5D6A7;
    color: #FFFFFF;
}

.stn-react-btn.stn-reacted:hover {
    background-color: #8BC34A;
    border-color: #8BC34A;
    transform: none;
}


/* Button icon */

.stn-react-btn__icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.stn-react-btn:hover .stn-react-btn__icon {
    transform: scale(1.1);
}


/* Button label */

.stn-react-btn__label {
    flex: 1;
    white-space: nowrap;
}


/* Count badge */

.stn-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2rem;
    padding: 0 0.75rem;
    background-color: #F9FAFB;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #4A90E2;
    transition: all 0.25s ease;
}

.stn-react-btn:hover .stn-count {
    background-color: rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
}

.stn-react-btn.stn-reacted .stn-count {
    background-color: rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
}


/* ==========================================
   Toast Notification
   ========================================== */

.stn-toast {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: #333333;
    color: #FFFFFF;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    max-width: 280px;
}

.stn-toast--show {
    opacity: 1;
    transform: translateY(0);
}

.stn-toast--success {
    background-color: #A5D6A7;
    color: #FFFFFF;
}

.stn-toast--error {
    background-color: #EF5350;
    color: #FFFFFF;
}

.stn-toast--info {
    background-color: #4A90E2;
    color: #FFFFFF;
}


/* ==========================================
   Responsive Design
   ========================================== */

@media (max-width: 768px) {
    .stn-reactions {
        padding: 1.5rem;
        margin: 2rem 0;
    }
    .stn-reactions__buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    .stn-react-btn {
        width: 100%;
        justify-content: space-between;
    }
    .stn-toast {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .stn-reactions {
        padding: 1rem;
        margin: 1.5rem 0;
    }
    .stn-reactions__title {
        font-size: 1rem;
    }
    .stn-react-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
    .stn-react-btn__icon {
        font-size: 1.125rem;
    }
    .stn-count {
        min-width: 2rem;
        height: 1.75rem;
        padding: 0 0.5rem;
        font-size: 0.8125rem;
    }
}


/* ==========================================
   Accessibility
   ========================================== */


/* Screen reader only */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


/* High contrast mode support */

@media (prefers-contrast: high) {
    .stn-react-btn {
        border-width: 3px;
    }
    .stn-react-btn:focus {
        outline-width: 4px;
    }
}


/* Reduced motion support */

@media (prefers-reduced-motion: reduce) {
    .stn-react-btn,
    .stn-count,
    .stn-toast {
        transition: none;
    }
    .stn-react-btn:hover {
        transform: none;
    }
}


/* ==========================================
   Animation (optional enhancement)
   ========================================== */

@keyframes stn-bounce {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.stn-count[data-count]:not([data-count="0"]) {
    animation: stn-bounce 0.4s ease-in-out;
}


/**
 * 拡張用メモ:
 * 
 * 1. ダークモード対応
 *    @media (prefers-color-scheme: dark) で背景色・文字色を反転
 * 
 * 2. カスタムアイコン（Font Awesome）
 *    functions.php の stn_reaction_keys() でアイコンクラスを変更可能
 *    例: 'icon' => 'fa-solid fa-heart', 'fa-regular fa-star' など
 * 
 * 3. プログレスバー
 *    各リアクションの割合を視覚化
 *    <div class="stn-progress" style="width: 60%"></div>
 * 
 * 4. ホバーツールチップ
 *    「クリックして学んだことを教えてください」等の説明表示
 * 
 * 5. アイコンアニメーション
 *    ホバー時に .stn-react-btn__icon が拡大する効果実装済み
 */