/* 基本スタイル */
.subtitle {
    text-align: center;
    color: #64748b;
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

/* 設定セクション */
.settings-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

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

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.setting-select {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* メインフォーマッターセクション */
.formatter-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.formatter-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    min-height: 500px;
}

/* パネル共通スタイル */
.input-panel,
.output-panel {
    display: flex;
    flex-direction: column;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
}

.panel-header {
    background: #1f2937;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.panel-icon {
    width: 18px;
    height: 18px;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #374151;
    border-radius: 6px;
    background: #4b5563;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.action-btn:hover {
    background: #6b7280;
    transform: translateY(-1px);
}

.action-btn.clear-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.action-btn.copy-btn:hover {
    background: #059669;
    border-color: #059669;
}

.action-btn.copy-btn.copied {
    background: #059669;
    border-color: #059669;
}

.action-btn.paste-btn:hover {
    background: #7c3aed;
    border-color: #7c3aed;
}

.action-btn.download-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-icon {
    width: 14px;
    height: 14px;
}

/* コードコンテナ */
.code-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.code-textarea {
    flex: 1;
    padding: 1rem;
    border: none;
    resize: none;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: white;
    color: #1f2937;
    min-height: 400px;
}

.code-textarea:focus {
    outline: none;
}

.code-textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.code-info {
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
}

/* 整形コントロール */
.format-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.format-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.format-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.format-btn:active {
    transform: translateY(0);
}

.format-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.format-icon {
    width: 20px;
    height: 20px;
}

.format-status {
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.5rem;
}

.format-status.success {
    color: #059669;
    font-weight: 600;
}

.format-status.error {
    color: #dc2626;
    font-weight: 600;
}

.format-status.processing {
    color: #7c3aed;
    font-weight: 600;
}

/* サンプルセクション */
.samples-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

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

.sample-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.sample-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
}

.sample-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sample-language {
    background: #1f2937;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.sample-load-btn {
    padding: 0.25rem 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.sample-load-btn:hover {
    background: #2563eb;
}

.sample-preview {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 説明セクション */
.action-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .formatter-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .format-controls {
        flex-direction: row;
        justify-content: center;
    }
    
    .format-btn {
        transform: none;
    }
    
    .format-btn:hover {
        transform: none;
    }
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .panel-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .action-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }
    
    .code-textarea {
        font-size: 0.8rem;
        min-height: 300px;
    }
    
    .format-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .samples-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .formatter-section,
    .settings-section,
    .samples-section,
    .action-section {
        padding: 1.5rem;
    }
    
    .panel-header {
        padding: 0.75rem;
    }
    
    .code-textarea {
        padding: 0.75rem;
        min-height: 250px;
    }
    
    .code-info {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .format-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .sample-item {
        padding: 0.75rem;
    }
}

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

.sample-item {
    animation: fadeIn 0.3s ease-out;
}

/* ローディング状態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* コード整形結果のハイライト */
.code-textarea.formatted {
    background: #f0fdf4;
    border: 2px solid #22c55e;
}

.code-textarea.error {
    background: #fef2f2;
    border: 2px solid #ef4444;
}

/* スクロールバーのカスタマイズ */
.code-textarea::-webkit-scrollbar {
    width: 8px;
}

.code-textarea::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.code-textarea::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.code-textarea::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* フォーカス状態の改善 */
.input-panel:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.output-panel:focus-within {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}