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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* ヘッダー */
.header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

.logo i {
    font-size: 28px;
}

.header-nav {
    display: flex;
    gap: 12px;
}

/* メインコンテナ */
.main-container {
    max-width: 1800px;
    margin: 24px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    min-height: calc(100vh - 120px);
}

/* チャットセクション */
.chat-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    background: #fbbf24;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* メッセージエリア */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.user-avatar {
    background: #e5e7eb;
    color: #6b7280;
}

.message-content {
    flex: 1;
    max-width: 80%;
}

.bot-message .message-content {
    background: #f3f4f6;
    padding: 16px;
    border-radius: 12px 12px 12px 4px;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 4px 12px;
}

.message-content p {
    margin-bottom: 8px;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* クイックアクション */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 20px;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* チャット入力エリア */
.chat-input-container {
    padding: 20px 24px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 12px;
}

.file-upload-area {
    display: flex;
    align-items: flex-end;
}

.chat-input-wrapper {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Noto Sans JP', sans-serif;
    resize: none;
    transition: border-color 0.3s;
    max-height: 120px;
}

#chatInput:focus {
    outline: none;
    border-color: #667eea;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* アップロードファイル表示 */
.uploaded-files {
    padding: 0 24px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #e0e7ff;
    border-radius: 20px;
    font-size: 13px;
    color: #4338ca;
}

.file-chip i {
    cursor: pointer;
    transition: color 0.3s;
}

.file-chip i:hover {
    color: #dc2626;
}

/* 要件セクション */
.requirements-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: calc(100vh - 120px);
    overflow-y: auto;
}

/* パネル共通スタイル */
.requirements-panel,
.features-panel,
.estimate-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* スコープボックス */
.scope-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.scope-section:last-child {
    margin-bottom: 0;
}

.scope-box {
    border-radius: 12px;
    padding: 16px;
    border: 2px solid;
    transition: all 0.3s;
    min-height: 120px;
}

.scope-do {
    border-color: #10b981;
    background: #ecfdf5;
}

.scope-dont {
    border-color: #ef4444;
    background: #fef2f2;
}

.scope-confirm {
    border-color: #f59e0b;
    background: #fffbeb;
}

.scope-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}

.scope-header h4 {
    font-size: 14px;
    margin: 0;
    flex: 1;
}

.scope-header i {
    font-size: 18px;
}

.scope-do .scope-header i {
    color: #10b981;
}

.scope-dont .scope-header i {
    color: #ef4444;
}

.scope-future .scope-header i {
    color: #8b5cf6;
}

.scope-proposal .scope-header i {
    color: #06b6d4;
}

.scope-confirm .scope-header i {
    color: #f59e0b;
}

.count {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
}

.scope-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scope-list li {
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.scope-list li.has-conflict {
    border: 2px solid #fbbf24;
    background: #fffbeb;
    animation: pulse-warning 2s infinite;
}

.scope-list li.has-ambiguity {
    border: 2px solid #a78bfa;
    background: #f5f3ff;
    animation: pulse-ambiguity 2s infinite;
}

@keyframes pulse-ambiguity {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(167, 139, 250, 0);
    }
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(251, 191, 36, 0);
    }
}

.scope-list li:hover:not(.empty-state) {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scope-list li.has-conflict:hover {
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.scope-list li.has-ambiguity:hover {
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.4);
}

.empty-state {
    color: #9ca3af;
    font-style: italic;
    cursor: default !important;
}

.scope-list li.empty-state {
    background: transparent;
    border: none;
}

.scope-list li.empty-state:hover {
    transform: none;
    box-shadow: none;
}

.item-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.scope-list li:hover .item-actions {
    opacity: 1;
}

.item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b7280;
    transition: color 0.3s;
}

.item-actions button:hover {
    color: #667eea;
}

.requirement-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.conflict-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #fbbf24;
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    animation: blink-warning 1.5s infinite;
}

@keyframes blink-warning {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.conflict-badge i {
    font-size: 10px;
}

.ambiguity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    animation: blink-ambiguity 1.5s infinite;
}

.ambiguity-badge.ambiguity-high {
    background: #a78bfa;
    color: white;
}

.ambiguity-badge.ambiguity-medium {
    background: #c4b5fd;
    color: #5b21b6;
}

.ambiguity-badge.ambiguity-low {
    background: #ddd6fe;
    color: #6b21a8;
}

@keyframes blink-ambiguity {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.ambiguity-badge i {
    font-size: 10px;
}

/* システム構造分析（ユースケース分析） */
.ucp-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.ucp-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ucp-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
}

.ucp-section-header i {
    color: #667eea;
    font-size: 16px;
}

.ucp-section-header h4 {
    font-size: 15px;
    margin: 0;
}

.ucp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ucp-item {
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ucp-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateX(2px);
}

.ucp-item-content {
    flex: 1;
}

.ucp-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.ucp-item-description {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.ucp-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.ucp-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.ucp-badge.complexity-simple {
    background: #d1fae5;
    color: #065f46;
}

.ucp-badge.complexity-average {
    background: #fef3c7;
    color: #92400e;
}

.ucp-badge.complexity-complex {
    background: #fee2e2;
    color: #991b1b;
}

.ucp-badge.actor-simple {
    background: #dbeafe;
    color: #1e40af;
}

.ucp-badge.actor-average {
    background: #e0e7ff;
    color: #4338ca;
}

.ucp-badge.actor-complex {
    background: #ede9fe;
    color: #6b21a8;
}

.ucp-weight {
    font-size: 13px;
    color: #667eea;
    font-weight: 700;
}

/* 関連情報 */
.relationship-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.relationship-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    padding: 6px 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.relationship-item i {
    color: #667eea;
    font-size: 12px;
}

.relationship-item strong {
    color: #374151;
}

/* 見積もりパネル */
.estimate-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 16px;
    margin-bottom: 20px;
}

.estimate-card {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

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

.estimate-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.estimate-card-primary .estimate-label {
    color: rgba(255, 255, 255, 0.9);
}

.estimate-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.estimate-unit {
    font-size: 11px;
    color: #9ca3af;
}

.estimate-card-primary .estimate-unit {
    color: rgba(255, 255, 255, 0.8);
}

.estimate-breakdown {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.breakdown-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.breakdown-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.breakdown-section h5 {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.detail-row span:first-child {
    color: #6b7280;
}

.detail-row span:last-child {
    font-weight: 600;
    color: #333;
}

/* ボタンスタイル */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-small {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    background: #667eea;
    color: white;
}

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

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ローディング */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 48px;
    margin-bottom: 16px;
}

.loading-spinner p {
    font-size: 16px;
    font-weight: 500;
}

.update-time {
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.update-time::before {
    content: '●';
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* レスポンシブ */
@media (max-width: 1400px) {
    .estimate-summary {
        grid-template-columns: 1fr;
    }
    
    .scope-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .chat-section {
        height: 600px;
    }
    
    .requirements-section {
        height: auto;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
    }
    
    .logo span {
        display: none;
    }
    
    .main-container {
        padding: 0 16px;
        gap: 16px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .estimate-value {
        font-size: 24px;
    }
}

/* ========================================
   サブシステム階層構造スタイル
   ======================================== */

.subsystem-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.subsystem-card:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    border-color: #c7d2fe;
}

.subsystem-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-bottom: 2px solid #d1d5db;
}

.subsystem-info {
    flex: 1;
}

.subsystem-name {
    font-size: 16px;
    font-weight: 700;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.subsystem-name i {
    color: #667eea;
    font-size: 18px;
}

.subsystem-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.subsystem-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.usecase-count-badge {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* サブシステム内のユースケースコンテナ */
.subsystem-usecases {
    padding: 12px 16px 16px 16px;
    background: #fafbfc;
}

/* ユースケースアイテム */
.usecase-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.usecase-item:last-child {
    margin-bottom: 0;
}

.usecase-item:hover {
    border-left-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
    transform: translateX(2px);
}

.usecase-content {
    flex: 1;
    min-width: 0;
}

.usecase-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.usecase-name i {
    color: #667eea;
    font-size: 13px;
}

.usecase-description {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 8px;
}

.usecase-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-left: 12px;
}

/* 関係性バッジ */
.relationship-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.relationship-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.relationship-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Include関係（紫色） */
.rel-include {
    background: #ede9fe;
    color: #7c3aed;
    border: 1px solid #c4b5fd;
}

.rel-include .rel-icon {
    color: #7c3aed;
    font-weight: 700;
}

/* Extend関係（青色） */
.rel-extend {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #93c5fd;
}

.rel-extend .rel-icon {
    color: #2563eb;
    font-weight: 700;
}

/* Generalization関係（緑色） */
.rel-general {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #6ee7b7;
}

.rel-general .rel-icon {
    color: #059669;
    font-weight: 700;
    font-size: 12px;
}

.rel-target {
    font-weight: 500;
}

/* 空のユースケースメッセージ */
.empty-usecase-message {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    font-style: italic;
    background: #f9fafb;
}

/* Actorアイテム（独立表示） */
.actor-item {
    border-left: 4px solid #10b981;
}

.actor-item:hover {
    border-left-color: #059669;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .subsystem-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .usecase-item {
        flex-direction: column;
        gap: 12px;
    }
    
    .usecase-meta {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        margin-left: 0;
    }
    
    .relationship-badges {
        flex-direction: column;
    }
}

/* ========================================
   非機能要件パネル
   ======================================== */

.nonfunctional-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.nfr-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.nfr-category {
    background: #fafbfc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.nfr-category:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.nfr-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

.nfr-header i {
    font-size: 14px;
}

.nfr-header h4 {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.nfr-header .count {
    background: rgba(255, 255, 255, 0.9);
    color: inherit;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

/* 各カテゴリーの色分け */
.nfr-performance {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.nfr-availability {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.nfr-security {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.nfr-maintainability {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.nfr-usability {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.nfr-portability {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.nfr-compliance {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
}

.nfr-cost {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.nfr-list {
    list-style: none;
    padding: 12px;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.nfr-list li {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #e5e7eb;
    font-size: 12px;
    line-height: 1.5;
    color: #374151;
    transition: all 0.2s ease;
}

.nfr-list li:last-child {
    margin-bottom: 0;
}

.nfr-list li:not(.empty-state):hover {
    border-left-color: #667eea;
    background: #f9fafb;
    transform: translateX(2px);
}

.nfr-list .empty-state {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    border-left: none;
}

/* 非機能要件アイテムのバッジ */
.nfr-item-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}

.badge-high {
    background: #fee2e2;
    color: #dc2626;
}

.badge-medium {
    background: #fef3c7;
    color: #d97706;
}

.badge-low {
    background: #dbeafe;
    color: #2563eb;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .nfr-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nonfunctional-panel {
        padding: 16px;
    }
    
    .nfr-category {
        margin-bottom: 12px;
    }
    
    .nfr-list {
        max-height: 150px;
    }
}

/* ========================================
   統合要求一覧（優先度順）
   ======================================== */

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.unified-requirements-list {
    padding: 16px;
    background: #fafbfc;
    border-radius: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.requirements-sortable {
    list-style: none;
    padding: 0;
    margin: 0;
}

.requirements-sortable li {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.requirements-sortable li:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.requirements-sortable li.dragging {
    opacity: 0.5;
    cursor: move;
}

.requirements-sortable li.drag-over {
    border-color: #667eea;
    border-style: dashed;
    background: #f3f4f6;
}

/* ドラッグハンドル */
.drag-handle {
    color: #9ca3af;
    cursor: move;
    font-size: 16px;
    flex-shrink: 0;
}

.drag-handle:hover {
    color: #667eea;
}

/* カテゴリーアイコン */
.req-category-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.req-icon-do {
    color: #10b981;
}

.req-icon-dont {
    color: #ef4444;
}

.req-icon-future {
    color: #8b5cf6;
}

.req-icon-proposal {
    color: #06b6d4;
}

.req-icon-confirm {
    color: #f59e0b;
}

/* 要求テキスト */
.req-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

/* 優先度バッジ */
.priority-badge {
    background: #667eea;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* 質問ボタン */
.req-ask-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: none;
}

.requirements-sortable li:hover .req-ask-btn {
    display: block;
}

.req-ask-btn:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

/* バッジ（矛盾・曖昧） */
.req-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.req-conflict-badge {
    background: #fef3c7;
    color: #d97706;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.req-ambiguity-badge {
    background: #ede9fe;
    color: #7c3aed;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* カテゴリー凡例 */
.category-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.legend-item i {
    font-size: 14px;
}

/* empty state */
.requirements-sortable .empty-state {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 40px 20px;
    border: 2px dashed #e5e7eb;
    cursor: default;
}

.requirements-sortable .empty-state:hover {
    border-color: #e5e7eb;
    box-shadow: none;
    transform: none;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .requirements-sortable li {
        flex-wrap: wrap;
    }
    
    .req-ask-btn {
        display: block;
        width: 100%;
        margin-top: 8px;
    }
    
    .category-legend {
        gap: 8px;
    }
}

/* ============================================
   要解決事項（アジェンダ）セクション
   ============================================ */

.agenda-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin-bottom: 24px;
}

.agenda-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f3f4f6;
}

.agenda-panel .panel-header h3 {
    font-size: 18px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-panel .panel-header h3 i {
    color: #f59e0b;
    font-size: 20px;
}

.agenda-list {
    background: #fef3c7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.agenda-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.agenda-items li {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #f59e0b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
}

.agenda-items li:last-child {
    margin-bottom: 0;
}

.agenda-items li:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.agenda-items li.empty-state {
    background: transparent;
    border: 2px dashed #fbbf24;
    border-left: 2px dashed #fbbf24;
    color: #92400e;
    text-align: center;
    padding: 24px;
    font-size: 14px;
    box-shadow: none;
}

.agenda-items li.empty-state:hover {
    transform: none;
    box-shadow: none;
}

.agenda-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.agenda-item-icon {
    color: #f59e0b;
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.agenda-item-content {
    flex: 1;
}

.agenda-item-title {
    font-size: 15px;
    color: #111827;
    line-height: 1.6;
    margin-bottom: 8px;
}

.agenda-item-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.agenda-item-reason {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.agenda-item-reason i {
    color: #ef4444;
}

.agenda-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.agenda-item-actions button {
    font-size: 12px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.agenda-resolve-btn {
    background: #10b981;
    color: white;
}

.agenda-resolve-btn:hover {
    background: #059669;
}

.agenda-ask-btn {
    background: #667eea;
    color: white;
}

.agenda-ask-btn:hover {
    background: #5568d3;
}

.agenda-edit-btn {
    background: #6b7280;
    color: white;
}

.agenda-edit-btn:hover {
    background: #4b5563;
}

.agenda-summary {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #fef3c7;
    border-radius: 8px;
    justify-content: center;
}

.agenda-summary .summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.agenda-summary .summary-item span {
    font-size: 12px;
    color: #92400e;
    font-weight: 500;
}

.agenda-summary .summary-item strong {
    font-size: 24px;
    color: #f59e0b;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .agenda-panel {
        padding: 16px;
    }
    
    .agenda-items li {
        padding: 12px;
    }
    
    .agenda-item-actions {
        flex-wrap: wrap;
    }
    
    .agenda-item-actions button {
        flex: 1;
        justify-content: center;
    }
    
    .agenda-summary {
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* ============================================
   ヒアリングノートセクション
   ============================================ */

.hearing-notes-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin-bottom: 24px;
}

.hearing-notes-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f3f4f6;
}

.hearing-notes-panel .panel-header h3 {
    font-size: 18px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hearing-notes-panel .panel-header h3 i {
    color: #8b5cf6;
    font-size: 20px;
}

.notes-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notes-description {
    background: #f3f4f6;
    border-left: 4px solid #8b5cf6;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.6;
}

.notes-description i {
    color: #8b5cf6;
    margin-top: 2px;
    flex-shrink: 0;
}

.notes-textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #1f2937;
    resize: vertical;
    transition: all 0.2s ease;
}

.notes-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.notes-textarea::placeholder {
    color: #9ca3af;
    line-height: 1.8;
}

.notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.notes-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #6b7280;
}

.notes-char-count,
.notes-line-count {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notes-char-count i,
.notes-line-count i {
    color: #8b5cf6;
}

.notes-char-count span,
.notes-line-count span {
    font-weight: 600;
    color: #8b5cf6;
}

.notes-actions {
    display: flex;
    gap: 10px;
}

.btn-notes {
    font-size: 13px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.btn-notes i {
    font-size: 12px;
}

.btn-secondary.btn-notes {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-secondary.btn-notes:hover {
    background: #e5e7eb;
    color: #4b5563;
}

.btn-primary.btn-notes {
    background: #8b5cf6;
    color: white;
}

.btn-primary.btn-notes:hover {
    background: #7c3aed;
}

/* 自動保存インジケーター */
.notes-auto-save {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #10b981;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notes-auto-save.show {
    opacity: 1;
}

.notes-auto-save i {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .hearing-notes-panel {
        padding: 16px;
    }
    
    .notes-textarea {
        min-height: 150px;
        font-size: 13px;
    }
    
    .notes-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .notes-actions {
        width: 100%;
    }
    
    .btn-notes {
        flex: 1;
        justify-content: center;
    }
}
