@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1e3a34;
    /* Dark Deep Teal/Green */
    --primary-hover: #142823;
    --bg-light: #fdfcfb;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #1d1d1f;
    --text-muted: #6e6e73;
    --accent: #b08968;
    /* Modern Bronze */
    --glass-border: rgba(0, 0, 0, 0.03);
    --shadow-modern: 0 12px 30px -10px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    background-image:
        radial-gradient(at 0% 0%, rgba(30, 58, 52, 0.02) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(176, 137, 104, 0.02) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.subtitle {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.8;
}

.filters {
    position: relative;
    z-index: 100;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 4rem;
    align-items: flex-end;
    box-shadow: var(--shadow-modern);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-width: 180px;
}

label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Custom Multi-Select */
.custom-multiselect {
    position: relative;
    width: 100%;
}

.custom-multiselect.active {
    z-index: 101;
}

.multiselect-header {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.multiselect-header:hover {
    background: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(166, 124, 82, 0.1);
}

.multiselect-header::after {
    content: '↓';
    font-size: 0.8rem;
    margin-left: 0.5rem;
    transition: transform 0.4s ease;
    opacity: 0.5;
    color: var(--accent);
}

.custom-multiselect.active .multiselect-header {
    background: white;
    border-color: var(--accent);
}

.custom-multiselect.active .multiselect-header::after {
    transform: rotate(180deg);
}

.multiselect-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    padding: 0.75rem;
}

.custom-multiselect.active .multiselect-options {
    display: block;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.option-item:hover {
    background: var(--bg-light);
}

.option-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.option-item label {
    flex: 1;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
}

.option-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
}

.price-display {
    font-weight: 600;
    color: var(--accent);
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.price-inputs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.dual-range-container {
    width: 100%;
    position: relative;
    padding-top: 10px;
}

.slider-track-container {
    position: relative;
    width: 100%;
    height: 5px;
    margin-top: 1.5rem;
}

.slider-track {
    width: 100%;
    height: 5px;
    position: absolute;
    margin: auto;
    top: 0;
    bottom: 0;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.1);
}

.slider-track-highlight {
    background: var(--accent);
    position: absolute;
    height: 5px;
    border-radius: 5px;
}

input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    outline: none;
    position: absolute;
    margin: auto;
    top: 0;
    bottom: 0;
    background-color: transparent;
    pointer-events: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    height: 5px;
}

input[type="range"]::-moz-range-track {
    -moz-appearance: none;
    height: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 1.4rem;
    width: 1.4rem;
    background-color: var(--accent);
    cursor: pointer;
    border-radius: 50%;
    pointer-events: auto;
    margin-top: -8px;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(166, 124, 82, 0.3);
}

input[type="range"]::-moz-range-thumb {
    -moz-appearance: none;
    height: 1.4rem;
    width: 1.4rem;
    background-color: var(--accent);
    cursor: pointer;
    border-radius: 50%;
    pointer-events: auto;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(166, 124, 82, 0.3);
}

input[type="range"]:active::-webkit-slider-thumb {
    background-color: var(--primary-hover);
    transform: scale(1.1);
}

/* Language Switcher */
.lang-switcher {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.3s ease;
    border-radius: 0.25rem;
}

.lang-btn:hover {
    color: var(--primary);
}

.lang-btn.active {
    color: var(--primary);
    background: rgba(30, 58, 52, 0.05);
}

.lang-divider {
    color: var(--glass-border);
    font-weight: 300;
}

/* Visualization */
/* View Toggle */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.toggle-switch {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    display: flex;
    padding: 0.35rem;
    position: relative;
    width: 280px;
    height: 54px;
    box-shadow: var(--shadow-modern);
}

.toggle-switch input {
    display: none;
}

.toggle-switch label {
    flex: 1;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
    z-index: 2;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.4s;
    margin: 0;
    letter-spacing: 0.05em;
}

.toggle-switch input:checked+label {
    color: white;
}

.toggle-slider {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    width: calc(50% - 0.35rem);
    height: calc(100% - 0.7rem);
    background: var(--primary);
    border-radius: 0.75rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

#view-stats:checked~.toggle-slider {
    transform: translateX(100%);
}

/* Sort Button */
.sort-group {
    flex: 0 0 auto;
    min-width: unset;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--primary);
    width: 46px;
    height: 46px;
    border-radius: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-modern);
}

.icon-btn:hover {
    background: white;
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(166, 124, 82, 0.2);
}

.icon-btn svg {
    transition: transform 0.3s;
}

/* Grid & Viz Toggling */
#handpan-grid.hidden {
    display: none;
}

.viz-wrapper {
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out;
    max-height: 1000px;
    opacity: 1;
    overflow: hidden;
}

.viz-wrapper.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.viz-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
}

.viz-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.viz-row:last-child {
    margin-bottom: 0;
}

.viz-item.full-width {
    grid-column: 1 / -1;
}

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

.viz-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#price-chart,
#availability-chart,
#notes-price-chart {
    width: 100%;
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}


.bar {
    fill: var(--primary);
    transition: fill 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar:hover {
    fill: var(--accent);
}

.axis-label {
    fill: var(--text-muted);
    font-size: 0.75rem;
}

.tick text {
    fill: var(--text-muted);
}

.tick line {
    stroke: var(--glass-border);
}

.domain {
    stroke: var(--glass-border);
}

/* Grid */
.handpan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Card */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modern);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 40px 80px -20px rgba(30, 58, 52, 0.12);
    border-color: var(--accent);
}

.card-content {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.maker-badge {
    background: rgba(30, 58, 52, 0.05);
    color: var(--primary);
    padding: 0.35rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(30, 58, 52, 0.1);
}

.availability {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.available {
    color: #27ae60;
}

.unavailable {
    color: #e67e22;
}

.handpan-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    line-height: 1.3;
}

.scale-info {
    margin-bottom: 1.25rem;
}

.scale-name {
    display: inline-block;
    background: rgba(166, 124, 82, 0.08);
    color: var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(166, 124, 82, 0.1);
}

.specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spec-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.spec-value {
    font-size: 0.95rem;
    font-weight: 400;
}

.card-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-tag {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary);
}

.view-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(85, 107, 47, 0.2);
}

.view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(85, 107, 47, 0.3);
    filter: brightness(1.1);
}

/* Loading/Empty State */
.empty-state {
    text-align: center;
    grid-column: 1 / -1;
    padding: 4rem;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    h1 {
        font-size: 3rem;
    }

    .container {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .filters {
        padding: 1.5rem;
        gap: 1.25rem;
    }

    .filter-group {
        min-width: calc(50% - 0.75rem);
    }

    .viz-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 2.25rem;
    }

    .subtitle {
        font-size: 0.9rem;
        letter-spacing: 0.1em;
    }

    header {
        margin-bottom: 2.5rem;
    }

    .filter-group {
        min-width: 100%;
    }

    .lang-switcher {
        top: 1rem;
        right: 1rem;
    }

    .toggle-switch {
        width: 100%;
        max-width: 320px;
    }

    .card {
        border-radius: 1.25rem;
    }

    .card-content {
        padding: 1.5rem;
    }

    .viz-container {
        padding: 1.25rem;
    }
}

.viz-item {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Footer & Legal */
footer {
    margin-top: 6rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.footer-content a:hover {
    color: var(--primary);
}

.footer-divider {
    color: var(--glass-border);
    margin: 0 1rem;
    font-weight: 300;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 3rem;
    border-radius: 2rem;
    position: relative;
    box-shadow: var(--shadow-modern);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-body h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    margin-top: 2.5rem;
}

.modal-body h2:first-child {
    margin-top: 0;
}

.legal-section {
    margin-bottom: 2rem;
    line-height: 1.6;
}

.legal-section p {
    margin-bottom: 0.5rem;
}

.about-section {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--text-main);
}

.about-section p {
    margin-bottom: 1.5rem;
}

.about-section p:last-child {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .modal-content {
        padding: 2rem 1.5rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}