/* Present Stories Plugin Styles */

/* 基本設定 */
.ps-stories-container,
.ps-qa-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* フィルター */
.ps-filters {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #f0f0f0;
}

.ps-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.ps-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.ps-filter-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-width: 150px;
}

.ps-filter-button {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ps-filter-button:hover {
    background: #005a87;
}

.ps-clear-filters {
    color: #666;
    text-decoration: none;
    padding: 8px 16px;
}

.ps-clear-filters:hover {
    color: #333;
}

/* グリッドレイアウト */
.ps-stories-grid,
.ps-questions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* 体験談カード */
.ps-story-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.ps-story-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.ps-story-header {
    margin-bottom: 15px;
}

.ps-story-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    line-height: 1.4;
}

.ps-story-title a {
    color: #333;
    text-decoration: none;
}

.ps-story-title a:hover {
    color: #007cba;
}

.ps-story-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 10px;
}

.ps-story-content {
    margin-bottom: 15px;
}

.ps-story-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.ps-story-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ps-detail-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.ps-satisfaction {
    color: #ff9800;
    font-size: 12px;
    font-weight: 500;
}

.ps-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ps-category-tag {
    background: #f5f5f5;
    color: #666;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
}

.ps-story-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.ps-story-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ps-like-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: color 0.3s ease;
}

.ps-like-button:hover,
.ps-like-button.liked {
    color: #e91e63;
}

.ps-like-icon {
    font-size: 16px;
}

.ps-read-more {
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.ps-read-more:hover {
    text-decoration: underline;
}

/* 質問カード */
.ps-question-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.ps-question-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ps-question-card.resolved {
    border-left: 4px solid #4caf50;
}

.ps-question-card.unresolved {
    border-left: 4px solid #ff9800;
}

.ps-question-status {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ps-status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.ps-status-badge.resolved {
    background: #e8f5e8;
    color: #2e7d32;
}

.ps-status-badge.unresolved {
    background: #fff3e0;
    color: #f57c00;
}

.ps-urgency-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.ps-urgency-badge.urgency-今日中 {
    background: #ffebee;
    color: #c62828;
}

.ps-urgency-badge.urgency-今週中 {
    background: #fff3e0;
    color: #ef6c00;
}

.ps-urgency-badge.urgency-今月中 {
    background: #f3e5f5;
    color: #7b1fa2;
}

.ps-urgency-badge.urgency-急がない {
    background: #e8f5e8;
    color: #388e3c;
}

.ps-question-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    line-height: 1.4;
}

.ps-question-title a {
    color: #333;
    text-decoration: none;
}

.ps-question-title a:hover {
    color: #007cba;
}

.ps-question-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ps-question-type {
    background: #e1f5fe;
    color: #0277bd;
    padding: 2px 6px;
    border-radius: 10px;
}

.ps-question-content {
    margin: 15px 0;
}

.ps-question-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.ps-question-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ps-question-stats {
    display: flex;
    gap: 15px;
}

.ps-answer-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ps-count-number {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.ps-count-label {
    font-size: 12px;
    color: #666;
}

.ps-view-question {
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.ps-view-question:hover {
    text-decoration: underline;
}

/* フォームスタイル */
.ps-story-form-container,
.ps-question-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.ps-form {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 30px;
}

.ps-form-group {
    margin-bottom: 20px;
}

.ps-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.ps-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.ps-form-group .required {
    color: #e53e3e;
}

.ps-form-group input,
.ps-form-group select,
.ps-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.ps-form-group input:focus,
.ps-form-group select:focus,
.ps-form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.ps-form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.ps-form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.ps-submit-button {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

.ps-reset-button {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ps-reset-button:hover {
    background: #e9ecef;
}

.ps-form-message {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
}

.ps-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ps-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ユーザープロフィール */
.ps-user-profile {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.ps-profile-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.ps-user-avatar img {
    border-radius: 50%;
}

.ps-user-info {
    flex: 1;
}

.ps-user-name {
    margin: 0 0 10px 0;
    color: #333;
}

.ps-user-level {
    margin-bottom: 15px;
}

.ps-level-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin-bottom: 5px;
}

.ps-level-progress {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.ps-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #0099d6);
    transition: width 0.3s ease;
}

.ps-user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ps-badge {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #ffeaa7;
}

.ps-profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.ps-stat-item {
    text-align: center;
}

.ps-stat-number {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #007cba;
}

.ps-stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ps-user-bio,
.ps-user-recent-activity {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    margin-bottom: 20px;
}

.ps-user-bio h3,
.ps-user-recent-activity h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.ps-recent-posts {
    space-y: 10px;
}

.ps-recent-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.ps-recent-post-item:last-child {
    border-bottom: none;
}

.ps-post-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    margin-right: 10px;
}

.ps-post-date {
    font-size: 12px;
    color: #666;
}

/* ページネーション */
.ps-pagination {
    text-align: center;
    margin-top: 30px;
}

.ps-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    color: #007cba;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.ps-pagination .page-numbers:hover,
.ps-pagination .page-numbers.current {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* ログイン要求 */
.ps-login-required {
    text-align: center;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.ps-login-required a {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
}

.ps-login-required a:hover {
    text-decoration: underline;
}

/* エラー・成功メッセージ */
.ps-no-stories,
.ps-no-questions {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* ローディング */
.ps-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.ps-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: ps-spin 1s linear infinite;
    margin-left: 10px;
}

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

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .ps-stories-grid,
    .ps-questions-list {
        grid-template-columns: 1fr;
    }
    
    .ps-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ps-filter-row {
        flex-direction: column;
    }
    
    .ps-filter-form select {
        min-width: auto;
        width: 100%;
    }
    
    .ps-form-row {
        grid-template-columns: 1fr;
    }
    
    .ps-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .ps-profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ps-story-actions,
    .ps-question-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .ps-form-actions {
        flex-direction: column;
    }
    
    .ps-recent-post-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* アニメーション */
.ps-story-card,
.ps-question-card {
    animation: ps-fadeInUp 0.6s ease-out;
}

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

/* ホバーエフェクト */
.ps-like-button,
.ps-submit-button,
.ps-filter-button {
    position: relative;
    overflow: hidden;
}

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

.ps-like-button:active::after,
.ps-submit-button:active::after,
.ps-filter-button:active::after {
    width: 300px;
    height: 300px;
}

/* 匿名投稿フォームセクション */
.ps-anonymous-section {
    background: #fff8e1;
    border: 2px solid #ffcc02;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
}

.ps-anonymous-section::before {
    content: '匿名投稿';
    position: absolute;
    top: -10px;
    left: 20px;
    background: #ffcc02;
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.ps-section-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 5px;
    display: inline-block;
}

.ps-section-description {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.ps-anonymous-section .ps-section-title {
    border-bottom-color: #ffcc02;
}

/* 投稿者情報表示 */
.ps-author-details {
    color: #666;
    font-size: 12px;
    margin-left: 5px;
    font-weight: normal;
}

.fas.fa-user-secret {
    color: #ff9800;
    margin-right: 5px;
}

.fas.fa-user {
    color: #007cba;
    margin-right: 5px;
}

/* 匿名投稿バッジ */
.ps-anonymous-badge {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 10px;
    border: 1px solid #ffeaa7;
}

/* 匿名投稿カードのスタイル */
.ps-story-card.anonymous {
    border-left: 3px solid #ff9800;
    position: relative;
}

.ps-story-card.anonymous::after {
    content: '匿名';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid #ffeaa7;
}

/* 文字数カウンター */
.ps-char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

.ps-char-counter.ps-warning {
    color: #ff9800;
    font-weight: 500;
}

.ps-char-counter.ps-error {
    color: #f44336;
    font-weight: 500;
}

/* フィールドエラー */
.ps-field-error {
    color: #f44336;
    font-size: 12px;
    margin-top: 5px;
    padding: 5px 8px;
    background: #ffebee;
    border-radius: 4px;
    border-left: 3px solid #f44336;
}

.ps-form-group input.ps-error,
.ps-form-group select.ps-error,
.ps-form-group textarea.ps-error {
    border-color: #f44336;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.1);
}

/* フォームセクション区切り */
.ps-story-section,
.ps-present-section {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.ps-story-section .ps-section-title {
    border-bottom-color: #28a745;
}

.ps-present-section .ps-section-title {
    border-bottom-color: #6f42c1;
}

/* 匿名投稿者アイコンアニメーション */
.fas.fa-user-secret {
    animation: ps-anonymous-pulse 2s infinite;
}

@keyframes ps-anonymous-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .ps-anonymous-section::before {
        top: -8px;
        left: 15px;
        font-size: 11px;
        padding: 1px 6px;
    }
    
    .ps-section-title {
        font-size: 16px;
    }
    
    .ps-story-card.anonymous::after {
        top: 8px;
        right: 8px;
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .ps-author-details {
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
}

@media (max-width: 480px) {
    .ps-anonymous-section,
    .ps-story-section,
    .ps-present-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .ps-section-description {
        font-size: 13px;
    }
    
    .ps-char-counter {
        font-size: 11px;
    }
    
    .ps-field-error {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* アクセシビリティ向上 */
.ps-form-group label:focus-within {
    color: #007cba;
    font-weight: 600;
}

.ps-anonymous-section:focus-within {
    border-color: #ffcc02;
    box-shadow: 0 0 0 3px rgba(255, 204, 2, 0.2);
}

/* ツールチップスタイル */
.ps-tooltip {
    position: absolute;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ps-tooltip.ps-tooltip-show {
    opacity: 1;
}

.ps-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #333;
}