
/* ============================================================
   CUSTOM DROPDOWNS
   ============================================================ */

.custom-dropdown {
    position: relative;
    z-index: 10;
    display: inline-block;
    width: 100%;
    min-width: 150px;
    color: var(--text-main, #fff);
    font-family: inherit;
}

.custom-dropdown-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-dropdown-trigger {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid rgba(140, 175, 204, 0.28);
    border-radius: var(--radius, 12px);
    background:
        linear-gradient(
            180deg,
            rgba(19, 34, 50, 0.98),
            rgba(11, 24, 37, 0.98)
        );
    color: #f8fafc;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    outline: none;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition:
        border-color .18s ease,
        background .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.custom-dropdown-trigger:hover {
    border-color: rgba(61, 135, 255, 0.55);
    background:
        linear-gradient(
            180deg,
            rgba(24, 43, 63, 0.98),
            rgba(12, 27, 42, 0.98)
        );
}

.custom-dropdown-trigger:focus-visible,
.custom-dropdown.is-open .custom-dropdown-trigger {
    border-color: rgba(61, 135, 255, 0.85);
    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.14),
        0 8px 22px rgba(0, 0, 0, 0.24);
}

.custom-dropdown-chevron {
    flex: 0 0 auto;
    font-size: 11px;
    opacity: .65;
    transition: transform .2s ease;
}

.custom-dropdown.is-open .custom-dropdown-chevron {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    z-index: 3000;
    left: 0;
    right: 0;
    top: calc(100% + 7px);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px;
    max-height: 280px;
    overflow-y: auto;
    background:
        linear-gradient(
            180deg,
            rgba(18, 31, 46, 0.995),
            rgba(9, 21, 33, 0.995)
        );
    border: 1px solid rgba(140, 175, 204, 0.22);
    border-radius: var(--radius, 12px);
    box-shadow:
        0 18px 45px rgba(0, 0, 0, .42),
        inset 0 1px 0 rgba(255, 255, 255, .035);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px) scale(.985);
    transform-origin: top;
    pointer-events: none;
    transition:
        opacity .15s ease,
        visibility .15s ease,
        transform .15s ease;
}

.custom-dropdown.is-open {
    z-index: 99999;
}

.custom-dropdown.is-open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    z-index: 999999;
}

.custom-dropdown-option {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #dbe8f4;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.custom-dropdown-option:hover,
.custom-dropdown-option:focus-visible {
    background: rgba(61, 135, 255, .12);
    color: #fff;
    outline: none;
}

.custom-dropdown-option.is-selected {
    background: rgba(37, 99, 235, .16);
    color: #fff;
}

.custom-dropdown-option.is-disabled {
    opacity: .4;
    cursor: not-allowed;
}

.custom-dropdown-check {
    width: 16px;
    text-align: center;
    color: var(--accent-blue-light, #3d87ff);
    font-size: 12px;
}

/* Status dropdowns inside patrol cards */
.patrol-status .custom-dropdown {
    width: auto;
    min-width: 120px;
}

.patrol-status .custom-dropdown-trigger {
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 14px;
    background: rgba(8, 19, 30, .58);
}

.patrol-status .custom-dropdown-menu {
    min-width: 150px;
}

.patrol-status .custom-dropdown--ledig .custom-dropdown-trigger,
.patrol-status .custom-dropdown--ledig .custom-dropdown-option.is-selected {
    color: #22c55e;
}

.patrol-status .custom-dropdown--patrulje .custom-dropdown-trigger,
.patrol-status .custom-dropdown--patrulje .custom-dropdown-option.is-selected {
    color: #f59e0b;
}

.patrol-status .custom-dropdown--pause .custom-dropdown-trigger,
.patrol-status .custom-dropdown--pause .custom-dropdown-option.is-selected {
    color: #ef4444;
}

.patrol-status .custom-dropdown--sagsbehandling .custom-dropdown-trigger,
.patrol-status .custom-dropdown--sagsbehandling .custom-dropdown-option.is-selected {
    color: #06b6d4;
}

.patrol-status .custom-dropdown--patrol-task-status-select .custom-dropdown-trigger,
.patrol-status .custom-dropdown--patrol-task-status-select .custom-dropdown-option.is-selected {
    color: #f59e0b;
}

/* Forms */
form .custom-dropdown {
    margin: 0;
}

form .custom-dropdown-trigger {
    min-height: 46px;
}

/* Compact dispatch modes */
body.compact-mode .custom-dropdown-trigger,
body.ultra-compact-mode .custom-dropdown-trigger {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
}

body.compact-mode .patrol-status .custom-dropdown,
body.ultra-compact-mode .patrol-status .custom-dropdown {
    min-width: 105px;
}

.custom-dropdown.has-error .custom-dropdown-trigger {
    border-color: rgba(239, 68, 68, .9);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}

/* Keep dropdown menus above modal content and cards */
.modal .custom-dropdown-menu,
.modal-content .custom-dropdown-menu {
    z-index: 5000;
}


/* ============================================================
   SEARCHABLE TASK DROPDOWN / FREE-TEXT INPUT
   ============================================================ */

.custom-search-dropdown {
    position: relative;
    width: 100%;
    z-index: 20;
}

.custom-search-dropdown.is-open {
    z-index: 99999;
}

.custom-search-dropdown-control {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-search-dropdown-input {
    width: 100%;
    min-height: 46px;
    padding: 11px 44px 11px 13px;
    border: 1px solid rgba(140, 175, 204, 0.28);
    border-radius: var(--radius, 12px);
    background:
        linear-gradient(
            180deg,
            rgba(19, 34, 50, 0.98),
            rgba(11, 24, 37, 0.98)
        );
    color: #f8fafc;
    font: inherit;
    font-weight: 600;
    outline: none;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition:
        border-color .18s ease,
        background .18s ease,
        box-shadow .18s ease;
}

.custom-search-dropdown-input::placeholder {
    color: rgba(219, 232, 244, .55);
}

.custom-search-dropdown-input:hover {
    border-color: rgba(61, 135, 255, 0.55);
}

.custom-search-dropdown.is-open .custom-search-dropdown-input,
.custom-search-dropdown-input:focus {
    border-color: rgba(61, 135, 255, 0.85);
    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.14),
        0 8px 22px rgba(0, 0, 0, 0.24);
}

.custom-search-dropdown-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 100%;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: rgba(219, 232, 244, .65);
    cursor: pointer;
    border-radius: 0 12px 12px 0;
}

.custom-search-dropdown-toggle:hover {
    color: #fff;
}

.custom-search-dropdown.is-open .custom-search-dropdown-toggle i {
    transform: rotate(180deg);
}

.custom-search-dropdown-toggle i {
    font-size: 11px;
    transition: transform .2s ease;
}

.custom-search-dropdown-menu {
    position: absolute;
    z-index: 999999;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px;
    max-height: 280px;
    overflow-y: auto;
    background:
        linear-gradient(
            180deg,
            rgba(18, 31, 46, 0.995),
            rgba(9, 21, 33, 0.995)
        );
    border: 1px solid rgba(140, 175, 204, 0.22);
    border-radius: var(--radius, 12px);
    box-shadow:
        0 18px 45px rgba(0, 0, 0, .42),
        inset 0 1px 0 rgba(255, 255, 255, .035);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px) scale(.985);
    transform-origin: top;
    pointer-events: none;
    transition:
        opacity .15s ease,
        visibility .15s ease,
        transform .15s ease;
}

.custom-search-dropdown.is-open .custom-search-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.custom-search-dropdown-option {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #dbe8f4;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.custom-search-dropdown-option:hover,
.custom-search-dropdown-option:focus-visible {
    background: rgba(61, 135, 255, .12);
    color: #fff;
    outline: none;
}

.custom-search-dropdown-option.is-selected {
    background: rgba(37, 99, 235, .16);
    color: #fff;
}

.custom-search-dropdown-empty {
    padding: 10px;
    color: rgba(219, 232, 244, .55);
    font-size: 13px;
    text-align: center;
}

.modal .custom-search-dropdown-menu,
.modal-content .custom-search-dropdown-menu {
    z-index: 5000;
}
