/* Contour Plots CSS - Styling for unity value contour plots and visualization */

.contour-plots-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.contour-plot {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.contour-plot-header {
    background-color: #007bff;
    color: #fff;
    padding: 1rem;
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
}

.contour-plot-content {
    padding: 1rem;
    height: 400px;  /* Keep consistent height for M-shape visualization */
    min-height: 400px; /* Ensure minimum height */
    position: relative;
}

/* M-shape segment indicator styles */
.segment-label {
    position: absolute;
    font-size: 0.75rem;
    font-weight: bold;
    color: #333;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid #ccc;
    white-space: nowrap;
}

.segment-connector {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    pointer-events: none;
    z-index: 5;
}

.segment-vertical {
    width: 4px;
}

.segment-horizontal {
    height: 4px;
}

/* Unity legend/color scale */
.unity-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.5rem;
}

.unity-gradient {
    height: 20px;
    width: 80%;
    background: linear-gradient(to right, 
        #2ecc71, /* Green - safe */
        #f1c40f, /* Yellow - moderate */
        #e74c3c  /* Red - approaching limit */
    );
    border-radius: 4px;
    margin: 0 1rem;
}

.unity-labels {
    display: flex;
    justify-content: space-between;
    width: 80%;
    margin: 0.25rem auto;
    font-size: 0.8rem;
    color: #666;
}

/* Toggle buttons for different plots */
.plot-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.plot-controls button {
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.plot-controls button:hover {
    background-color: #e9ecef;
}

.plot-controls button.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Plot canvas */
.plot-canvas {
    width: 100%;
    height: 100%;
}

/* Elements table with unity values */
.elements-table-container {
    margin-top: 1.5rem;
    overflow-x: auto;
}

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

.elements-table th, .elements-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.elements-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.elements-table tr:hover {
    background-color: #f1f1f1;
}

/* Unity value cell styles */
.unity-value {
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.unity-safe {
    background-color: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.unity-moderate {
    background-color: rgba(241, 196, 15, 0.2);
    color: #f39c12;
}

.unity-warning {
    background-color: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

/* Highlighted element row */
.highlighted {
    background-color: #e3f2fd !important;
    font-weight: bold;
}

/* Element highlighting on plot hover */
.plot-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 100;
    max-width: 250px;
    transform: translate(-50%, -100%);
}

.plot-tooltip:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.8);
}

/* Plot info */
.plot-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #666;
}

.plot-info h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.plot-info ul {
    margin-left: 1.5rem;
}

/* Export controls */
.plot-export {
    margin-top: 1rem;
    text-align: right;
}

.plot-export button {
    background-color: #6c757d;
    color: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.plot-export button:hover {
    background-color: #5a6268;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .contour-plots-container {
        grid-template-columns: 1fr;
    }

    .contour-plot-content {
        height: 350px;  /* Adjust for mobile but still show M-shape */
    }
    
    .plot-controls {
        flex-wrap: wrap;
    }
    
    .plot-controls button {
        flex: 1 0 40%;
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* Profile plot container styles */
.profile-plot-container {
    width: 100%;
    min-height: 360px; /* Doubled from 180px */
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-plot-container h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    text-align: center;
    color: #333;
}

.profile-plot-container canvas {
    width: 100% !important;
    height: 280px !important; /* Doubled from 140px */
} 