/* Container for Location Manager */
.loc-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Location Tree Container */
#loc-tree-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

/* Scrollbar styling */
#loc-tree-container::-webkit-scrollbar {
    width: 6px;
}

#loc-tree-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#loc-tree-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Tree Structure */
.tax-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tax-tree ul {
    list-style: none;
    padding-left: 20px;
    border-left: 1px solid #e2e8f0;
    margin-left: 10px;
    margin-top: 5px;
    margin-bottom: 5px;

    /* Hidden by default for logic control */
    display: none;
}

.tax-tree ul.show {
    display: block;
}

.tax-tree li {
    margin-bottom: 2px;
}

/* Tree Item */
.tree-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tree-item:hover {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    transform: translateX(2px);
}

.tree-item.active {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
    font-weight: 500;
}

.tree-item .name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-item .name {
    font-size: 14px;
}

.tree-item .badge {
    font-size: 11px;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #475569;
}

/* Toggle Button */
.toggle-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 12px;
    color: #64748b;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* ===== Location Change Prompt ===== */
.loc-change-prompt {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    animation: loc-slide-in 0.3s ease-out;
}

@keyframes loc-slide-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.loc-change-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.loc-change-content span {
    font-size: 14px;
}

.loc-change-actions {
    display: flex;
    gap: 8px;
}

.loc-change-actions .btn {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

.loc-change-actions .btn:not(.btn-primary) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.loc-change-actions .btn:not(.btn-primary):hover {
    background: rgba(255, 255, 255, 0.3);
}

.loc-change-actions .btn-primary {
    background: white;
    color: #1e40af;
}

/* ===== Pin Indicator ===== */
.loc-pin-indicator {
    font-size: 12px;
    margin-left: 2px;
    cursor: help;
}

/* ===== Pin Checkbox in Modal ===== */
.loc-pin-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
}

.loc-pin-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.loc-pin-wrap span {
    user-select: none;
    font-weight: 500;
}

/* ===== Small Button Variant ===== */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===== Reset to Auto-Detect Button ===== */
.loc-reset-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.loc-reset-btn:hover {
    background: #4b5563;
}

.loc-reset-btn:active {
    background: #374151;
}

/* ===== Location Modal Styles ===== */
/* Moved from static/css/style.css per AGENTS.md Rule 7 */

.loc-modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 400px;
}

.loc-cols {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.loc-col {
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.loc-col:last-child {
    border-right: none;
}

.loc-head {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
    background: #F8FAFC;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.loc-search-wrap {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    position: sticky;
    top: 36px;
    z-index: 5;
}

/* Ensure the nested input-wrap behaves properly */
.loc-search-wrap .input-wrap {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

.loc-search-wrap .input.loc-search-input {
    width: 100%;
    padding: 8px 12px 8px 42px;
    /* standard icon padding */
    font-size: 14px;
    border-radius: 10px;
    height: 40px;
    /* matched height for better feel */
    box-sizing: border-box;
    border: 1px solid var(--border);
    outline: none;
    background: #FFFFFF;
}

.loc-search-wrap .input-icon {
    left: 14px;
    /* standard left offset within input-wrap */
    color: #94A3B8;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
}

.loc-opt {
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #334155;
    transition: background 0.15s ease, color 0.15s ease;
}

.loc-opt:hover {
    background: #F8FAFC;
    color: var(--brand-dark);
}

.loc-opt.selected {
    background: #F1F5F9;
    color: var(--brand-dark);
    font-weight: 600;
}

.loc-opt.active {
    background: #eff6ff;
    color: var(--brand-dark);
    font-weight: 600;
}

.loc-footer {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #FAFBFC;
    border-top: 1px solid var(--border);
}

.loc-footer .loc-pin-wrap {
    flex: 1;
    margin: 0;
    padding: 0;
}

.loc-footer .btn {
    min-width: auto;
}