/*
#nav {
    display: block !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
*/

/* ===============================
   NAV BAR (fixed + clean)
   =============================== */
#navBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #111;
    color: white;
    z-index: 12000 !important;
}

#navBar svg {
    width: 22px;
    height: 22px;
    stroke: white;
    stroke-width: 2;
    cursor: pointer;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* Fix missing icons in dropdown */
.menu-item svg:not([stroke]) {
    stroke: white;
}

/* ===============================
   MENU DROPDOWN (tighter)
   =============================== */
#menuDropdown {
    background: #222;
    color: white;
    border-bottom: 1px solid #444;
    display: none;
    flex-direction: column;
    padding: 4px 0 !important;
    z-index: 15000 !important;
}

/* ===============================
   MENU ITEM (compact buttons)
   =============================== */
.menu-item {
    display: flex;
    align-items: center;
    padding: 4px 10px !important;
    gap: 6px !important;
    cursor: pointer;
    min-height: 26px !important;
    font-size: 14px;
}

/* Smaller icons inside menu items */
.menu-item svg {
    width: 14px !important;
    height: 14px !important;
    stroke-width: 2;
}

/* Divider line */
.menu-divider {
    height: 1px;
    background: #444;
    margin: 4px 0 !important;
}

/* ===============================
   SUBMENUS (Search Mode + Tools)
   =============================== */
#searchModeSubmenu,
#toolsSubmenu {
    display: none;
    flex-direction: column;
    background: #333;
    padding: 2px 0 !important;
}

/* Indent submenu items */
#searchModeSubmenu .menu-item,
#toolsSubmenu .menu-item {
    padding-left: 28px !important;
}

/* ===============================
   Push search UI below nav bar
   =============================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    background: #121212;
    color: #E6E6E6;
    padding-top: 40px !important;
}

/* ===============================
   Top Search Bar
   =============================== */
.top-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    background: #1E1E1E;
    border-bottom: 1px solid #333;
}

.top-bar input,
.top-bar button {
    height: 30px;
    font-size: 14px;
    padding: 3px 8px;
}

#searchInput {
    height: 25px;
    padding: 4px 8px;
    font-size: 16px;
    line-height: 16px;
}

#searchMode {
    height: 34px;
    padding: 0 8px;
    font-size: 14px;
    border-radius: 8px;
    background: #2A2A2A;
    color: white;
    border: 1px solid #444;
}

#searchBtn {
    height: 34px;
    padding: 0 12px;
    font-size: 14px;
    border-radius: 8px;
    background: #007AFF;
    color: white;
    border: none;
    cursor: pointer;
}

/* ===============================
   Table Layout
   =============================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: #1E1E1E;
    color: #E6E6E6;
}

th, td {
    padding: 6px 8px;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

th {
    background: #2A2A2A;
    font-weight: 600;
    color: #FFFFFF;
    padding: 4px 6px !important;
    line-height: 1.0 !important;
    height: 26px;
}

th:nth-child(1), td:nth-child(1) { width: 60px; }
th:nth-child(2), td:nth-child(2) { width: 70px; }
th:nth-child(3), td:nth-child(3) { width: 90px; }
th:nth-child(4), td:nth-child(4) { width: 90px; }
th:nth-child(5), td:nth-child(5) { white-space: normal; }

tr:nth-child(odd)  { background-color: #181818 !important; }
tr:nth-child(even) { background-color: #202020 !important; }
tr:hover           { background-color: #2A2A2A !important; }

.clickable {
    color: #4DA3FF;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

th.asc::after  { content: " ▲"; font-size: 14px; }
th.desc::after { content: " ▼"; font-size: 14px; }

/* ===============================
   Progress Bar
   =============================== */
#progressContainer {
    width: 100%;
    height: 6px;
    background: #ddd;
    margin-top: 4px;
    display: none;
}

#progressBar {
    width: 0%;
    height: 100%;
    background: #007aff;
    transition: width 0.2s ease-out;
}

/* ===============================
   Results Info
   =============================== */
#resultsInfo {
    padding: 8px 12px;
    font-size: 15px;
    color: #444;
}

/* ===============================
   Popup Overlay
   =============================== */
#popupOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 19999 !important;
}

#popupOverlay.show {
    display: block;
}

/* ===============================
   Bottom Popup Menu
   =============================== */
.popup {
    position: fixed;
    bottom: -260px;
    left: 0;
    width: 100%;
    max-width: 100%;
    background: #1E1E1E;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    transition: bottom 0.25s ease-out;
    z-index: 20000 !important;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

.popup.show {
    bottom: 0;
}

.popup-title {
    margin-top: 0;
    margin-bottom: 8px;
    color: white;
    text-align: center;
    font-size: 16px;
}

/* Popup buttons */
.popup-btn {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 15px;
    border-radius: 8px;
    border: none;
    background: #007aff;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.popup-cancel {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border-radius: 8px;
    border: none;
    background: #ff3b30;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* iPhone Optimizations */
@media (max-width: 600px) {
    .popup {
        max-height: 60%;
        overflow-y: auto;
        padding: 10px 12px;
    }

    .popup-btn,
    .popup-cancel {
        font-size: 14px;
        padding: 8px 10px;
    }
}

/* ===============================
   Centered Detail Modal
   =============================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
    z-index: 5000;
}

.hidden {
    display: none;
}

.modal-content {
    background: #FFFFFF;
    width: 86%;
    max-width: 420px;
    padding: 14px;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    font-size: 15px;
    max-height: 70%;
    overflow-y: auto;
    color: #222;
    animation: modal-slide-up 0.22s ease-out;
}

@keyframes modal-slide-up {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-row {
    display: flex;
    margin-bottom: 6px;
}

.modal-ref,
#modalPn {
    font-size: 20px;
    font-weight: 600;
}

/* Side-by-side buttons */
.modal-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* Blue primary */
.modal-copy {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 15px;
    border: none;
    background: #007aff;
    color: white;
}

/* RED close button */
.modal-close-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 15px;
    border: none;
    background: #ff3b30 !important;
    color: white !important;
}

