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

/* 基本スタイル */
body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    opacity: 0.8;
}

/* メインコンテンツ */
.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* ヒーローセクション */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* 俳句一覧 */
.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
    color: #333;
}

.haiku-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* PC: 3カラム */
@media (min-width: 1024px) {
    .haiku-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* SP: 1カラム */
@media (max-width: 768px) {
    .haiku-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .nav-list {
        gap: 1rem;
    }
}

/* 俳句カード */
.haiku-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.haiku-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.haiku-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.haiku-content {
    padding: 1.5rem;
}

.haiku-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    text-align: center;
    white-space: pre-line;
}

.haiku-author {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    text-align: right;
}

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

.like-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #ccc;
    transition: color 0.3s ease;
}

.like-btn:hover {
    color: #ff6b6b;
}

.like-btn.liked {
    color: #ff6b6b;
}

.like-count {
    font-size: 0.9rem;
    color: #666;
}

/* もっと見るボタン */
.load-more-container {
    text-align: center;
}

.load-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* フッター */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* エラーメッセージ */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    text-align: center;
}

/* 成功メッセージ */
.success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    text-align: center;
}

/* アバウトページ専用スタイル */
.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.concept-section,
.rules-section,
.examples-section,
.howto-section,
.cta-section {
    margin-bottom: 3rem;
}

.concept-section h3,
.rules-section h3,
.examples-section h3,
.howto-section h3,
.cta-section h3 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #333;
}

.concept-box,
.rules-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.concept-box h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #667eea;
}

.concept-box p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.rules-box {
    display: grid;
    gap: 1.5rem;
}

.rule-item {
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.rule-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.rule-item p {
    margin: 0;
    line-height: 1.6;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.example-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.example-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    white-space: pre-line;
    color: #333;
}

.example-description {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.howto-steps {
    display: grid;
    gap: 1.5rem;
}

.step {
    display: flex;
    align-items: flex-start;
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.step-content p {
    margin: 0;
    line-height: 1.6;
    color: #666;
}

.cta-section {
    text-align: center;
    background: white;
    padding: 3rem 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cta-section h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .concept-box,
    .rules-box {
        padding: 1.5rem;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .cta-section {
        padding: 2rem 1rem;
    }
    
    .cta-section h3 {
        font-size: 1.5rem;
    }
}

/* 投稿フォーム専用スタイル */
.submit-content {
    max-width: 600px;
    margin: 0 auto;
}

.form-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 3rem;
}

.haiku-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.char-count {
    position: absolute;
    right: 0.75rem;
    top: 2.2rem;
    font-size: 0.8rem;
    color: #666;
}

.char-count.warning {
    color: #ff6b6b;
}

.help-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
}

.preview-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.preview-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.haiku-preview {
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 5px;
    border: 2px dashed #ccc;
    white-space: pre-line;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.clear-btn,
.submit-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e0e0e0;
}

.clear-btn:hover {
    background: #e9ecef;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submission-status {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.status-content {
    background: white;
    padding: 3rem;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.status-content .spinner {
    margin: 0 auto 1rem;
}

.status-content p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.status-detail {
    font-size: 0.9rem;
    color: #666;
}

.tips-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.tips-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #333;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.tip-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.tip-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #666;
    margin: 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .clear-btn,
    .submit-btn {
        width: 100%;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .status-content {
        padding: 2rem;
    }
}

/* 表示チラつき防止のための改善 */
.haiku-grid {
    min-height: 200px; /* 最小高さを設定してレイアウトシフトを防止 */
}

.haiku-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

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

/* ローディング状態の改善 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* エラーメッセージと成功メッセージの改善 */
.error-message,
.success-message {
    animation: slideDown 0.3s ease;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
}

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

/* フォームの改善 */
.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ボタンの改善 */
.like-btn {
    transition: all 0.2s ease;
}

.like-btn:hover {
    transform: scale(1.1);
}

.like-btn.liked {
    animation: heartBeat 0.6s ease;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* レスポンシブ改善 */
@media (max-width: 768px) {
    .haiku-grid {
        gap: 1rem;
    }
    
    .haiku-card {
        margin-bottom: 1rem;
    }
}

/* プレースホルダー画像の改善 */
.haiku-image {
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
}

/* 空状態の改善 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: #333;
}

.empty-state a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* 実際のAI画像生成ページ用スタイル */
.warning-box {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.warning-box h3 {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.warning-box p {
    color: #856404;
    margin-bottom: 0.5rem;
}

.warning-box ul {
    color: #856404;
    margin-left: 1.5rem;
}

.warning-box li {
    margin-bottom: 0.25rem;
}

/* ナビゲーションの改善 */
.nav-list {
    display: flex;
    list-style: none;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .nav-list {
        gap: 0.5rem;
    }
    
    .nav-list li {
        font-size: 0.9rem;
    }
}

/* 翻訳機能付きページ用スタイル */
.info-box {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.info-box h3 {
    color: #1565c0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.info-box p {
    color: #1565c0;
    margin-bottom: 0.5rem;
}

.info-box ul {
    color: #1565c0;
    margin-left: 1.5rem;
}

.info-box li {
    margin-bottom: 0.25rem;
}

/* ナビゲーションの改善（複数リンク対応） */
.nav-list {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-list li {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .nav-list {
        gap: 0.25rem;
    }
    
    .nav-list li {
        font-size: 0.8rem;
    }
}

/* 成功メッセージ内の翻訳結果表示 */
.success-message pre {
    background: #f0f0f0;
    padding: 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* 翻訳表示用スタイル */
.haiku-translation {
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: #f0f8ff;
    border-radius: 5px;
    border-left: 3px solid #4a90e2;
}

.translation-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a90e2;
    margin-bottom: 0.25rem;
}

.translation-text {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.6;
    white-space: pre-line;
    font-style: italic;
}

/* 空状態のリンク改善 */
.empty-state a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 2px solid #667eea;
    border-radius: 20px;
    display: inline-block;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.empty-state a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}
