/* Global search + shipment detail */

.global-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 10px 22px 12px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(17, 24, 39, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 1;
    transform: translateY(0);
    overflow: visible;
    transition:
        opacity 0.22s ease,
        transform 0.28s ease,
        padding 0.28s ease,
        border-color 0.22s ease,
        max-height 0.28s ease;
}

.global-topbar.is-hidden {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
    pointer-events: none;
    overflow: hidden;
}

.global-search-wrap {
    position: relative;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    z-index: 210;
}

.global-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    padding: 0 16px;
    min-height: 42px;
    box-shadow: 0 4px 18px rgba(10, 22, 40, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.global-search-wrap.is-active .global-search-input-wrap,
.global-search-input-wrap:focus-within {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
    background: #fff;
}

.global-search-input-wrap i {
    color: var(--text-tertiary);
    font-size: 13px;
    flex-shrink: 0;
}

.global-search-input-wrap input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy-900);
}

.global-search-input-wrap input::placeholder {
    color: var(--text-tertiary);
    font-weight: 550;
}

.global-search-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 8px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    animation: globalSearchFiltersIn 0.22s ease;
}

.global-search-filters::-webkit-scrollbar {
    display: none;
}

.global-search-filters[hidden] {
    display: none !important;
}

@keyframes globalSearchFiltersIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.global-search-filter {
    border: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(255, 255, 255, 0.95);
    color: var(--navy-800);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.global-search-filter:hover {
    background: var(--gray-50);
    border-color: rgba(17, 24, 39, 0.12);
}

.global-search-filter.active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.global-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    max-height: min(400px, 55vh);
    overflow: auto;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(10, 22, 40, 0.14);
    display: none;
    z-index: 300;
}

.global-search-results.open {
    display: block;
    animation: globalSearchResultsIn 0.18s ease;
}

@keyframes globalSearchResultsIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.global-search-result {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.05);
    cursor: pointer;
    transition: background 0.15s ease;
}

.global-search-result:last-child {
    border-bottom: none;
}

.global-search-result:hover,
.global-search-result:focus-visible {
    background: rgba(249, 250, 251, 0.98);
    outline: none;
}

.global-search-result-title {
    font-size: 13px;
    font-weight: 800;
    color: #2563eb;
}

.global-search-result-sub {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 650;
    color: var(--navy-800);
}

.global-search-result-meta {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 650;
    color: var(--text-tertiary);
}

.global-search-empty,
.global-search-loading {
    padding: 18px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 650;
    color: var(--text-tertiary);
}

/* Floating search for standalone pages */
.global-search-floating {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1200;
    width: min(400px, calc(100vw - 28px));
}

.global-search-floating .global-search-results {
    position: absolute;
}

/* Shipment detail view */
.shipment-detail-view .view-topbar {
    margin-bottom: 14px;
}

.shipment-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.shipment-detail-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(10, 22, 40, 0.06);
    overflow: hidden;
}

.shipment-detail-card.full-width {
    grid-column: 1 / -1;
}

.shipment-detail-card-head {
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.shipment-detail-card-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 900;
    color: var(--navy-900);
}

.shipment-detail-card-body {
    padding: 14px 16px 16px;
}

.shipment-kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
}

.shipment-kv {
    min-width: 0;
}

.shipment-kv label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 3px;
}

.shipment-kv .value {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-900);
    word-break: break-word;
}

.shipment-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.shipment-milestones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.shipment-milestone {
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 12px;
    padding: 10px;
    background: rgba(249, 250, 251, 0.8);
}

.shipment-milestone label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.shipment-milestone .value {
    font-size: 12px;
    font-weight: 700;
    color: var(--navy-900);
}

.shipment-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.shipment-mini-table th,
.shipment-mini-table td {
    padding: 8px 6px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.06);
    text-align: left;
    vertical-align: top;
}

.shipment-mini-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

@media (max-width: 900px) {
    .global-topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    .shipment-detail-grid {
        grid-template-columns: 1fr;
    }

    .shipment-kv-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .global-topbar,
    .global-search-input-wrap,
    .global-search-filter,
    .global-search-results,
    .global-search-filters {
        animation: none;
        transition: none;
    }
}
