/* Layers control — rendered as a native IControl inside the map's control
   stack. Chrome (radius, shadow, white background) comes from the engine's
   ctrl-group classes on the same element; this file styles the contents.

   Per-control custom colors from add_layers_control() arrive as CSS
   variables set inline on the root:
     --lc-bg          background_color
     --lc-text        inactive_text_color
     --lc-active-bg   active_color
     --lc-active-text active_text_color
     --lc-hover-bg    hover_color */

.layers-control {
    background: var(--lc-bg, #fff);
    width: 120px;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

.layers-control a {
    font-size: 12px;
    color: var(--lc-text, #999);
    display: block;
    margin: 0;
    padding: 8px 10px;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    text-align: left;
    transition: all 0.15s ease-in-out;
    font-weight: normal;
}

.layers-control a:last-child {
    border: none;
}

.layers-control a:hover {
    background-color: var(--lc-hover-bg, rgba(0, 0, 0, 0.05));
    color: var(--lc-text, #666);
}

.layers-control a.active {
    background-color: var(--lc-active-bg, transparent);
    color: var(--lc-active-text, #333);
    font-weight: 500;
}

.layers-control a.active:hover {
    background-color: var(
        --lc-hover-bg,
        var(--lc-active-bg, rgba(0, 0, 0, 0.05))
    );
}

.layers-control .toggle-button {
    display: none;
    width: 100%;
    height: auto;
    background: var(--lc-active-bg, #fff);
    color: var(--lc-active-text, #333);
    border: none;
    font: inherit;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    padding: 8px 0;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.15s ease-in-out;
}

.layers-control .toggle-button:hover {
    background: var(--lc-hover-bg, var(--lc-active-bg, rgba(0, 0, 0, 0.05)));
}

.layers-control .layers-list {
    display: block;
}

.layers-control.collapsible .toggle-button {
    display: block;
}

.layers-control.collapsible.open .toggle-button {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.layers-control.collapsible .layers-list {
    display: none;
    opacity: 0;
    max-height: 0;
    transition:
        opacity 0.25s ease,
        max-height 0.25s ease;
}

.layers-control.collapsible.open .layers-list {
    display: block;
    opacity: 1;
    max-height: 500px; /* Large enough value to accommodate all content */
}

/* Compact icon styling: collapsed control is a native-sized icon button */
.layers-control.collapsible.icon-only {
    width: auto;
    min-width: 29px;
}

.layers-control.collapsible.icon-only .toggle-button {
    padding: 0;
    width: 29px;
    height: 29px;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layers-control.collapsible.icon-only.open {
    width: 120px;
}

.layers-control.collapsible.icon-only.open .toggle-button {
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
