/* /home/endroll/www/kami/app/questionbox/assets/css/style.css */

/* CSS変数定義 - オリジナルデザイン */
:root {
    --primary-sage: #87a96b;
    --primary-coral: #ff8a80;
    --primary-lavender: #b39ddb;
    --primary-peach: #ffcc80;
    --primary-mint: #80cbc4;
    --accent-gold: #ffd54f;
    --success-forest: #66bb6a;
    --error-rose: #e57373;
    --warning-amber: #ffb74d;
    
    --sage-light: rgba(135, 169, 107, 0.12);
    --coral-light: rgba(255, 138, 128, 0.12);
    --lavender-light: rgba(179, 157, 219, 0.12);
    --peach-light: rgba(255, 204, 128, 0.12);
    --mint-light: rgba(128, 203, 196, 0.12);
    
    --cream: #faf8f3;
    --warm-white: #fefdfb;
    --soft-gray: #f5f3f0;
    --medium-gray: #8b8680;
    --charcoal: #3d3a36;
    --deep-brown: #2c2925;
    
    --gradient-sunset: linear-gradient(135deg, #ff8a80 0%, #ffcc80 50%, #87a96b 100%);
    --gradient-dawn: linear-gradient(145deg, #b39ddb 0%, #80cbc4 100%);
    --gradient-warm: linear-gradient(135deg, #faf8f3 0%, #f5f3f0 100%);
    
    --shadow-soft: 0 2px 12px rgba(135, 169, 107, 0.15);
    --shadow-medium: 0 4px 20px rgba(135, 169, 107, 0.2);
    --shadow-strong: 0 8px 32px rgba(135, 169, 107, 0.25);
    
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --radius-2xl: 28px;
    
    --font-display: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    line-height: 1.65;
    color: var(--charcoal);
    background: var(--gradient-sunset);
    min-height: 100vh;
    font-size: 15px;
}

/* コンテナ */
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
}

/* ヘッダー */
.header {
    background: rgba(250, 248, 243, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(135, 169, 107, 0.2);
    border-radius: var(--radius-2xl);
    padding: 28px 36px;
    margin-bottom: 36px;
    box-shadow: var(--shadow-medium);
}

.header > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-sage) 0%, var(--primary-coral) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1rem;
    color: var(--medium-gray);
    margin: 0;
    font-weight: 500;
}

/* ヘッダー右側のユーザー情報 */
.header .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header .user-details {
    text-align: right;
}

.header .user-name {
    font-weight: 600;
    color: var(--primary-sage) !important;
    font-size: 1rem;
}

.header .user-plan {
    font-size: 0.875rem;
    color: var(--medium-gray) !important;
    margin-top: 2px;
}

/* カード */
.card {
    background: var(--gradient-warm);
    border-radius: var(--radius-xl);
    padding: 36px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(135, 169, 107, 0.1);
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-sage), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

.card:hover::after {
    opacity: 1;
}

/* フォーム要素 */
.input-field {
    width: 100%;
    padding: 18px 22px;
    border: 2px solid rgba(135, 169, 107, 0.2);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--warm-white);
    font-family: inherit;
    color: var(--charcoal);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-sage);
    box-shadow: 0 0 0 4px var(--sage-light);
    background: white;
}

.input-field:read-only {
    background: var(--soft-gray);
    color: var(--medium-gray);
    border-color: rgba(135, 169, 107, 0.15);
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    justify-content: center;
    position: relative;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-sage) 0%, var(--primary-mint) 100%);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    filter: brightness(1.05);
}

.btn-outline {
    background: var(--warm-white);
    color: var(--primary-sage);
    border: 2px solid var(--primary-sage);
    box-shadow: 0 2px 8px rgba(135, 169, 107, 0.1);
}

.btn-outline:hover {
    background: var(--primary-sage);
    color: white;
    transform: translateY(-1px);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* アラート */
.alert {
    padding: 18px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    border-left: 4px solid;
    position: relative;
}

.alert-success {
    background: var(--mint-light);
    color: var(--success-forest);
    border-left-color: var(--success-forest);
}

.alert-error {
    background: var(--coral-light);
    color: var(--error-rose);
    border-left-color: var(--error-rose);
}

.alert-warning {
    background: var(--peach-light);
    color: var(--warning-amber);
    border-left-color: var(--warning-amber);
}

/* 統計グリッド */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--warm-white);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(135, 169, 107, 0.08);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: var(--gradient-dawn);
    transition: left 0.6s ease;
}

.stat-card:hover::before {
    left: 0;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-strong);
}

.stat-icon {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    position: relative;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--medium-gray);
    margin-top: 6px;
    font-weight: 500;
}

/* プログレスバー */
.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--soft-gray);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-dawn);
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.3) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.3) 75%,
        transparent 75%
    );
    background-size: 20px 20px;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* バッジ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: var(--gradient-dawn);
    color: white;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 10px;
    box-shadow: var(--shadow-soft);
}

/* 質問リスト */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-item {
    background: var(--warm-white);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    border: 1px solid rgba(135, 169, 107, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.question-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-coral);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.question-item:hover {
    box-shadow: var(--shadow-medium);
    transform: translateX(4px);
}

.question-item:hover::before {
    opacity: 1;
}

.question-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--charcoal);
    margin-bottom: 14px;
}

.question-meta {
    display: flex;
    gap: 24px;
    font-size: 0.9rem;
    color: var(--medium-gray);
}

/* 回答済み質問 */
.answered-questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.answered-question-item {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.answered-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-sage);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.answered-text {
    color: var(--charcoal);
    line-height: 1.6;
}

.answered-meta {
    display: flex;
    gap: 24px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--medium-gray);
    margin-top: 12px;
}

.answered-link {
    color: var(--primary-sage);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.answered-link:hover {
    color: var(--primary-coral);
    transform: translateX(3px);
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 58, 54, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--warm-white);
    border-radius: var(--radius-xl);
    max-width: 640px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(135, 169, 107, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 36px;
    border-bottom: 1px solid rgba(135, 169, 107, 0.15);
    background: var(--sage-light);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-sage);
    font-weight: 700;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--medium-gray);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(135, 169, 107, 0.1);
    color: var(--primary-sage);
}

.detail-content {
    background: var(--soft-gray);
    padding: 20px;
    border-radius: var(--radius-md);
    line-height: 1.6;
    margin-bottom: 14px;
    color: var(--charcoal);
    border: 1px solid rgba(135, 169, 107, 0.1);
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 28px 0;
}

.pagination-info {
    color: var(--medium-gray);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0 20px;
}

/* 無視した質問 */
.ignored-item {
    opacity: 0.65;
    background: var(--soft-gray) !important;
}

.ignored-text {
    color: var(--medium-gray);
    text-decoration: line-through;
}

/* フッター */
.container > div:last-child {
    text-align: center;
    margin-top: 40px;
    padding: 24px;
    color: rgba(250, 248, 243, 0.8) !important;
    background: rgba(250, 248, 243, 0.1);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
}

.container > div:last-child p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* アニメーション */
@keyframes gentleFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: gentleFadeIn 0.8s ease-out;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .header {
        padding: 24px 28px;
    }
    
    .header > div {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center;
    }
    
    .header .user-details {
        text-align: center;
    }
    
    .card {
        padding: 28px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .question-item {
        flex-direction: column;
        gap: 20px;
        padding: 24px;
    }
    
    .question-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .answered-question-item {
        flex-direction: column;
        gap: 20px;
    }
    
    .answered-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .question-actions {
        flex-direction: column;
    }
    
    .question-actions .btn,
    .answered-actions .btn {
        width: 100%;
    }
}

    /* テンプレートプレビュー関連のスタイル - 修正版 */
#templatePreview {
    position: relative;
    transition: all 0.3s ease;
    max-width: 100%;
    overflow: hidden;
}

#templatePreview:hover {
    transform: scale(1.02);
}

#previewImage {
    transition: opacity 0.3s ease;
    max-width: 100%;
    height: auto;
    display: block;
}

.template-option {
    position: relative;
    overflow: hidden;
}

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

.template-option:hover::before {
    left: 100%;
}

/* テンプレート選択エリアのレスポンシブ対応 */
#imageTemplateOptions {
    overflow-x: auto;
}

/* レスポンシブ対応の強化 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .card {
        padding: 20px;
    }
    
    #imageTemplateOptions {
        padding: 15px;
        margin-top: 10px;
    }
    
    /* プレビュー画像のサイズ調整 */
    #previewImage {
        width: 100%;
        max-width: 280px;
        height: auto;
        aspect-ratio: 3/2;
        object-fit: cover;
    }
    
    #templatePreview {
        max-width: 100%;
        margin: 0 auto;
    }
    
    /* テンプレート選択グリッドの調整 */
    #imageTemplateOptions > div:last-of-type {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 6px;
    }
    
    .template-option {
        padding: 6px;
        min-width: 0;
    }
    
    .template-option span {
        font-size: 0.65rem;
        line-height: 1.1;
    }
    
    /* プレビューエリア全体の調整 */
    #imageTemplateOptions > div:first-of-type {
        margin-bottom: 15px;
    }
    
    /* ボタンの調整 */
    #refreshPreview,
    #previewWithQuestion {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    #imageTemplateOptions {
        padding: 12px;
    }
    
    /* より小さい画面でのプレビュー */
    #previewImage {
        width: 100%;
        max-width: 240px;
        height: auto;
    }
    
    /* テンプレート選択をより小さく */
    #imageTemplateOptions > div:last-of-type {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    
    .template-option {
        padding: 4px;
    }
    
    .template-option span {
        font-size: 0.6rem;
    }
    
    .template-option div {
        width: 24px !important;
        height: 14px !important;
    }
    
    /* プレビューボタンを縦並びに */
    #imageTemplateOptions > div:nth-last-child(2) {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    #refreshPreview,
    #previewWithQuestion {
        width: 100%;
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    /* フォーム全体の調整 */
    .question-actions {
        flex-direction: column;
    }
    
    .question-actions .btn,
    .answered-actions .btn {
        width: 100%;
    }
    
    /* 入力フィールドの調整 */
    .input-field {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    /* ボタンの調整 */
    .btn {
        padding: 12px 20px;
        font-size: 0.85rem;
    }
    
    .btn-small {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

/* 横向きスマホ対応 */
@media (max-width: 768px) and (orientation: landscape) {
    #previewImage {
        max-width: 200px;
    }
    
    #imageTemplateOptions > div:last-of-type {
        grid-template-columns: repeat(7, 1fr);
    }
}

/* 非常に小さい画面（古いスマホ等） */
@media (max-width: 360px) {
    #previewImage {
        max-width: 200px;
    }
    
    #imageTemplateOptions > div:last-of-type {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .template-option span {
        font-size: 0.55rem;
    }
}