/**
 * ファイル名: homepage-builder-pro/css/homepage-builder-style.css
 * ホームページビルダープロ - メインスタイルシート（完全書き直し版）
 * ヘッダータブ形式対応、アンカー機能付き
 */

/* ========================================
   リセット・基本設定
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hbp-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
    background-color: #f5f5f7;
    color: #333;
    max-width: 100%;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* ========================================
   ヘッダー
======================================== */
.hbp-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hbp-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
    font-weight: 600;
}

.hbp-header p {
    opacity: 0.9;
    font-size: 14px;
    margin-bottom: 10px;
}

.hbp-header-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hbp-header-actions button {
    transition: all 0.3s ease;
}

.hbp-header-actions button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ========================================
   ステップ1: 一括入力エリア
======================================== */
.hbp-step-1 {
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.hbp-step-1 h2 {
    font-size: 28px;
    margin-bottom: 15px;
    font-weight: 600;
}

.hbp-step-1 p {
    font-size: 16px;
    margin-bottom: 30px;
    opacity: 0.9;
    line-height: 1.6;
}

.hbp-bulk-input {
    max-width: 800px;
    margin: 0 auto;
}

.hbp-bulk-textarea {
    width: 100%;
    height: 300px;
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    font-family: inherit;
    line-height: 1.5;
}

.hbp-bulk-textarea:focus {
    outline: none;
    box-shadow: 0 4px 25px rgba(0,0,0,0.15);
}

.hbp-analyze-btn {
    margin-top: 20px;
    padding: 15px 40px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.hbp-analyze-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.hbp-analyze-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========================================
   ステップ2: ヘッダータブ形式レイアウト
======================================== */
.hbp-step-2 {
    display: none;
    background: #f8f9fa;
    min-height: calc(100vh - 160px);
}

.hbp-step-2.active {
    display: block;
}

/* ========================================
   セクションタブヘッダー（新規）
======================================== */
.hbp-section-tabs-header {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 88px; /* ヘッダーの高さ分調整 */
    z-index: 100;
}

.hbp-section-tabs-container {
    display: flex;
    overflow-x: auto;
    padding: 0;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.hbp-section-tabs-container::-webkit-scrollbar {
    height: 4px;
}

.hbp-section-tabs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.hbp-section-tabs-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.hbp-section-tabs-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.hbp-section-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: none;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    min-width: 100px;
    position: relative;
    text-decoration: none;
    color: #666;
    font-size: 12px;
}

.hbp-section-tab:hover {
    background: #f8f9fa;
    color: #333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hbp-section-tab.active {
    background: #f0f2ff;
    border-bottom-color: #667eea;
    color: #667eea;
    font-weight: 600;
}

.hbp-section-tab.active .hbp-tab-icon {
    transform: scale(1.1);
}

.hbp-tab-icon {
    font-size: 20px;
    margin-bottom: 4px;
    display: block;
    transition: transform 0.3s ease;
}

.hbp-tab-title {
    font-size: 12px;
    font-weight: 500;
    display: block;
    text-align: center;
    line-height: 1.2;
}

/* タブの未読通知（将来的な拡張用） */
.hbp-section-tab::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: #e74c3c;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hbp-section-tab.has-changes::after {
    opacity: 1;
}

/* ========================================
   2カラムレイアウト（修正版）
======================================== */
.hbp-two-column-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 300px);
    min-height: 600px;
    padding: 0 20px;
}

/* ========================================
   プレビューエリア
======================================== */
.hbp-preview-area {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hbp-preview-content {
    position: relative;
}

/* プレビューセクションのアンカーハイライト */
.hbp-section-preview {
    position: relative;
    scroll-margin-top: 20px;
    transition: all 0.3s ease;
    border-bottom: 2px solid #eee;
}

.hbp-section-preview:last-child {
    border-bottom: none;
}

.hbp-section-preview.highlighted {
    background: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    animation: highlightPulse 1.5s ease-in-out;
    border-radius: 8px;
    margin: 2px;
}

@keyframes highlightPulse {
    0%, 100% { 
        background: #fff3cd !important; 
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.4);
    }
    25% { 
        background: #ffecb5 !important; 
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.6);
    }
    50% { 
        background: #ffe69c !important; 
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
    75% { 
        background: #ffecb5 !important; 
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.6);
    }
}

/* プレビューのホバー効果 */
.hbp-section-preview:hover {
    background: #f8f9ff !important;
    cursor: pointer;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* セクションラベル（プレビュー用） */
.hbp-section-preview::before {
    content: attr(data-section);
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ========================================
   エディターエリア
======================================== */
.hbp-editor-area {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hbp-editor-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.hbp-editor-header h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

.hbp-editor-header p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ========================================
   エディタータブ
======================================== */
.hbp-editor-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    background: #f8f9fa;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}

.hbp-editor-tab {
    padding: 12px 20px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    color: #666;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
    text-align: center;
}

.hbp-editor-tab:hover {
    color: #333;
    background: #e9ecef;
}

.hbp-editor-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
    font-weight: 600;
}

.hbp-editor-tab-content {
    display: none;
}

.hbp-editor-tab-content.active {
    display: block;
}

/* ========================================
   フォーム要素
======================================== */
.hbp-form-group {
    margin-bottom: 20px;
}

.hbp-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.9rem;
}

.hbp-form-group input,
.hbp-form-group textarea,
.hbp-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
    background: white;
}

.hbp-form-group input:focus,
.hbp-form-group textarea:focus,
.hbp-form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.hbp-form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.hbp-form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.8rem;
}

/* ========================================
   項目管理
======================================== */
.hbp-items-container {
    margin-bottom: 15px;
}

.hbp-item-row {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 15px;
    position: relative;
    transition: all 0.3s ease;
}

.hbp-item-row:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.hbp-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hbp-delete-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* ========================================
   ボタン類
======================================== */
.hbp-save-btn,
.hbp-add-item-btn,
.hbp-output-btn,
.hbp-import-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.hbp-save-btn:hover,
.hbp-add-item-btn:hover,
.hbp-output-btn:hover,
.hbp-import-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.hbp-add-item-btn {
    width: 100%;
    margin-bottom: 15px;
    justify-content: center;
    background: #28a745;
}

.hbp-add-item-btn:hover {
    background: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.hbp-save-btn {
    width: 100%;
    justify-content: center;
}

.hbp-import-btn {
    width: 100%;
    background: #17a2b8;
    justify-content: center;
}

.hbp-import-btn:hover {
    background: #138496;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

/* ========================================
   インポートセクション
======================================== */
.hbp-import-section {
    margin-top: 30px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow: hidden;
}

.hbp-import-header {
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    transition: background 0.3s ease;
    font-weight: 600;
    font-size: 14px;
}

.hbp-import-header:hover {
    background: #e9ecef;
}

.hbp-import-header.collapsed .hbp-toggle-icon {
    transform: rotate(-90deg);
}

.hbp-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
    color: #666;
}

.hbp-import-body {
    padding: 20px;
}

.hbp-import-body textarea {
    width: 100%;
    height: 120px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    background: #f8f9fa;
}

/* ========================================
   最終出力ボタン
======================================== */
.hbp-final-output {
    text-align: center;
    padding: 30px 20px;
    background: white;
    border-top: 1px solid #ddd;
}

.hbp-output-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    font-weight: 600;
}

.hbp-output-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* ========================================
   モーダル
======================================== */
.hbp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.hbp-modal.active {
    display: flex;
}

.hbp-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 800px;
}

.hbp-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
}

.hbp-modal-header h3 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.hbp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.hbp-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.hbp-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.hbp-code-output {
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    margin: 20px;
    line-height: 1.4;
}

.hbp-copy-code-btn {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    margin-right: 10px;
}

.hbp-copy-code-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

/* ========================================
   通知システム
======================================== */
.hbp-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10000;
    font-weight: 600;
    max-width: 400px;
    word-wrap: break-word;
    animation: slideInRight 0.3s ease;
}

.hbp-notification.hbp-success {
    background: #4CAF50;
    color: white;
}

.hbp-notification.hbp-error {
    background: #f44336;
    color: white;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   パターン選択エリア
======================================== */
.hbp-css-pattern-mini {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.hbp-css-pattern-selector {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hbp-pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.hbp-pattern-option {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
    overflow: hidden;
}

.hbp-pattern-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.hbp-pattern-option.active {
    border-color: #667eea;
    background: #f0f2ff;
}

.pattern-preview {
    width: 100%;
    height: 40px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    opacity: 0.8;
}

/* ========================================
   レスポンシブ対応
======================================== */
@media (max-width: 1200px) {
    .hbp-two-column-layout {
        grid-template-columns: 1fr 350px;
    }
}

@media (max-width: 1024px) {
    .hbp-two-column-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 400px;
        height: auto;
        min-height: 800px;
    }
    
    .hbp-section-tab {
        min-width: 80px;
        padding: 10px 12px;
    }
    
    .hbp-tab-icon {
        font-size: 18px;
    }
    
    .hbp-tab-title {
        font-size: 11px;
    }
    
    .hbp-editor-area {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .hbp-container {
        padding: 0;
    }
    
    .hbp-header {
        padding: 15px;
    }
    
    .hbp-header h1 {
        font-size: 20px;
    }
    
    .hbp-header-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .hbp-section-tabs-container {
        padding: 0 10px;
    }
    
    .hbp-section-tab {
        min-width: 70px;
        padding: 8px 10px;
    }
    
    .hbp-tab-icon {
        font-size: 16px;
    }
    
    .hbp-tab-title {
        font-size: 10px;
    }
    
    .hbp-two-column-layout {
        padding: 0 10px;
        gap: 15px;
        height: auto;
        min-height: 600px;
    }
    
    .hbp-editor-area {
        padding: 15px;
        max-height: 350px;
    }
    
    .hbp-modal-content {
        width: 95%;
        max-width: none;
    }
    
    .hbp-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .hbp-step-1 {
        padding: 30px 15px;
    }
    
    .hbp-step-1 h2 {
        font-size: 24px;
    }
    
    .hbp-bulk-textarea {
        height: 200px;
        padding: 12px;
        font-size: 13px;
    }
    
    .hbp-analyze-btn {
        padding: 10px 25px;
        font-size: 14px;
    }
}

/* ========================================
   アクセシビリティ対応
======================================== */
@media (prefers-reduced-motion: reduce) {
    .hbp-section-tab,
    .hbp-save-btn,
    .hbp-output-btn,
    .hbp-item-row,
    .hbp-pattern-option {
        transition: none;
    }
    
    .hbp-section-tab:hover,
    .hbp-save-btn:hover,
    .hbp-output-btn:hover,
    .hbp-pattern-option:hover {
        transform: none;
    }
    
    .highlighted {
        animation: none;
        background: #fff3cd !important;
    }
}

@media (prefers-color-scheme: dark) {
    .hbp-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .hbp-step-2 {
        background: #1a1a1a;
    }
    
    .hbp-preview-area,
    .hbp-editor-area,
    .hbp-modal-content,
    .hbp-import-section,
    .hbp-css-pattern-selector {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .hbp-section-tabs-header {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .hbp-section-tab {
        background: #2d2d2d;
        color: #b0b0b0;
        border-bottom: 3px solid transparent;
    }
    
    .hbp-section-tab:hover {
        background: #404040;
        color: #e0e0e0;
    }
    
    .hbp-section-tab.active {
        background: #3d3d5c;
        color: #8a9bea;
    }
    
    .hbp-form-group input,
    .hbp-form-group select,
    .hbp-form-group textarea {
        background: #404040;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .hbp-form-group input:focus,
    .hbp-form-group select:focus,
    .hbp-form-group textarea:focus {
        border-color: #8a9bea;
        box-shadow: 0 0 0 3px rgba(138, 155, 234, 0.2);
    }
    
    .hbp-item-row {
        background: #333;
        border-color: #555;
    }
    
    .hbp-import-header {
        background: #404040;
        border-color: #555;
    }
    
    .hbp-import-body textarea,
    .hbp-code-output {
        background: #404040;
        color: #e0e0e0;
        border-color: #555;
    }
    
    .hbp-pattern-option {
        background: #333;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .hbp-pattern-option.active {
        background: #3d3d5c;
        border-color: #8a9bea;
    }
}

/* ========================================
   印刷対応
======================================== */
@media print {
    .hbp-section-tabs-header,
    .hbp-editor-area,
    .hbp-final-output,
    .hbp-notification,
    .hbp-header-actions {
        display: none;
    }
    
    .hbp-two-column-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .hbp-preview-area {
        border: none;
        box-shadow: none;
        overflow: visible;
    }
    
    .hbp-section-preview::before {
        display: none;
    }
}

/* ========================================
   カスタムスクロールバー
======================================== */
.hbp-preview-area::-webkit-scrollbar,
.hbp-editor-area::-webkit-scrollbar,
.hbp-code-output::-webkit-scrollbar {
    width: 8px;
}

.hbp-preview-area::-webkit-scrollbar-track,
.hbp-editor-area::-webkit-scrollbar-track,
.hbp-code-output::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.hbp-preview-area::-webkit-scrollbar-thumb,
.hbp-editor-area::-webkit-scrollbar-thumb,
.hbp-code-output::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.hbp-preview-area::-webkit-scrollbar-thumb:hover,
.hbp-editor-area::-webkit-scrollbar-thumb:hover,
.hbp-code-output::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ========================================
   ローディングアニメーション
======================================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hbp-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* ========================================
   フェードイン・アニメーション
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hbp-step-2 {
    animation: fadeIn 0.5s ease-out;
}

/* ========================================
   パターン選択の詳細スタイル
======================================== */
.hbp-pattern-selector {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.hbp-pattern-selector h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.hbp-pattern-options {
    display: flex;
    gap: 10px;
}

.hbp-pattern-btn {
    flex: 1;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    transition: all 0.3s ease;
}

.hbp-pattern-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ========================================
   パフォーマンス最適化
======================================== */
.hbp-section-tab,
.hbp-item-row,
.hbp-pattern-option {
    will-change: transform;
}

.hbp-preview-content,
.hbp-editor-area {
    contain: layout style paint;
}

/* ========================================
   高DPI対応
======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hbp-section-tab,
    .hbp-item-row,
    .hbp-pattern-option {
        border-width: 0.5px;
    }
    
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ========================================
   タッチデバイス対応
======================================== */
@media (hover: none) and (pointer: coarse) {
    .hbp-section-tab,
    .hbp-save-btn,
    .hbp-add-item-btn,
    .hbp-output-btn,
    .hbp-delete-btn {
        min-height: 44px;
    }
    
    .hbp-section-tab:hover,
    .hbp-save-btn:hover,
    .hbp-output-btn:hover {
        transform: none;
    }
    
    .hbp-section-tab:active,
    .hbp-save-btn:active,
    .hbp-output-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ========================================
   フォーカス管理（キーボードナビゲーション）
======================================== */
.hbp-section-tab:focus,
.hbp-save-btn:focus,
.hbp-add-item-btn:focus,
.hbp-output-btn:focus,
.hbp-form-group input:focus,
.hbp-form-group textarea:focus,
.hbp-form-group select:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* ========================================
   ユーティリティクラス
======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden { display: none; }
.visible { visibility: visible; }

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

.border-radius { border-radius: 6px; }
.shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.shadow-md { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

/* ========================================
   CSS変数（カスタムプロパティ）
======================================== */
:root {
    --hbp-primary-color: #667eea;
    --hbp-primary-hover: #5a6fd8;
    --hbp-success-color: #28a745;
    --hbp-danger-color: #e74c3c;
    --hbp-warning-color: #ffc107;
    --hbp-info-color: #17a2b8;
    
    --hbp-text-primary: #333;
    --hbp-text-secondary: #666;
    --hbp-text-muted: #999;
    
    --hbp-bg-primary: #ffffff;
    --hbp-bg-secondary: #f8f9fa;
    --hbp-bg-tertiary: #e9ecef;
    
    --hbp-border-color: #ddd;
    --hbp-border-light: #e9ecef;
    
    --hbp-shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --hbp-shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --hbp-shadow-lg: 0 8px 16px rgba(0,0,0,0.1);
    
    --hbp-radius-sm: 4px;
    --hbp-radius-md: 6px;
    --hbp-radius-lg: 8px;
    --hbp-radius-xl: 12px;
    
    --hbp-font-size-xs: 0.75rem;
    --hbp-font-size-sm: 0.875rem;
    --hbp-font-size-base: 1rem;
    --hbp-font-size-lg: 1.125rem;
    --hbp-font-size-xl: 1.25rem;
    
    --hbp-spacing-xs: 0.25rem;
    --hbp-spacing-sm: 0.5rem;
    --hbp-spacing-md: 1rem;
    --hbp-spacing-lg: 1.5rem;
    --hbp-spacing-xl: 2rem;
    
    --hbp-transition: all 0.3s ease;
    --hbp-transition-fast: all 0.15s ease;
}

/* ダークモード時の変数更新 */
@media (prefers-color-scheme: dark) {
    :root {
        --hbp-text-primary: #e0e0e0;
        --hbp-text-secondary: #b0b0b0;
        --hbp-text-muted: #888;
        
        --hbp-bg-primary: #1a1a1a;
        --hbp-bg-secondary: #2d2d2d;
        --hbp-bg-tertiary: #404040;
        
        --hbp-border-color: #404040;
        --hbp-border-light: #555;
    }
}

/* ========================================
   CSS読み込み完了マーカー
======================================== */
html {
    --hbp-admin-css-loaded: true;
    --hbp-tab-system-loaded: true;
}

/* ========================================
   デバッグ用スタイル（開発時のみ）
======================================== */
/* 
.hbp-debug {
    border: 2px dashed red !important;
}

.hbp-debug::before {
    content: 'DEBUG: ' attr(class);
    position: absolute;
    top: -20px;
    left: 0;
    background: red;
    color: white;
    padding: 2px 4px;
    font-size: 10px;
    z-index: 9999;
}
*/: 250px;
        padding: 15px;
    }
    
    .hbp-analyze-btn {
        padding: 12px 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .hbp-header h1 {
        font-size: 18px;
    }
    
    .hbp-section-tab {
        min-width: 60px;
        padding: 6px 8px;
    }
    
    .hbp-tab-icon {
        font-size: 14px;
    }
    
    .hbp-tab-title {
        font-size: 9px;
    }
    
    .hbp-two-column-layout {
        grid-template-rows: 1fr 300px;
        min-height: 500px;
    }
    
    .hbp-editor-area {
        max-height: 300px;
        padding: 12px;
    }
    
    .hbp-step-1 h2 {
        font-size: 20px;
    }
    
    .hbp-step-1 p {
        font-size: 14px;
    }
}    

/* ========================================
   アニメーション
======================================== */

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.hbp-step-2 {
    animation: fadeIn 0.5s ease-out;
}

.hbp-notification {
    animation: slideIn 0.3s ease-out;
}