/**
 * Fan Portal フロントエンドスタイルシート
 *
 * @package Fan_Portal
 */

/* 共通スタイル */
.fp-poll-container,
.fp-quiz-container,
.fp-shindan-container {
    max-width: 600px;
    margin: 30px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* アンケートフォーム */
.fp-poll-form {
    margin-bottom: 20px;
}

.fp-poll-question {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.fp-poll-choices {
    margin-bottom: 20px;
}

.fp-poll-choice {
    display: block;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fp-poll-choice:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.fp-poll-choice input[type="radio"] {
    margin-right: 10px;
}

/* 投票ボタン */
.fp-submit-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fp-submit-button:hover {
    background-color: #005a87;
}

.fp-submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 結果表示エリア */
.fp-poll-results,
.fp-poll-results-static {
    margin-top: 20px;
}

.fp-poll-results h3,
.fp-poll-results-static h3 {
    margin-bottom: 10px;
    color: #333;
}

/* チャートコンテナ */
.fp-chart-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
}

/* グラフキャンバス */
#poll-chart-canvas,
canvas[id^="poll-chart"],
canvas[id^="quiz-chart"],
canvas[id^="shindan-chart"] {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
}

/* 統計情報 */
.fp-poll-stats {
    margin-top: 20px;
}

.fp-poll-stat-item {
    margin-bottom: 15px;
}

.fp-poll-choice-name {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.fp-poll-bar-container {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.fp-poll-bar {
    height: 100%;
    background-color: #0073aa;
    transition: width 0.5s ease;
}

.fp-poll-stat {
    font-size: 14px;
    color: #666;
}

/* 再投票ボタン */
.fp-retry-button {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fp-retry-button:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

/* メッセージコンテナ */
.fp-message-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 90%;
    width: 500px;
}

/* メッセージ基本スタイル */
.fp-message {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

/* メッセージタイプ別スタイル */
.fp-message--error {
    background-color: #fee;
    border-left: 4px solid #c33;
    color: #c33;
}

.fp-message--success {
    background-color: #efe;
    border-left: 4px solid #3c3;
    color: #3c3;
}

.fp-message--info {
    background-color: #e6f3ff;
    border-left: 4px solid #0066cc;
    color: #0066cc;
}

/* メッセージアイコン */
.fp-message__icon::before {
    margin-right: 10px;
    font-family: dashicons;
    font-size: 20px;
}

.fp-message--error .fp-message__icon::before {
    content: "\f534";
}

.fp-message--success .fp-message__icon::before {
    content: "\f12a";
}

.fp-message--info .fp-message__icon::before {
    content: "\f348";
}

/* メッセージテキスト */
.fp-message__text {
    flex: 1;
}

/* 閉じるボタン */
.fp-message__close {
    background: none;
    border: none;
    color: inherit;
    font-size: 24px;
    cursor: pointer;
    margin-left: 10px;
    opacity: 0.7;
}

.fp-message__close:hover {
    opacity: 1;
}

/* ローダー */
.fp-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fp-loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* アニメーション */
@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* クイズスタイル */
.fp-quiz-question {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.fp-quiz-choices {
    margin-bottom: 20px;
}

.fp-quiz-choice {
    display: block;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fp-quiz-choice:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.fp-quiz-choice input[type="radio"] {
    margin-right: 10px;
}

/* クイズ結果 */
.fp-quiz-result,
.fp-quiz-result-static {
    margin-top: 20px;
}

.fp-quiz-correct {
    color: #3c3;
    font-size: 24px;
    margin-bottom: 15px;
}

.fp-quiz-incorrect {
    color: #c33;
    font-size: 24px;
    margin-bottom: 15px;
}

.fp-quiz-explanation {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.fp-quiz-explanation h4 {
    margin-top: 0;
    color: #333;
}

.fp-quiz-stats {
    margin: 15px 0;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* 診断スタイル */
.fp-shindan-progress {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    margin-bottom: 30px;
    overflow: hidden;
}

.fp-shindan-progress-bar {
    height: 100%;
    background: #0073aa;
    transition: width 0.3s ease;
}

.fp-shindan-question-text {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.fp-shindan-choices {
    display: grid;
    gap: 10px;
}

.fp-shindan-choice {
    padding: 15px 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 16px;
}

.fp-shindan-choice:hover {
    background: #f5f5f5;
    border-color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fp-shindan-loading {
    text-align: center;
    padding: 40px;
}

.fp-shindan-loading p {
    font-size: 18px;
    color: #666;
}

/* 診断結果 */
.fp-shindan-result,
.fp-shindan-result-static {
    margin-top: 20px;
}

.fp-shindan-result-type {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.fp-shindan-result-type h2 {
    color: #0073aa;
    font-size: 28px;
    margin-bottom: 15px;
}

.fp-shindan-result-type p {
    font-size: 16px;
    line-height: 1.8;
    color: #666;
}

.fp-shindan-stats {
    text-align: center;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .fp-poll-container,
    .fp-quiz-container,
    .fp-shindan-container {
        margin: 20px 10px;
        padding: 15px;
    }
    
    .fp-message-container {
        width: calc(100% - 20px);
        top: 10px;
    }
    
    .fp-message {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    /* チャートのモバイル対応 */
    .fp-chart-container {
        max-width: 100%;
        padding: 0 10px;
    }
    
    canvas[id^="poll-chart"],
    canvas[id^="quiz-chart"],
    canvas[id^="shindan-chart"] {
        touch-action: none; /* タッチ操作の改善 */
    }
    
    .fp-poll-question,
    .fp-quiz-question,
    .fp-shindan-question-text {
        font-size: 16px;
    }
    
    .fp-submit-button {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .fp-shindan-choice {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .fp-shindan-result-type h2 {
        font-size: 22px;
    }
    
    .fp-shindan-result-type {
        padding: 20px;
    }
}

/* エラー状態のスタイル */
.fp-error-state {
    border: 2px solid #dc3545;
    background-color: #fee;
}

.fp-error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

/* フォーカス状態の改善 */
.fp-poll-choice:focus-within,
.fp-quiz-choice:focus-within,
.fp-shindan-choice:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ローディング状態の改善 */
.fp-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

/* アニメーション改善 */
.fp-fade-in {
    animation: fadeIn 0.3s ease-in;
}

.fp-fade-out {
    animation: fadeOut 0.3s ease-out;
}

.fp-slide-in {
    animation: slideIn 0.3s ease-out;
}

.fp-bounce {
    animation: bounce 0.5s ease;
}

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

/* スケルトンローダー */
.fp-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.fp-skeleton-text {
    height: 16px;
    margin: 10px 0;
    border-radius: 4px;
}

.fp-skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: 4px;
}

/* 改善されたボタンスタイル */
.fp-submit-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.fp-submit-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.fp-submit-button:active::before {
    width: 300px;
    height: 300px;
}

/* ツールチップ */
.fp-tooltip {
    position: relative;
    display: inline-block;
}

.fp-tooltip .fp-tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
}

.fp-tooltip .fp-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.fp-tooltip:hover .fp-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* アクセシビリティ改善 */
.fp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .fp-poll-container,
    .fp-quiz-container,
    .fp-shindan-container {
        border: 2px solid #000;
    }
    
    .fp-submit-button {
        border: 2px solid #000;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .fp-poll-container,
    .fp-quiz-container,
    .fp-shindan-container {
        background: #1e1e1e;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .fp-poll-choice,
    .fp-quiz-choice,
    .fp-shindan-choice {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .fp-poll-choice:hover,
    .fp-quiz-choice:hover,
    .fp-shindan-choice:hover {
        background: #333;
        border-color: #666;
    }
    
    .fp-submit-button {
        background-color: #0056b3;
    }
    
    .fp-submit-button:hover {
        background-color: #004494;
    }
}

/* 印刷対応 */
@media print {
    .fp-loader,
    .fp-message-container,
    .fp-submit-button,
    .fp-retry-button {
        display: none !important;
    }
    
    .fp-poll-container,
    .fp-quiz-container,
    .fp-shindan-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}