/* ── Moonshop Dashboard Styles ── */
/* Design tokens from landing page */

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

:root {
    --ink: #0a0f1a;
    --chalk: #f8f7f4;
    --accent: #d94432;
    --accent-light: #e8604f;
    --accent-pale: #fdecea;
    --warm: #d4a853;
    --warm-pale: #faf3e0;
    --slate: #3d4f5f;
    --mist: #e9ecef;
    --concrete: #6c757d;
    --white: #ffffff;
    --red: #c0392b;
    --radius: 10px;
    --radius-sm: 6px;
}

body {
    font-family: 'DM Sans', sans-serif;
    color: var(--ink);
    background: var(--chalk);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
}

/* ── NAV ── */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 247, 244, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(10, 15, 26, 0.06);
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-mark {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    font-size: 0.875rem;
    color: var(--slate);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-link:hover, .nav-link.active { color: var(--accent); }

.nav-tag {
    font-size: 0.75rem;
    color: var(--concrete);
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--mist);
    border-radius: 100px;
}

/* ── MAIN ── */
.dashboard {
    max-width: 1000px;
    margin: 0 auto;
    padding: 5.5rem 1.5rem 3rem;
}

.section-header { margin-bottom: 1.5rem; }
.section-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    display: block;
    margin-bottom: 0.5rem;
}
.section-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.section-desc {
    color: var(--slate);
    font-size: 0.95rem;
    max-width: 550px;
}

/* ── UPLOAD ZONE ── */
.upload-section { margin-bottom: 3rem; }

.upload-zone {
    border: 2px dashed var(--mist);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--white);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-pale);
}
.upload-zone.dragover { border-style: solid; }

.upload-icon { margin-bottom: 1rem; }
.upload-text {
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 0.25rem;
}
.upload-sub {
    font-size: 0.85rem;
    color: var(--concrete);
}

/* ── PROGRESS ── */
.upload-progress {
    margin-top: 1.25rem;
}
.progress-bar {
    height: 6px;
    background: var(--mist);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}
.progress-text {
    font-size: 0.85rem;
    color: var(--slate);
    margin-top: 0.5rem;
}

/* ── RESULTS ── */
.results-section { margin-bottom: 2rem; }

.results-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}
.results-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── BUTTONS ── */
.btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-light); }
.btn-outline {
    background: transparent;
    color: var(--slate);
    border: 1px solid var(--mist);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── SUMMARY CARDS ── */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.summary-card {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.15s;
}
.summary-card:hover { border-color: var(--accent-light); }
.summary-card .card-label {
    font-size: 0.75rem;
    color: var(--concrete);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}
.summary-card .card-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}
.summary-card .card-unit {
    font-size: 0.8rem;
    color: var(--slate);
    margin-top: 0.15rem;
}
.summary-card.rating { border-left: 3px solid var(--accent); }
.card-rating {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

/* ── TABLES ── */
.breakdown-section {
    margin-bottom: 2rem;
}
.breakdown-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--ink);
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.element-count {
    font-size: 0.8rem;
    color: var(--concrete);
}

.table-wrap {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-scroll {
    max-height: 500px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table th {
    background: var(--accent-pale);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    padding: 0.6rem 1rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}
.data-table td {
    padding: 0.55rem 1rem;
    border-top: 1px solid var(--mist);
    color: var(--ink);
}
.data-table tbody tr:hover { background: rgba(217, 68, 50, 0.03); }

.share-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.share-fill {
    height: 6px;
    border-radius: 3px;
    background: var(--accent);
    min-width: 2px;
}
.share-fill.warm { background: var(--warm); }
.share-pct {
    font-size: 0.75rem;
    color: var(--concrete);
    min-width: 35px;
}

/* ── OPPORTUNITIES ── */
.opportunities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}
.opportunity-card {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--accent);
}
.opportunity-card .opp-element {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--ink);
}
.opportunity-card .opp-detail {
    font-size: 0.8rem;
    color: var(--slate);
    margin-bottom: 0.35rem;
}
.opportunity-card .opp-saving {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
}

/* ── HISTORY ── */
.history-section { margin-bottom: 2rem; }
.history-list { display: flex; flex-direction: column; gap: 0.5rem; }
.empty-state {
    font-size: 0.9rem;
    color: var(--concrete);
    padding: 1.5rem;
    text-align: center;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--mist);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--accent-light); }
.history-item .hi-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.history-item .hi-meta {
    font-size: 0.8rem;
    color: var(--concrete);
}
.history-item .hi-carbon {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}
.history-item .hi-rating {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    margin-left: 0.5rem;
}

/* ── ERROR ── */
.error-msg {
    background: #fdf2f2;
    border: 1px solid #fecaca;
    color: var(--red);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* ── FOOTER ── */
footer {
    padding: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--concrete);
    border-top: 1px solid var(--mist);
    margin-top: 2rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    nav { padding: 0.85rem 1rem; }
    .dashboard { padding: 5rem 1rem 2rem; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .opportunities-grid { grid-template-columns: 1fr; }
    .results-header-row { flex-direction: column; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.45rem 0.65rem; }
}

@media (max-width: 480px) {
    .summary-cards { grid-template-columns: 1fr; }
}
