/* ========================================
   Analyze画面
   ======================================== */

.analyze-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-primary);
}

.analyze-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.analyze-header .page-header-content h2 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.analyze-header .page-header-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

.analyze-config {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.config-section {
    margin-bottom: 24px;
}

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

.config-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.analysis-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.analysis-type-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.analysis-type-btn:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.analysis-type-btn.active {
    border-color: var(--accent-primary);
    background-color: var(--accent-light);
}

.type-icon {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.analysis-type-btn.active .type-icon {
    color: var(--accent-primary);
}

.type-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.type-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.analysis-target-input {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.analysis-target-input input {
    flex: 1;
    padding: 12px 16px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.analysis-target-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-knowledge-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.search-knowledge-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.search-knowledge-btn svg {
    width: 18px;
    height: 18px;
}

.upload-file-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.upload-file-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.upload-file-btn svg {
    width: 18px;
    height: 18px;
}

.target-suggestions {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.target-suggestions.active {
    display: flex;
}

.uploaded-analysis-files {
    display: none;
    margin-top: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.uploaded-analysis-files.active {
    display: flex;
}

.analysis-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.analysis-file-item:hover {
    border-color: var(--accent-primary);
}

.suggestion-chip {
    padding: 6px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background-color: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.analyze-execute-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background-color: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.analyze-execute-btn:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

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

.analyze-execute-btn svg {
    width: 20px;
    height: 20px;
}

.analyze-results {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
}

.no-results svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results p {
    font-size: 14px;
}

.result-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease-in;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.result-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.result-actions {
    display: flex;
    gap: 8px;
}

.result-action-btn {
    padding: 8px 16px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-action-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.result-visual {
    margin-bottom: 20px;
    padding: 20px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
}

.diagram-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fta-diagram,
.fmea-table,
.trend-chart {
    width: 100%;
}

.fta-node {
    margin: 20px 0;
    text-align: center;
}

.node-box {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 auto;
}

.node-connector {
    width: 2px;
    height: 30px;
    background-color: var(--border-color);
    margin: 0 auto;
}

.node-children {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.fmea-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.fmea-table th,
.fmea-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.fmea-table th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.fmea-table td {
    color: var(--text-secondary);
}

.severity-high {
    color: var(--error);
    font-weight: 600;
}

.severity-medium {
    color: var(--warning);
    font-weight: 600;
}

.severity-low {
    color: var(--success);
    font-weight: 600;
}

.trend-chart {
    position: relative;
    height: 300px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 250px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
}

.chart-bar {
    flex: 1;
    max-width: 80px;
    background: linear-gradient(to top, var(--accent-primary), var(--accent-hover));
    border-radius: 4px 4px 0 0;
    margin: 0 10px;
    position: relative;
    transition: all 0.3s;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-labels {
    display: flex;
    justify-content: space-around;
    padding-top: 12px;
}

.chart-label {
    flex: 1;
    max-width: 80px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 10px;
}

.result-summary {
    padding: 16px;
    background-color: var(--bg-primary);
    border-left: 4px solid var(--accent-primary);
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.loading-analysis {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}
