/* SemStore Educational Demo Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
}

.tab-btn:hover {
    background: #e2e8f0;
}

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

/* Tab Content */
.tab-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tab-content.hidden {
    display: none;
}

/* Graph Visualization */
.viz-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 500;
    color: #374151;
}

.control-group input[type="range"] {
    width: 150px;
}

.graph-container {
    position: relative;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.graph-stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

.stat-label {
    color: #6b7280;
}

#graph-svg {
    width: 100%;
    height: 500px;
    cursor: grab;
}

#graph-svg:active {
    cursor: grabbing;
}

.tooltip {
    position: fixed;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    max-width: 300px;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid #e5e7eb;
}

.tooltip.hidden {
    display: none;
}

/* Legend */
.legend {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.legend h4 {
    margin-bottom: 10px;
    color: #374151;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-label {
    font-weight: 500;
    color: #374151;
}

.legend-count {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Dashboard List */
.dashboard-header {
    margin-bottom: 20px;
}

.dashboard-header h3 {
    color: #374151;
    margin-bottom: 5px;
}

.dashboard-header p {
    color: #6b7280;
}

.dashboard-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.dashboard-card:hover {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.dashboard-card .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.dashboard-card h4 {
    color: #374151;
    font-size: 1.1rem;
}

.dashboard-type {
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.dashboard-type.dataset {
    background: #f59e0b;
}

/* Data Source Page */
.data-source-section {
    margin-bottom: 30px;
}

.tab-header {
    margin-bottom: 20px;
}

.tab-header h3 {
    color: #374151;
    margin-bottom: 5px;
}

.tab-header p {
    color: #6b7280;
}

.count-info {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.data-source-list {
    min-height: 200px;
}

.section-title {
    color: #374151;
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.data-source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.page-btn.active {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #6b7280;
}

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

.card-header h4 {
    color: #374151;
    font-size: 1.1rem;
    flex: 1;
    margin-right: 10px;
}

.type-badge {
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.type-badge.dataset {
    background: #f59e0b;
}

.card-id {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 10px;
    word-break: break-all;
}

.card-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.tag {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #374151;
}

.tag.more {
    background: #10b981;
    color: white;
}

.dashboard-id, .dashboard-arn {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 5px;
    word-break: break-all;
}

.columns-preview {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.column-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.column-tag {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #374151;
}

.column-tag.more {
    background: #10b981;
    color: white;
}

.view-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* API Playground */
.api-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

.api-params {
    background: #fafbfc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.api-params h3 {
    color: #374151;
    margin-bottom: 10px;
}

.param-description {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

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

.param-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.param-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
}

.param-group input[type="text"]:focus {
    outline: none;
    border-color: #10b981;
}

.param-group input[type="range"] {
    width: 100%;
}

.param-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.param-group select:focus {
    outline: none;
    border-color: #10b981;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.sample-queries {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.sample-queries h4 {
    color: #374151;
    margin-bottom: 10px;
}

.sample-query-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sample-query-btn:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

/* API Results */
.api-results h3 {
    color: #374151;
    margin-bottom: 15px;
}

.query-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f0fdf4;
    border-radius: 6px;
    font-size: 0.9rem;
}

.query-meta.hidden {
    display: none;
}

.result-card {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.result-rank {
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.result-name {
    flex: 1;
    font-weight: 600;
    color: #374151;
}

.result-score {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #374151;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.result-view-btn {
    font-size: 0.8rem;
    color: #10b981;
    text-decoration: none;
}

.result-view-btn:hover {
    text-decoration: underline;
}

.result-type {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #64748b;
}

.result-text {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.result-details {
    margin-top: 10px;
}

.result-details summary {
    cursor: pointer;
    color: #10b981;
    font-size: 0.9rem;
}

.result-details pre {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.8rem;
    overflow-x: auto;
}

/* Retrieval Trace Visualization */
.trace-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.trace-scores {
    margin-bottom: 12px;
}

.score-bars {
    margin-top: 8px;
}

.score-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.score-label {
    width: 80px;
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: capitalize;
}

.score-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 4px;
}

.score-value {
    width: 50px;
    font-size: 0.8rem;
    color: #374151;
    text-align: right;
}

.trace-support {
    margin-top: 10px;
}

.support-list {
    margin-top: 8px;
}

.support-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 4px;
}

.support-type {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #64748b;
    min-width: 70px;
    text-align: center;
}

.support-name {
    flex: 1;
    font-size: 0.85rem;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.support-hops {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
}

.support-bar {
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.support-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 3px;
}

.support-score {
    font-size: 0.8rem;
    color: #10b981;
    font-weight: 500;
    min-width: 45px;
    text-align: right;
}

.support-more {
    font-size: 0.8rem;
    color: #6b7280;
    padding: 4px 10px;
}

.paths-hidden {
    display: none;
}

.show-more-btn {
    background: none;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #10b981;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

.show-more-btn:hover {
    background: #f0fdf4;
    border-color: #10b981;
}

.trace-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.trace-help {
    font-size: 0.8rem;
    color: #10b981;
    cursor: pointer;
    position: relative;
}

.trace-tip {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background: #1f2937;
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    width: 280px;
    z-index: 100;
    margin-top: 5px;
    line-height: 1.4;
}

.trace-help.show-tip .trace-tip {
    display: block;
}

.scoring-explanation {
    background: #f0fdf4;
    border: 1px solid #10b981;
    border-radius: 8px;
    margin-bottom: 15px;
}

.scoring-explanation summary {
    padding: 12px 15px;
    cursor: pointer;
    font-weight: 500;
    color: #059669;
}

.scoring-explanation summary:hover {
    background: #dcfce7;
}

.explanation-content {
    padding: 0 15px 15px 15px;
    font-size: 0.9rem;
    color: #374151;
}

.explanation-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.explanation-content li {
    margin-bottom: 6px;
}

.results-pagination {
    margin-top: 20px;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #374151;
    border: 1px solid #e2e8f0;
}

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

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #6b7280;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    z-index: 1;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    color: #374151;
    margin-bottom: 10px;
}

.detail-section pre {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    overflow-x: auto;
}

/* Utilities */
.placeholder {
    text-align: center;
    color: #6b7280;
    padding: 40px;
}

.error {
    color: #dc2626;
    text-align: center;
    padding: 20px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Agent Tab */
.agent-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    min-height: 500px;
}

.agent-chat {
    display: flex;
    flex-direction: column;
}

.agent-header {
    margin-bottom: 15px;
}

.agent-header h3 {
    color: #374151;
    margin-bottom: 5px;
}

.agent-header p {
    color: #6b7280;
    font-size: 0.9rem;
}

.agent-messages {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    max-height: 400px;
    min-height: 300px;
}

.agent-message {
    margin-bottom: 12px;
}

.agent-message .message-content {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.agent-message.user .message-content {
    background: #10b981;
    color: white;
    margin-left: 20%;
}

.agent-message.assistant .message-content {
    background: white;
    border: 1px solid #e2e8f0;
    margin-right: 10%;
}

.agent-message ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.agent-message li {
    margin-bottom: 4px;
}

.agent-results a {
    color: #10b981;
    text-decoration: none;
}

.agent-results a:hover {
    text-decoration: underline;
}

.result-type-badge {
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 5px;
}

.agent-results .score {
    color: #6b7280;
    font-size: 0.8rem;
}

.agent-input-area {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.agent-input-area input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
}

.agent-input-area input:focus {
    outline: none;
    border-color: #10b981;
}

.agent-input-area .btn-primary {
    width: auto;
    padding: 10px 16px;
}

.agent-tools {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
}

.agent-tools h4 {
    color: #374151;
    margin-bottom: 12px;
}

.tool-list {
    margin-bottom: 15px;
}

.tool-item {
    padding: 8px 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
}

.tool-name {
    display: block;
    font-family: monospace;
    font-size: 0.85rem;
    color: #10b981;
    font-weight: 600;
}

.tool-desc {
    font-size: 0.75rem;
    color: #6b7280;
}

.tool-trace h5 {
    color: #374151;
    margin-bottom: 8px;
}

.tool-call {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.tool-call code {
    background: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.tool-call pre {
    margin: 8px 0 0 0;
    font-size: 0.75rem;
    color: #6b7280;
    white-space: pre-wrap;
}

@media (max-width: 900px) {
    .agent-layout {
        grid-template-columns: 1fr;
    }
    .agent-tools {
        order: -1;
    }
}

/* Asset Details Hierarchy */
.asset-detail-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.asset-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.asset-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

.asset-description {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.asset-children {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
}

.asset-children > strong {
    color: #374151;
    font-size: 0.9rem;
}

.hierarchy-list {
    list-style: none;
    margin: 10px 0 0 0;
    padding: 0;
}

.hierarchy-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.child-type {
    background: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 8px;
}

.child-name {
    color: #374151;
    font-weight: 500;
}

.grandchildren-list {
    list-style: none;
    margin: 8px 0 0 20px;
    padding: 0;
}

.grandchildren-list li {
    font-size: 0.85rem;
    color: #6b7280;
    padding: 3px 0;
}

.grandchildren-list .gc-type {
    background: #e2e8f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.65rem;
    margin-right: 5px;
}

.grandchildren-list .more {
    color: #10b981;
    font-style: italic;
}

/* Responsive */
@media (max-width: 900px) {
    .api-layout {
        grid-template-columns: 1fr;
    }

    .tab-nav {
        flex-direction: column;
    }

    .dashboard-list {
        grid-template-columns: 1fr;
    }
}
