/**
 * ストーリー生成機能のスタイル
 * キラキラ光るアニメーションを含む
 */

/* ========================================
   ストーリー生成セクション
   ======================================== */

.story-generation-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.story-generation-section h3 {
    color: white;
    margin: 0 0 20px 0;
    font-size: 24px;
    text-align: center;
}

.story-generation-section p {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 20px;
}

/* ========================================
   生成ボタン
   ======================================== */

.btn-generate-story {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 16px 32px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-generate-story:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.btn-generate-story:active:not(:disabled) {
    transform: translateY(0);
}

.btn-generate-story:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   ステータス表示エリア
   ======================================== */

#story-generation-status {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-align: center;
}

.status-generating,
.status-success,
.status-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.status-generating p,
.status-success p,
.status-error p {
    margin: 5px 0;
    color: #333;
}

.status-note {
    font-size: 14px;
    color: #666 !important;
}

/* ========================================
   ローディングスピナー
   ======================================== */

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   解析ボタン（通常状態）
   ======================================== */

.btn-analyze-story {
    display: none;
    padding: 16px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin: 20px 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-analyze-story:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* ========================================
   ✨ キラキラ光るアニメーション ✨
   ======================================== */

.sparkle-animation {
    animation: sparkle 1.5s ease-in-out infinite;
    position: relative;
    overflow: visible !important;
}

@keyframes sparkle {
    0%, 100% {
        box-shadow: 
            0 0 10px rgba(255, 215, 0, 0.8),
            0 0 20px rgba(255, 215, 0, 0.6),
            0 0 30px rgba(255, 215, 0, 0.4),
            0 4px 15px rgba(102, 126, 234, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 1),
            0 0 40px rgba(255, 215, 0, 0.8),
            0 0 60px rgba(255, 215, 0, 0.6),
            0 6px 25px rgba(102, 126, 234, 0.6);
        transform: scale(1.05);
    }
}

/* キラキラ効果を強調するための疑似要素 */
.sparkle-animation::before {
    content: '✨';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    animation: sparkle-left 1.5s ease-in-out infinite;
}

.sparkle-animation::after {
    content: '✨';
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    animation: sparkle-right 1.5s ease-in-out infinite;
}

@keyframes sparkle-left {
    0%, 100% {
        opacity: 0.5;
        transform: translateY(-50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
}

@keyframes sparkle-right {
    0%, 100% {
        opacity: 0.5;
        transform: translateY(-50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
}

/* ========================================
   再生成ボタン
   ======================================== */

.btn-regenerate-story {
    display: none;
    padding: 12px 30px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin: 20px 10px;
    transition: all 0.3s ease;
}

.btn-regenerate-story:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* ========================================
   ボタングループ
   ======================================== */

.story-action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* ========================================
   レスポンシブ対応
   ======================================== */

@media (max-width: 768px) {
    .story-generation-section {
        padding: 20px;
    }

    .btn-generate-story,
    .btn-analyze-story {
        font-size: 16px;
        padding: 14px 28px;
    }

    .sparkle-animation::before,
    .sparkle-animation::after {
        display: none; /* モバイルでは✨を非表示 */
    }

    .story-action-buttons {
        flex-direction: column;
    }

    .btn-analyze-story,
    .btn-regenerate-story {
        width: 100%;
        margin: 10px 0;
    }
}
