/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
}

/* Header Styles */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-size: 1.1rem;
    color: #666;
}

/* Navigation Controls */
.controls {
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    color: #555;
    min-width: 80px;
}

select, button {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

select:hover, select:focus,
button:hover, button:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    font-weight: 600;
    border: none;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    min-height: calc(100vh - 200px);
}

/* Info Panel */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dataset-info, .mineral-legend {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.dataset-info h3, .mineral-legend h3 {
    color: #333;
    margin-bottom: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

#dataset-metadata {
    font-size: 0.9rem;
    line-height: 1.6;
}

#dataset-metadata p {
    margin-bottom: 0.5rem;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #eee;
}

.metadata-label {
    font-weight: 600;
    color: #555;
}

.metadata-value {
    color: #333;
    text-align: right;
}

/* Mineral Legend */
.mineral-list {
    max-height: 300px;
    overflow-y: auto;
    display: grid;
    gap: 0.25rem;
}

.mineral-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mineral-item:hover {
    background-color: #f0f0f0;
}

.mineral-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.mineral-name {
    font-size: 0.85rem;
    color: #555;
}

/* Visualization Panel */
.visualization-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.viz-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Visualization Sections */
.viz-section {
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(222, 226, 230, 0.6);
}

.viz-section:last-child {
    margin-bottom: 0;
}

.viz-section h3 {
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.4rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

#viz-title {
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
}

/* Heatmap Styles */
#heatmap-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: 100%;
}

.heatmap-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.heatmap-section h4 {
    margin-bottom: 1rem;
    color: #555;
    font-size: 1.1rem;
}

.heatmap-section svg {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.colorbar {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.colorbar-gradient {
    width: 200px;
    height: 20px;
    border-radius: 10px;
    border: 1px solid #ccc;
}

.colorbar-labels {
    display: flex;
    justify-content: space-between;
    width: 200px;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Statistics Container */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: 100%;
}

.stat-chart {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-chart canvas {
    max-height: 300px;
}

/* Loading and Error States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
}

.error h3 {
    margin-bottom: 1rem;
}

.error button {
    background: #dc3545;
    margin-top: 1rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1000;
    max-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* Footer */
footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    margin-top: 2rem;
    backdrop-filter: blur(10px);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-section h4 {
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.footer-section p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
    color: #888;
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .control-group {
        justify-content: space-between;
    }
    
    #heatmap-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .dashboard {
        padding: 1rem;
    }
    
    .controls {
        padding: 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}