/* Commerce Toggle - Country Tree Selector */
.country-tree ul {
    list-style: none;
    padding-left: 2rem;
    padding-top: 0.45rem;
    margin: 0;
}

.country-tree > ul {
    padding-left: 0;
}

.country-tree-node {
    padding: 2px 0;
}

.country-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    user-select: none;
    color: #666;
    font-size: 0.75rem;
    vertical-align: middle;
    flex-shrink: 0;
}

.country-tree-toggle::before {
    content: '\25B6';
    display: inline-block;
    transition: transform 0.25s ease-in-out;
}

.country-tree-open > .country-tree-toggle::before {
    transform: rotate(90deg);
}

.country-tree-node > ul {
    overflow: hidden;
    max-height: 5000px;
    transition: max-height 0.3s ease-in-out, opacity 0.25s ease-in-out;
    opacity: 1;
}

.country-tree-closed > ul {
    max-height: 0;
    opacity: 0;
    transition: max-height 0.25s ease-in-out, opacity 0.2s ease-in-out;
}

.country-tree-leaf > .country-tree-toggle {
    visibility: hidden;
    width: 0;
}

/* Continent / country labels */
.country-tree-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
    vertical-align: middle;
}

.country-tree-label::before {
    content: '';
    flex-shrink: 0;
    display: inline-block;
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Continent folder icons */
.country-tree-node:not(.country-tree-leaf) > .country-tree-label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d4a017'%3E%3Cpath d='M10 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z'/%3E%3C/svg%3E");
}

.country-tree-node.country-tree-open:not(.country-tree-leaf) > .country-tree-label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d4a017'%3E%3Cpath d='M20 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v1H11l-2 5h11.28a2 2 0 0 0 1.94-1.51L24 8H4v9l2-6h16l-2.6 7.78A2 2 0 0 1 17.5 20H4a2 2 0 0 1-2-2'/%3E%3C/svg%3E");
}

/* Country leaf: no icon */
.country-tree-leaf > .country-tree-label::before {
    display: none;
}

.country-tree-leaf {
    padding-left: 3rem;
}

.country-tree-label:hover > span {
    text-decoration: underline;
}

.country-tree-cb {
    flex-shrink: 0;
    margin: 0 !important;
}

/* Root node container */
.country-tree > ul > .country-tree-node > ul {
    max-height: none;
    overflow: visible;
}

/* Continent separators */
.country-tree-node[data-continent] {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.country-tree-node[data-continent]:last-child {
    border-bottom: none;
}

/* Search input */
.country-tree-search {
    margin-bottom: 1rem;
}

/* Selected count badge */
.country-tree-count {
    font-size: 0.75rem;
    color: #666;
    margin-left: 0.5rem;
}

.country-tree-count.has-selection {
    color: #d4a017;
    font-weight: 600;
}
