/**
 * Sample Lineage Viewer Styles
 *
 * Phase 2.4: Provenance Visualization
 */

/* Container */
.lineage-viewer-container {
    width: 100%;
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    background: #f5f7fa;
}

/* Header */
.lineage-header {
    background: white;
    padding: 1.5rem;
    border-bottom: 2px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.lineage-title h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    color: #333;
}

.sample-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.sample-info .badge {
    padding: 0.25rem 0.75rem;
    background: #4A90E2;
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sample-info .organism {
    color: #666;
    font-style: italic;
}

/* Controls */
.lineage-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-toggle,
.graph-controls {
    display: flex;
    gap: 0.5rem;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-toggle button .icon {
    font-size: 1.1rem;
}

.view-toggle button:hover {
    background: #f8f9fa;
    border-color: #4A90E2;
}

.view-toggle button[data-active="true"] {
    background: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

.graph-controls button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.graph-controls button:hover {
    background: #f8f9fa;
    border-color: #7ED321;
}

/* Main content area */
.lineage-main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Graph container */
.graph-container {
    flex: 1;
    position: relative;
    background: white;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Graph canvas */
.graph-canvas {
    width: 100%;
    height: 100%;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4A90E2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 1rem;
    color: #666;
}

/* Graph statistics */
.graph-stats {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 200px;
}

.graph-stats .stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.graph-stats .stat:last-child {
    margin-bottom: 0;
}

.graph-stats .stat-label {
    color: #666;
    font-weight: 500;
}

.graph-stats .stat-value {
    color: #333;
    font-weight: bold;
}

/* Details panel (slide-in from right) */
.details-panel {
    position: absolute;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.details-panel.open {
    right: 0;
}

.details-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.btn-close:hover {
    color: #333;
}

.details-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.detail-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: #666;
    width: 40%;
    font-size: 0.9rem;
}

.detail-table td {
    padding: 0.75rem 0.5rem;
    color: #333;
    font-size: 0.9rem;
}

.detail-table .badge {
    padding: 0.25rem 0.5rem;
    background: #4A90E2;
    color: white;
    border-radius: 10px;
    font-size: 0.8rem;
}

.detail-actions {
    margin-top: 1.5rem;
}

.detail-actions .btn {
    width: 100%;
    padding: 0.75rem;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: background 0.2s;
}

.detail-actions .btn:hover {
    background: #357ABD;
}

/* Relationship diagram */
.relationship-diagram {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.rel-node {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    border-left: 4px solid #4A90E2;
}

.rel-node strong {
    display: block;
    color: #333;
    margin-bottom: 0.25rem;
}

.rel-node .node-type {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
}

.rel-node.target {
    border-left-color: #7ED321;
}

.rel-arrow {
    text-align: center;
    margin: 0.5rem 0;
}

.rel-arrow .arrow {
    font-size: 1.5rem;
    color: #4A90E2;
}

.rel-arrow .rel-type {
    display: block;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 0.25rem;
}

.text-muted {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Legend */
.graph-legend {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 180px;
}

.graph-legend h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #555;
}

.legend-symbol {
    flex-shrink: 0;
}

.legend-symbol.sample-node {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4A90E2;
    border: 2px solid #2E5C8A;
}

.legend-symbol.process-node {
    width: 32px;
    height: 20px;
    background: #7ED321;
    border: 2px solid #5FA319;
    border-radius: 2px;
}

.legend-symbol.focus-node {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #F8E71C;
    border: 3px solid #F5A623;
}

.legend-symbol.used-edge {
    width: 30px;
    height: 2px;
    background: #999;
    position: relative;
}

.legend-symbol.used-edge::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 0;
    height: 0;
    border-left: 6px solid #999;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.legend-symbol.generated-edge {
    width: 30px;
    height: 2px;
    background: #4A90E2;
    position: relative;
}

.legend-symbol.generated-edge::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 0;
    height: 0;
    border-left: 6px solid #4A90E2;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* Responsive design */
@media (max-width: 1024px) {
    .details-panel {
        width: 350px;
        right: -350px;
    }

    .graph-stats {
        font-size: 0.85rem;
        min-width: 180px;
    }
}

@media (max-width: 768px) {
    .lineage-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .lineage-controls {
        width: 100%;
        flex-direction: column;
    }

    .view-toggle,
    .graph-controls {
        width: 100%;
        flex-direction: column;
    }

    .view-toggle button,
    .graph-controls button {
        width: 100%;
    }

    .details-panel {
        width: 100%;
        right: -100%;
    }

    .graph-stats {
        position: static;
        margin: 1rem;
    }

    .graph-legend {
        position: static;
        margin: 1rem;
    }
}

/* Utilities */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: #4A90E2;
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #357ABD;
}
