/* プレビューセクションのスタイル */
.preview-section {
    margin-bottom: 30px;
}

.preview-section h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-section h3::before {
    content: "👁️";
}

.preview-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    max-height: 500px;
    overflow: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-content {
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Markdown要素のスタイル */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    margin: 24px 0 16px 0;
    font-weight: 600;
    line-height: 1.25;
    color: #24292e;
}

.preview-content h1 {
    font-size: 2rem;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 10px;
}

.preview-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 8px;
}

.preview-content h3 {
    font-size: 1.25rem;
}

.preview-content h4 {
    font-size: 1rem;
}

.preview-content h5 {
    font-size: 0.875rem;
}

.preview-content h6 {
    font-size: 0.85rem;
    color: #6a737d;
}

.preview-content p {
    margin: 16px 0;
}

.preview-content blockquote {
    margin: 16px 0;
    padding: 0 16px;
    color: #6a737d;
    border-left: 4px solid #dfe2e5;
}

.preview-content ul,
.preview-content ol {
    margin: 16px 0;
    padding-left: 2em;
}

.preview-content li {
    margin: 4px 0;
}

.preview-content li + li {
    margin-top: 4px;
}

.preview-content code {
    background: #f6f8fa;
    border-radius: 3px;
    font-size: 85%;
    margin: 0 2px;
    padding: 3px 5px;
    font-family: 'SFMono-Regular', 'Monaco', 'Consolas', monospace;
}

.preview-content pre {
    background: #f6f8fa;
    border-radius: 6px;
    font-size: 85%;
    line-height: 1.45;
    overflow: auto;
    padding: 16px;
    margin: 16px 0;
}

.preview-content pre code {
    background: transparent;
    border: 0;
    font-size: 100%;
    margin: 0;
    padding: 0;
}

.preview-content table {
    border-collapse: collapse;
    border-spacing: 0;
    margin: 16px 0;
    width: 100%;
}

.preview-content table th,
.preview-content table td {
    border: 1px solid #dfe2e5;
    padding: 6px 13px;
}

.preview-content table th {
    background: #f6f8fa;
    font-weight: 600;
}

.preview-content table tr:nth-child(2n) {
    background: #f6f8fa;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 8px 0;
}

.preview-content hr {
    height: 4px;
    margin: 24px 0;
    background: #e1e4e8;
    border: 0;
    border-radius: 2px;
}

.preview-content a {
    color: #0366d6;
    text-decoration: none;
}

.preview-content a:hover {
    text-decoration: underline;
}

/* チェックリスト */
.preview-content input[type="checkbox"] {
    margin-right: 8px;
}

/* 変換セクション */
.convert-section {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid #e9ecef;
}

.convert-btn {
    position: relative;
    min-height: 48px;
    font-size: 1.1rem;
    padding: 14px 32px;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* プレビューローディング */
.preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #6c757d;
    flex-direction: column;
    gap: 16px;
}

.preview-loading::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* エラー状態 */
.preview-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #dc3545;
    flex-direction: column;
    gap: 16px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    margin: 16px 0;
}

.preview-error::before {
    content: "⚠️";
    font-size: 2rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .preview-container {
        max-height: 400px;
    }
    
    .preview-content {
        padding: 20px;
    }
    
    .preview-content h1 {
        font-size: 1.75rem;
    }
    
    .preview-content h2 {
        font-size: 1.5rem;
    }
    
    .convert-section {
        padding: 20px 0;
    }
    
    .convert-btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .preview-content {
        padding: 15px;
    }
    
    .preview-content h1 {
        font-size: 1.5rem;
    }
    
    .preview-content h2 {
        font-size: 1.25rem;
    }
    
    .preview-content table {
        font-size: 0.875rem;
    }
    
    .preview-content pre {
        font-size: 0.8rem;
        padding: 12px;
    }
}