/* ============================================================
   Machine Shop Intelligence — Professional SaaS UI
   Font: Roboto (Google Fonts)
   ============================================================ */

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

:root {
    --red: #e4002b;
    --red-dark: #b8001f;
    --red-light: #fff1f2;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --green: #059669;
    --amber: #d97706;
    --blue: #2563eb;

    --nav-w: 220px;
    --top-bar-h: 52px;
    --radius: 6px;
    --font: "Roboto", system-ui, sans-serif;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:
        0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg:
        0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 13px;
    line-height: 1.5;
}

/* ── App Shell ── */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Nav Sidebar ── */
.nav-sidebar {
    width: var(--nav-w);
    background: var(--gray-900);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    z-index: 100;
    transition: transform 0.2s ease;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.nav-logo-mark {
    width: 32px;
    height: 32px;
    background: var(--red);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.nav-logo-text {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.nav-items {
    flex: 1;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    overflow-y: auto;
}

.nav-bottom {
    padding: 0.5rem 0.5rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
    text-align: left;
    transition: all 0.12s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

.nav-item.active {
    background: rgba(228, 0, 43, 0.15);
    color: white;
    font-weight: 500;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--red);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
    opacity: 1;
}

.nav-label {
    flex: 1;
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
}

/* ── Top Bar ── */
.top-bar {
    height: var(--top-bar-h);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    flex-shrink: 0;
    background: white;
    z-index: 10;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    letter-spacing: -0.2px;
}

.shop-count {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 400;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--gray-600);
}

.mobile-menu-btn svg {
    width: 18px;
    height: 18px;
}

.filter-trigger-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-600);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
}

.filter-trigger-btn svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.filter-trigger-btn:hover {
    border-color: var(--gray-300);
    color: var(--gray-800);
    background: var(--gray-50);
}

.filter-count-badge {
    background: var(--red);
    color: white;
    border-radius: 10px;
    padding: 0.05rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

/* ── Active Filter Chips ── */
.active-filters-bar {
    display: flex;
    overflow-x: auto;
    gap: 0.25rem;
    padding: 0.375rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
    scrollbar-width: none;
    background: var(--gray-50);
}

.active-filters-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid rgba(228, 0, 43, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-chip button {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0.6;
    padding: 0;
    transition: opacity 0.1s;
}

.filter-chip button:hover {
    opacity: 1;
}

/* ── Views ── */
.view-map,
.view-table,
.view-about {
    display: none;
    flex: 1;
    overflow: hidden;
}

.view-map.active,
.view-table.active,
.view-about.active {
    display: flex;
    flex-direction: column;
}

.map-container {
    flex: 1;
    width: 100%;
}

.table-container {
    flex: 1;
    overflow: auto;
    padding: 1.25rem;
    background: var(--gray-50);
}

/* ── Filter Drawer ── */
.filter-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1999;
}

.filter-drawer-overlay.open {
    display: block;
}

.filter-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: white;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
}

.filter-drawer.open {
    transform: translateX(0);
}

.filter-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.filter-drawer-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.filter-drawer-close {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.12s;
}

.filter-drawer-close:hover {
    color: var(--gray-700);
}

.filter-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-200) transparent;
}

.filter-drawer-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

/* ── Search Input ── */
#searchInput {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.78rem;
    color: var(--gray-800);
    background: var(--gray-50);
    outline: none;
    transition:
        border-color 0.12s ease,
        box-shadow 0.12s ease;
}

#searchInput::placeholder {
    color: var(--gray-400);
}

#searchInput:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(228, 0, 43, 0.06);
    background: white;
}

/* ── Accordion ── */
.accordion-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    background: white;
    margin-bottom: 0.375rem;
}

.accordion-header {
    background: white;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--gray-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.12s ease;
}

.accordion-header:hover {
    background: var(--gray-50);
}

.accordion-icon {
    font-size: 0.55rem;
    color: var(--gray-400);
    transition: transform 0.15s ease;
}

.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0.625rem 0.75rem;
    border-top: 1px solid var(--gray-100);
    display: none;
    background: white;
}

.accordion-item.open .accordion-content {
    display: block;
}

/* ── Checkbox Pills ── */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.checkbox-group label {
    background: var(--gray-50);
    padding: 0.2rem 0.625rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    transition: all 0.1s ease;
}

.checkbox-group label:hover {
    border-color: var(--gray-300);
    color: var(--gray-800);
    background: white;
}

.checkbox-group label input[type="checkbox"] {
    display: none;
}

.checkbox-group label:has(input:checked) {
    background: var(--red-light);
    color: var(--red);
    border-color: rgba(228, 0, 43, 0.2);
    font-weight: 500;
}

/* ── Reset Button ── */
.reset-btn {
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    font-family: var(--font);
    transition: all 0.12s ease;
    text-align: center;
}

.reset-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-light);
}

/* ── Sliders ── */
.slider-container {
    padding: 0.5rem 0.25rem;
}

.slider-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--gray-400);
    margin-top: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.noUi-handle {
    width: 14px !important;
    height: 14px !important;
    right: -7px !important;
    top: -5px !important;
    border-radius: 50% !important;
    background: var(--red) !important;
    border: 2px solid white !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
    cursor: pointer !important;
}

.noUi-handle::before,
.noUi-handle::after {
    display: none !important;
}
.noUi-connect {
    background: var(--red) !important;
}
.noUi-target {
    background: var(--gray-200) !important;
    border: none !important;
    box-shadow: none !important;
    height: 2px !important;
    border-radius: 2px !important;
}

/* ── Export Button ── */
.export-wrapper {
    margin-bottom: 0.875rem;
    display: flex;
    justify-content: flex-end;
}

.export-btn {
    background: white;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    padding: 0.4rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font);
    transition: all 0.12s ease;
}

.export-btn:hover {
    border-color: var(--gray-300);
    color: var(--gray-800);
    background: var(--gray-50);
}

/* ── Table ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 500;
    color: var(--gray-500);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

td {
    padding: 0.75rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: top;
    line-height: 1.4;
}

tr:last-child td {
    border-bottom: none;
}
tr:hover td {
    background: var(--gray-50);
}

.contact-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

.contact-link:hover {
    text-decoration: underline;
}
.na-text {
    color: var(--gray-300);
}

/* ── Badges ── */
.lead-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-badge.high {
    background: #d1fae5;
    color: #065f46;
}
.lead-badge.medium {
    background: #fef3c7;
    color: #92400e;
}
.lead-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Shop Modal ── */
#shop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#shop-modal.active {
    display: flex;
}

#modal-content {
    background: white;
    border-radius: 8px;
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gray-200);
}

/* ── Clusters ── */
.marker-cluster-small {
    background-color: rgba(228, 0, 43, 0.1);
}
.marker-cluster-small div {
    background-color: rgba(228, 0, 43, 0.8);
    color: white;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.75rem;
}
.marker-cluster-medium {
    background-color: rgba(217, 119, 6, 0.1);
}
.marker-cluster-medium div {
    background-color: rgba(217, 119, 6, 0.85);
    color: white;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.75rem;
}
.marker-cluster-large {
    background-color: rgba(5, 150, 105, 0.1);
}
.marker-cluster-large div {
    background-color: rgba(5, 150, 105, 0.85);
    color: white;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.75rem;
}

/* ── Mobile Nav Overlay ── */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.mobile-nav-overlay.open {
    display: block;
}

/* ── About Page ── */
.view-about {
    overflow-y: auto;
    background: var(--gray-50);
}

.about-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

.about-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.about-logo-mark {
    width: 48px;
    height: 48px;
    background: var(--red);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.about-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.about-subtitle {
    font-size: 0.82rem;
    color: var(--gray-500);
}

.about-section {
    margin-bottom: 2rem;
}

.about-section h2 {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.875rem;
}

.about-section p {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.about-steps {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.about-step {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.about-step-num {
    width: 24px;
    height: 24px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.about-step strong {
    display: block;
    font-size: 0.82rem;
    color: var(--gray-800);
    margin-bottom: 0.2rem;
}

.about-step p {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.5;
}

.about-behind {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    border-left: 3px solid var(--red);
}

.about-teaser {
    font-weight: 600;
    color: var(--gray-700) !important;
    font-style: italic;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .nav-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
    }

    .nav-sidebar.open {
        transform: translateX(0);
    }
    .mobile-menu-btn {
        display: flex;
    }

    .filter-drawer {
        width: 90%;
        max-width: 320px;
    }

    th,
    td {
        font-size: 0.7rem;
        padding: 0.5rem;
    }

    .about-content {
        padding: 1.5rem 1rem;
    }
}
.filter-chip-clear-all {
    background: none;
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
    padding: 0.15rem 0.625rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
    transition: all 0.12s ease;
    flex-shrink: 0;
}

.filter-chip-clear-all:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-light);
}
@media (max-width: 768px) {
    .nav-sidebar {
        z-index: 1000;
    }
    .filter-drawer {
        z-index: 1001;
    }
    .filter-drawer-overlay {
        z-index: 1000;
    }
}
