:root {
    --bg: #080b12;
    --sidebar: #0b0f17;
    --panel: #101621;
    --panel-hover: #141b28;
    --border: rgba(255, 255, 255, 0.07);

    --text: #f5f7fb;
    --muted: #8993a4;
    --muted-2: #5e6878;

    --primary: #7657ff;
    --primary-light: #9178ff;
    --green: #36d69c;

    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 75% -10%,
            rgba(118, 87, 255, 0.14),
            transparent 35%
        ),
        radial-gradient(
            circle at 20% 40%,
            rgba(59, 130, 246, 0.035),
            transparent 30%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

/* ================================
   APP
================================ */

.app {
    min-height: 100vh;
}

/* ================================
   SIDEBAR
================================ */

.sidebar {
    position: fixed;

    left: 0;
    top: 0;
    bottom: 0;

    width: 250px;

    padding: 26px 16px;

    background: rgba(9, 13, 21, 0.94);

    border-right: 1px solid var(--border);

    display: flex;
    flex-direction: column;

    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 4px 10px 35px;
}

.brand-logo {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            #9279ff,
            #5f43e4
        );

    color: white;

    font-size: 17px;

    box-shadow:
        0 8px 30px
        rgba(118, 87, 255, 0.28);
}

.brand strong {
    display: block;

    font-size: 14px;
    font-weight: 700;
}

.brand small {
    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 9px;
}

/* ================================
   NAVIGATION
================================ */

.sidebar nav {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.nav-btn {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 12px 13px;

    border: 0;
    border-radius: 10px;

    background: transparent;

    color: var(--muted);

    text-align: left;

    font-size: 12px;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.nav-btn span {
    width: 20px;

    display: inline-flex;
    justify-content: center;

    color: inherit;

    font-size: 14px;
}

.nav-btn:hover {
    color: white;

    background: rgba(255, 255, 255, 0.045);

    transform: translateX(2px);
}

.nav-btn.active {
    color: white;

    background:
        linear-gradient(
            90deg,
            rgba(118, 87, 255, 0.16),
            rgba(118, 87, 255, 0.05)
        );

    box-shadow:
        inset 2px 0 0 var(--primary);
}

/* ================================
   SIDEBAR FOOTER
================================ */

.sidebar-footer {
    margin-top: auto;
}

.connection {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 13px;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.025);
}

.connection-dot {
    width: 8px;
    height: 8px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 12px
        rgba(54, 214, 156, 0.7);
}

.connection strong {
    display: block;

    font-size: 10px;
}

.connection small {
    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 9px;
}

/* ================================
   MAIN
================================ */

.main {
    min-height: 100vh;

    margin-left: 250px;

    padding: 0 55px 70px;
}

/* ================================
   TOPBAR
================================ */

.topbar {
    height: 96px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border);
}

.label {
    display: block;

    color: var(--primary-light);

    font-size: 9px;

    font-weight: 700;

    letter-spacing: 2px;
}

.topbar h1 {
    margin: 5px 0 0;

    font-size: 21px;

    letter-spacing: -0.4px;
}

.profile {
    display: flex;
    align-items: center;

    gap: 12px;

    color: var(--muted);

    font-size: 11px;
}

.avatar {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: #242c3b;

    color: white;

    font-size: 10px;
}

/* ================================
   HERO
================================ */

.hero {
    padding: 64px 0 42px;
}

.hero h2 {
    max-width: 720px;

    margin: 13px 0 12px;

    font-size: clamp(36px, 4.5vw, 56px);

    line-height: 1.04;

    letter-spacing: -2.5px;
}

.hero h2 span {
    color: var(--primary-light);
}

.hero p {
    margin: 0 0 32px;

    color: var(--muted);

    font-size: 13px;
}

/* ================================
   SEARCH
================================ */

.search-form {
    width: 100%;
    max-width: 850px;

    min-height: 66px;

    padding: 7px;

    display: flex;
    align-items: center;

    gap: 10px;

    background:
        rgba(16, 22, 33, 0.88);

    border: 1px solid
        rgba(255, 255, 255, 0.09);

    border-radius: 15px;

    box-shadow:
        0 20px 70px
        rgba(0, 0, 0, 0.28);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-form:focus-within {
    border-color:
        rgba(118, 87, 255, 0.5);

    box-shadow:
        0 0 0 4px
        rgba(118, 87, 255, 0.07),
        0 20px 70px
        rgba(0, 0, 0, 0.28);
}

.search-icon {
    width: 42px;

    display: flex;
    justify-content: center;

    color: var(--muted);

    font-size: 20px;
}

.search-form input {
    flex: 1;

    min-width: 0;

    height: 50px;

    padding: 0 5px;

    border: 0;
    outline: 0;

    background: transparent;

    color: white;

    font-size: 13px;
}

.search-form input::placeholder {
    color: var(--muted-2);
}

.search-form button {
    height: 50px;

    padding: 0 21px;

    display: flex;
    align-items: center;
    gap: 10px;

    border: 0;
    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            #866cff,
            #6547e5
        );

    color: white;

    font-size: 12px;

    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.search-form button:hover {
    transform: translateY(-1px);

    box-shadow:
        0 10px 28px
        rgba(118, 87, 255, 0.3);
}

.search-form button:active {
    transform: translateY(0);
}

.search-form button:disabled {
    opacity: 0.65;

    cursor: wait;
}

/* ================================
   STATS
================================ */

.stats {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 15px;

    margin-bottom: 55px;
}

.stat {
    position: relative;

    padding: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(18, 25, 37, 0.95),
            rgba(13, 18, 28, 0.95)
        );

    border: 1px solid var(--border);

    border-radius: 14px;

    overflow: hidden;
}

.stat::after {
    content: "";

    position: absolute;

    right: -30px;
    bottom: -50px;

    width: 120px;
    height: 120px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(118, 87, 255, 0.1),
            transparent 70%
        );
}

.stat > span {
    display: block;

    color: var(--muted);

    font-size: 9px;

    font-weight: 700;

    letter-spacing: 1.5px;
}

.stat strong {
    display: block;

    margin-top: 13px;

    font-size: 29px;

    letter-spacing: -1px;
}

.stat small {
    display: block;

    margin-top: 5px;

    color: var(--muted-2);

    font-size: 10px;
}

/* ================================
   RESULTS
================================ */

.results-section {
    scroll-margin-top: 30px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 20px;
}

.section-heading h3 {
    margin: 6px 0 0;

    font-size: 21px;

    letter-spacing: -0.5px;
}

.query-label {
    color: var(--muted);

    font-size: 10px;
}

/* ================================
   SOURCE CARD
================================ */

.source-card {
    margin-bottom: 18px;

    overflow: hidden;

    background:
        rgba(16, 22, 33, 0.88);

    border: 1px solid var(--border);

    border-radius: 15px;

    box-shadow:
        0 15px 50px
        rgba(0, 0, 0, 0.12);
}

.source-header {
    min-height: 76px;

    padding: 17px 21px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border);
}

.source-info {
    display: flex;
    align-items: center;

    gap: 12px;
}

.database-icon {
    width: 39px;
    height: 39px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background:
        rgba(118, 87, 255, 0.1);

    color: var(--primary-light);

    font-size: 15px;
}

.source-info h4 {
    margin: 0 0 4px;

    font-size: 12px;
}

.source-info small {
    color: var(--muted);

    font-size: 9px;
}

.badge {
    padding: 5px 9px;

    border-radius: 6px;

    background:
        rgba(118, 87, 255, 0.09);

    color: var(--primary-light);

    font-size: 8px;

    font-weight: 700;

    letter-spacing: 1px;
}

/* ================================
   TABLE
================================ */

.table-wrap {
    width: 100%;

    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;
}

th {
    padding: 13px 20px;

    background:
        rgba(255, 255, 255, 0.018);

    color: var(--muted-2);

    text-align: left;

    font-size: 8px;

    text-transform: uppercase;

    letter-spacing: 1.2px;

    white-space: nowrap;
}

td {
    padding: 14px 20px;

    border-top: 1px solid
        rgba(255, 255, 255, 0.035);

    color: #c3cad5;

    font-size: 10px;

    white-space: nowrap;
}

tbody tr {
    transition:
        background 0.15s ease;
}

tbody tr:hover {
    background:
        rgba(255, 255, 255, 0.025);
}

/* ================================
   EMPTY
================================ */

.empty-state {
    min-height: 270px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;

    border: 1px dashed
        rgba(255, 255, 255, 0.08);

    border-radius: 17px;

    background:
        rgba(255, 255, 255, 0.008);
}

.empty-icon {
    width: 55px;
    height: 55px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background:
        rgba(118, 87, 255, 0.08);

    color: var(--primary-light);

    font-size: 20px;

    box-shadow:
        0 0 40px
        rgba(118, 87, 255, 0.08);
}

.empty-state h3 {
    margin: 17px 0 6px;

    font-size: 15px;
}

.empty-state p {
    margin: 0;

    color: var(--muted);

    font-size: 11px;
}

/* ================================
   TOAST
================================ */

.toast {
    position: fixed;

    right: 25px;
    bottom: 25px;

    min-width: 280px;

    padding: 15px 18px;

    display: flex;
    flex-direction: column;

    background: #151b27;

    border: 1px solid
        rgba(255, 255, 255, 0.08);

    border-radius: 12px;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.45);

    transform:
        translateY(25px);

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;

    z-index: 9999;
}

.toast.show {
    opacity: 1;

    transform:
        translateY(0);
}

.toast strong {
    margin-bottom: 4px;

    font-size: 11px;
}

.toast span {
    color: var(--muted);

    font-size: 10px;
}

/* ================================
   LOADER
================================ */

.loader {
    width: 13px;
    height: 13px;

    border: 2px solid
        rgba(255, 255, 255, 0.25);

    border-top-color: white;

    border-radius: 50%;

    animation:
        spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================
   RESPONSIVE
================================ */

@media (max-width: 1000px) {

    .sidebar {
        width: 220px;
    }

    .main {
        margin-left: 220px;

        padding-left: 35px;
        padding-right: 35px;
    }
}

@media (max-width: 760px) {

    .sidebar {
        width: 70px;

        padding-left: 10px;
        padding-right: 10px;
    }

    .brand {
        justify-content: center;

        padding-left: 0;
        padding-right: 0;
    }

    .brand > div:not(.brand-logo) {
        display: none;
    }

    .nav-btn {
        justify-content: center;

        padding-left: 0;
        padding-right: 0;
    }

    .nav-btn {
        font-size: 0;
    }

    .nav-btn span {
        font-size: 15px;
    }

    .connection {
        justify-content: center;

        padding: 12px 0;
    }

    .connection > div {
        display: none;
    }

    .main {
        margin-left: 70px;

        padding-left: 20px;
        padding-right: 20px;
    }

    .profile > span {
        display: none;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 550px) {

    .topbar {
        height: 80px;
    }

    .hero {
        padding-top: 45px;
    }

    .hero h2 {
        font-size: 38px;

        letter-spacing: -1.8px;
    }

    .search-form {
        flex-wrap: wrap;

        padding: 8px;
    }

    .search-icon {
        display: none;
    }

    .search-form input {
        width: 100%;

        flex: 1 0 100%;
    }

    .search-form button {
        width: 100%;

        justify-content: center;
    }

    .section-heading {
        display: block;
    }

    .query-label {
        display: block;

        margin-top: 12px;
    }
}