/* EDS Mineral Database — extends main.css + menu.css */

/* ── Palette ── */
:root {
    --eds-bg:         #111819;
    --eds-panel:      #0c1214;
    --eds-panel-soft: #141c1e;
    --eds-border:     rgba(180, 120, 40, 0.28);
    --eds-border-dim: rgba(255, 255, 255, 0.07);
    --eds-accent:     #c4892a;
    --eds-accent-dim: rgba(196, 137, 42, 0.18);
    --eds-text:       #d2d8db;
    --eds-muted:      rgba(140, 155, 162, 0.65);
    --eds-soft:       rgba(165, 175, 180, 0.45);
}

/* ── Active nav ── */
.nav-links li a.nav-active {
    color: rgba(230, 238, 242, 0.95) !important;
}

/* ── Hero ── */

.eds-hero {
    padding: 40px 8vw 36px;
    background: linear-gradient(180deg, #0d1315 0%, var(--eds-bg) 100%);
    border-bottom: 1px solid var(--eds-border);
}

.eds-back-link {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(165, 175, 183, 0.42);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
    transition: color 0.2s;
}
.eds-back-link:hover { color: rgba(195, 210, 215, 0.7); }

.eds-hero-row { display: flex; align-items: flex-start; gap: 32px; }

.eds-badge {
    font-family: 'Montserrat', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--eds-accent);
    border: 1px solid var(--eds-border);
    padding: 3px 10px;
    border-radius: 2px;
    display: inline-block;
    margin-bottom: 12px;
}

.eds-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 26px;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #dce2e6;
    margin: 0 0 4px;
}

.eds-title::after {
    content: '';
    display: block;
    width: 22px;
    height: 2px;
    background: var(--eds-accent);
    margin-top: 10px;
    margin-bottom: 14px;
}

.eds-subtitle {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: var(--eds-muted);
    line-height: 1.8;
    font-weight: 300;
    margin: 0;
    max-width: 640px;
}

/* ── Main Layout ── */

.eds-main {
    background: var(--eds-bg);
    padding: 28px 8vw 40px;
    min-height: 70vh;
}

.eds-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 22px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
}

/* ── Sidebar ── */

.eds-sidebar { display: flex; flex-direction: column; gap: 14px; }

.eds-panel {
    background: var(--eds-panel);
    border: 1px solid var(--eds-border-dim);
    border-radius: 4px;
    padding: 16px 18px;
}

.panel-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--eds-accent);
    font-weight: 500;
    margin: 0 0 10px;
}

/* Mineral search */

.mineral-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    padding: 7px 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: var(--eds-text);
    outline: none;
    margin-bottom: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.mineral-search::placeholder { color: var(--eds-soft); }
.mineral-search:focus { border-color: var(--eds-border); }

/* Custom mineral list (replaces native <select> — Materialize transforms selects) */

.mineral-list-wrap {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.mineral-list {
    height: 196px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.32);
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(196, 137, 42, 0.3) transparent;
}

.mineral-list::-webkit-scrollbar       { width: 4px; }
.mineral-list::-webkit-scrollbar-track { background: transparent; }
.mineral-list::-webkit-scrollbar-thumb { background: rgba(196, 137, 42, 0.3); border-radius: 2px; }

.mineral-list-item {
    padding: 6px 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: rgba(190, 200, 206, 0.7);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.mineral-list-item:hover {
    background: rgba(196, 137, 42, 0.12);
    color: var(--eds-text);
}

.mineral-list-item.selected {
    background: rgba(196, 137, 42, 0.22);
    color: var(--eds-accent);
    font-weight: 400;
}

/* Mineral info card */

.mineral-info-card { padding: 14px 16px; }

.mineral-img-wrap { margin-bottom: 12px; }

.mineral-img-placeholder {
    width: 100%;
    height: 90px;
    background: linear-gradient(135deg, #0c1214, #141c1e);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Roboto', sans-serif;
    font-size: 10px;
    color: rgba(140, 155, 162, 0.3);
}

#mineral-img {
    width: 100%;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    object-fit: cover;
    max-height: 130px;
}

.mineral-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #d8e0e4;
    margin: 0 0 4px;
    letter-spacing: 0.3px;
}

.mineral-formula {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--eds-accent);
    margin: 0 0 12px;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.mineral-meta { display: flex; flex-direction: column; gap: 6px; }

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 5px;
}
.meta-row:last-child { border-bottom: none; }

.meta-key {
    font-family: 'Montserrat', sans-serif;
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(140, 155, 162, 0.5);
    white-space: nowrap;
    flex-shrink: 0;
}

.meta-val {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: rgba(190, 200, 206, 0.7);
    font-weight: 300;
    text-align: right;
    line-height: 1.4;
}

/* Upload area */

.upload-area {
    border: 1px dashed rgba(196, 137, 42, 0.3);
    border-radius: 3px;
    margin-bottom: 10px;
    transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover { border-color: rgba(196, 137, 42, 0.6); background: var(--eds-accent-dim); }

.upload-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(196, 137, 42, 0.72);
    cursor: pointer;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.upload-status {
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    color: var(--eds-muted);
    font-weight: 300;
    font-style: italic;
    margin: 0 0 10px;
    min-height: 16px;
}

/* Buttons */

.eds-btn {
    width: 100%;
    padding: 9px 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    background: var(--eds-accent-dim);
    border: 1px solid var(--eds-border);
    border-radius: 2px;
    color: var(--eds-accent);
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}
.eds-btn:hover:not(:disabled) {
    background: rgba(196, 137, 42, 0.28);
    border-color: rgba(196, 137, 42, 0.6);
}
.eds-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.eds-btn-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--eds-muted);
}
.eds-btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--eds-text);
}

/* Results */

.results-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--eds-accent);
    margin: 14px 0 8px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.result-item:last-child { border-bottom: none; }

.result-rank {
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    color: rgba(140, 155, 162, 0.4);
    flex-shrink: 0;
    width: 16px;
}

.result-name {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: var(--eds-text);
    font-weight: 400;
    flex: 1;
    margin-left: 8px;
}

.result-name.top-match { color: var(--eds-accent); }

.result-score {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: rgba(196, 137, 42, 0.7);
    flex-shrink: 0;
}

.result-bar-wrap {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1px;
    margin-top: 4px;
}
.result-bar {
    height: 100%;
    background: var(--eds-accent);
    border-radius: 1px;
    transition: width 0.4s ease;
}

.identify-note {
    font-family: 'Roboto', sans-serif;
    font-size: 10px;
    color: rgba(140, 155, 162, 0.32);
    font-style: italic;
    margin: -4px 0 8px;
    text-align: center;
}

.results-warning {
    font-family: 'Roboto', sans-serif;
    font-size: 10px;
    color: rgba(140, 155, 162, 0.4);
    font-weight: 300;
    line-height: 1.65;
    margin-top: 12px;
    font-style: italic;
}

/* ── Chart Section ── */

.eds-chart-section {
    background: var(--eds-panel);
    border: 1px solid var(--eds-border-dim);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* Chart controls bar */
.chart-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.25);
    flex-wrap: wrap;
}

.ctrl-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(140, 155, 162, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
    padding: 4px 10px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ctrl-btn:hover { color: var(--eds-text); border-color: rgba(255, 255, 255, 0.18); }
.ctrl-btn.active {
    color: var(--eds-accent);
    border-color: var(--eds-border);
    background: var(--eds-accent-dim);
}

.chart-mineral-label {
    margin-left: auto;
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(196, 137, 42, 0.6);
    font-style: italic;
}

/* Plotly container */
#spectrum-chart {
    width: 100%;
    height: 520px;
}

/* Loading indicator */
.chart-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    align-items: center;
    gap: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: var(--eds-muted);
}
.chart-loading.visible { display: flex; }

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--eds-accent);
    animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.1); }
}

/* ── Disclaimer ── */

.disclaimer-section {
    background: #0d1315;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 32px 8vw;
}

.disclaimer-content {
    max-width: 800px;
    margin: 0 auto;
}

.disclaimer-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(196, 137, 42, 0.6);
    margin: 0 0 10px;
}

.disclaimer-text {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: rgba(140, 155, 162, 0.45);
    line-height: 1.8;
    font-weight: 300;
    margin: 0;
    font-style: italic;
}

/* ── Responsive ── */

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

    .mineral-select { size: 5; }

    #spectrum-chart { height: 380px; }
}

@media (max-width: 600px) {
    .eds-hero,
    .eds-main {
        padding-left: 20px;
        padding-right: 20px;
    }

    .eds-title {
        font-size: 20px;
        letter-spacing: 2px;
    }
}
