﻿/**
 * ツールバー・統合UI - 専用スタイル
 * 
 * 【適用範囲】
 * - AI機能トグルボタン
 * - 分析結果表示エリア
 * - メッセージトースト
 * - 全体的な統合調整
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #FFFFFF;
  --color-bg-card: #F9FAFB;
  --color-border: #E5E7EB;
  --color-text-main: #333B4F;
  --color-text-sub: #374151;
  --color-accent-red: #E74C3C;
  --color-accent-blue: #3498DB;
  --color-accent-green: #2ECC71;
  --color-accent-purple: #9B59B6;
  --color-accent-orange: #F39C12;
  --color-gray: #6B7280;
  --color-gray-light: #F3F4F6;
  --color-table-stripe: #F5F5F5;
}

/* === AI機能トグル === */
.ai-toggle {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.ai-toggle:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.ai-toggle:active {
    background: #d1d5db;
}

.ai-toggle.active {
    background: #dbeafe;
    color: #1e40af;
    border-color: #3b82f6;
}

.ai-toggle.disabled {
    opacity: 0.6;
    background: #fecaca;
    color: #991b1b;
    border-color: #f87171;
    cursor: not-allowed;
}

.ai-toggle.disabled:hover {
    background: #fecaca;
}

/* === 分析結果表示エリア === */
.ai-analysis-results {
    margin: 16px 0;
    padding: 0;
    display: none;
}

.ai-analysis-results.active {
    display: block;
}

.ai-analysis-results.loading {
    opacity: 0.7;
}

/* === メッセージトースト（統合版） === */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    max-width: 320px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slide-in 0.3s ease-out;
}

.message-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.message-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.message-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.message-error {
    background: #fecaca;
    color: #991b1b;
    border: 1px solid #f87171;
}

.message-toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-out;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === ツールバー拡張領域 === */
.toolbar-ai-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: #d1d5db;
    margin: 0 8px;
}

/* === 状態インジケーター === */
.ai-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #6b7280;
    padding: 2px 6px;
    border-radius: 10px;
    background: #f3f4f6;
}

.ai-status-indicator.active {
    background: #d1fae5;
    color: #065f46;
}

.ai-status-indicator.analyzing {
    background: #fef3c7;
    color: #92400e;
}

.ai-status-indicator.error {
    background: #fecaca;
    color: #991b1b;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-dot.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === 統計表示エリア === */
.ai-stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.stat-label {
    color: #6b7280;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === 分析進捗表示 === */
.analysis-progress-container {
    position: relative;
    margin: 8px 0;
}

.analysis-progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.analysis-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s ease;
    width: 0%;
}

.analysis-progress-text {
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 11px;
    color: #6b7280;
}

/* === クイックアクション === */
.quick-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.quick-action-btn {
    background: none;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.quick-action-btn:active {
    background: #e5e7eb;
}

.quick-action-btn.primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.quick-action-btn.primary:hover {
    background: #2563eb;
}

/* === ヘルプ・情報表示 === */
.ai-help-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.ai-help-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.ai-help-tooltip:hover::after {
    opacity: 1;
}

/* === エラー表示 === */
.ai-error-message {
    background: #fecaca;
    border: 1px solid #f87171;
    color: #991b1b;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 14px;
}

.error-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 2px;
}

/* === 成功表示 === */
.ai-success-message {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-icon {
    font-size: 14px;
}

/* === レイアウト調整 === */
.ai-enhanced-layout {
    position: relative;
}

.ai-enhanced-layout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6, #10b981);
    opacity: 0.3;
}

/* === 折りたたみセクション === */
.ai-collapsible-section {
    margin: 8px 0;
}

.ai-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.ai-section-header:hover {
    background: #e5e7eb;
}

.ai-section-content {
    display: none;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: white;
}

.ai-collapsible-section.expanded .ai-section-content {
    display: block;
}

.section-toggle {
    transition: transform 0.2s;
}

.ai-collapsible-section.expanded .section-toggle {
    transform: rotate(180deg);
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
    .message-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toolbar-ai-section {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin-top: 8px;
    }
    
    .ai-stats-bar {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .ai-help-tooltip::after {
        position: fixed;
        bottom: 20px;
        left: 50%;
        top: auto;
        white-space: normal;
        max-width: 200px;
    }
}

/* === アクセシビリティ対応 === */
@media (prefers-reduced-motion: reduce) {
    .message-toast,
    .status-dot.pulse,
    .analysis-progress-fill,
    .section-toggle {
        animation: none;
        transition: none;
    }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
    .ai-toggle,
    .quick-action-btn,
    .ai-section-header {
        border-width: 2px;
    }
    
    .ai-enhanced-layout::before {
        opacity: 1;
        width: 3px;
    }
}

/* === 印刷対応 === */
@media print {
    .message-toast,
    .ai-toggle,
    .quick-actions,
    .ai-help-tooltip::after {
        display: none;
    }
    
    .ai-analysis-results {
        border: 1px solid #000;
        background: white;
    }
}

.toolbar-container {
  background: var(--color-bg-card);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.toolbar-btn {
  background: var(--color-accent-blue);
  color: #fff;
  border-radius: 4px;
  border: none;
  transition: background 0.2s;
}
.toolbar-btn:hover {
  background: var(--color-accent-purple);
}

.toolbar-btn.danger {
  background: var(--color-accent-red);
}

.toolbar-btn.success {
  background: var(--color-accent-green);
}

.toolbar-btn:disabled {
  background: var(--color-gray-light);
  color: var(--color-gray);
}